开发者

Spring ws & multiple schemas

I have spring configuration in my servlet...

<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>

and two XSDs in the same folder - 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:

But after deploying on Glassfish 3, the exception is arisen: Multiple elements requires Commons XMLSchema.Please put Commons XMLSchema on the classpath.

Spring ws doc section 5.3.1: If you want to use multiple schemas, either by includes or imports, you will want to put Commons XMLSchema on the class path. If Commons XMLSchema is on the class path, the above element will follow all XSD imports and includes, and will inline them in the WSDL as a single XSD.

What does "Commons XMLSchema" mean? How can I fix it? Thx.

I have both XSD files on the classpath (in war: WEB-INF\classes\wsDefinition\car). When I remove line from servlet, then is generated wsdl accessible, but when I want create SoapUI project base on this wsdl, the SopaUI shows error: is not possible find properties.xsd.


You'll need to include the jar file for the Commons XMLSchema project in your WEB-INF/lib directory.


If someone lands here... add this dependency to your pom.xml

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜