2011-08-02 4 views
2

내 서블릿에서 봄 구성이 ...봄 WS 및 여러 스키마

<context:component-scan base-package="org.knowledgebase.webservice"/> 
<sws:annotation-driven/> 

<sws:dynamic-wsdl id="carService" 
        portTypeName="carService" 
        locationUri="/carService/"> 
    <sws:xsd location="classpath:/wsDefinition/car/properties.xsd"/> 
    <sws:xsd location="classpath:/wsDefinition/car/carServiceSimple.xsd"/> 
</sws:dynamic-wsdl> 

<bean class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"> 
    <property name="soapVersion"> 
     <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_11"/> 
    </property> 
</bean> 

과 같은 폴더에 두 개의 XSD를 - carServiceSimple.xsd :

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns:pro="http://bar.foo/properties" 
     targetNamespace="http://bar.foo" 
     elementFormDefault="qualified"> 

<xs:import schemaLocation="properties.xsd" namespace="http://bar.foo/properties"/> 

<xs:element name="StoreCarRequest"> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="ID" type="xs:string"/> 
      <xs:element name="Name" type="xs:string"/> 
      <xs:element name="Properties" type="pro:PropertiesType"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element> 
<xs:complexType name="StoreCarResponse"> 
    <xs:sequence> 
     <xs:element name="Status" type="xs:string"/> 
    </xs:sequence> 
</xs:complexType> 

<xs:element name="UpdateCarRequest"> 
    <xs:complexType> 
     <xs:sequence> 
      <xs:element name="ID" type="xs:string"/> 
      <xs:element name="Properties" type="pro:PropertiesType"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:element> 
<xs:complexType name="UpdateCarResponse"> 
    <xs:sequence> 
     <xs:element name="Status" type="xs:string"/> 
    </xs:sequence> 
</xs:complexType> 
</xs:schema> 
  • properties.xsd :

그러나 글래스 피시 3에 배포 한 후는 예외가 제기되어 여러 요소 커먼즈 XMLSchema.Please 클래스 경로에 가공 된 XMLSchema를 넣어 필요합니다.

스프링 ws 문서 섹션 5.3.1 : 포함 또는 가져 오기를 통해 여러 스키마를 사용하려는 경우 클래스 경로에 Commons XMLSchema를 넣을 수 있습니다. Commons XMLSchema가 클래스 경로에 있으면 위의 요소는 모든 XSD 가져 오기를 따르고 WSDL에서 단일 XSD로 포함하고 인라인합니다.

"Commons XMLSchema"란 무엇을 의미합니까? 어떻게 해결할 수 있습니까? 고마워.

클래스 패스에 두 개의 XSD 파일이 있습니다 (전쟁 중 : WEB-INF \ classes \ wsDefinition \ car). 서블릿에서 줄을 제거하면 액세스 가능한 wsdl이 생성되지만이 wsdl에서 SoapUI 프로젝트 기반을 만들려면 SopaUI에 오류가 표시됩니다 : 찾을 수 없습니다 property.xsd.

답변

3

Commons XMLSchema 프로젝트의 jar 파일을 WEB-INF/lib 디렉토리에 포함시켜야합니다. 누군가가 여기에 토지 경우

+0

Upps이 라이브러리에이 종속성을 추가하면 beny23 감사합니다. 내 바보 같은 질문 이었어. 아마도이 오류가 발생했을 때 너무 늦었을 것입니다. – Ziletka

3

는 ..., 당신의 pom.xml

<dependency> 
    <groupId>org.apache.ws.xmlschema</groupId> 
    <artifactId>xmlschema-core</artifactId> 
    <version>2.0.1</version> 
</dependency>