I've prepared following files (it's extremely simplified to make this article short).
example.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="http://example.com/" name="ExampleService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://example.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema>
<xsd:import namespace="http://example.com/" schemaLocation="schema1.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="com.example" schemaLocation="schema2.xsd"/>
</xsd:schema>
</types>
<message name="create">
<part name="parameters" element="tns:create"/>
</message>
<message name="createResponse">
<part name="parameters" element="tns:createResponse"/>
</message>
<message name="ExampleServiceException">
<part name="fault" element="tns:ExampleServiceException"/>
</message>
<portType name="Interface">
<operation name="create">
<input message="tns:create"/>
<output message="tns:createResponse"/>
<fault message="tns:ExampleServiceException" name="ExampleServiceException"/>
</operation>
</portType>
<binding name="ExampleInterfacePortBinding" type="tns:Interface">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="create">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="ExampleServiceException">
<soap:fault name="ExampleServiceException" use="literal"/>
</fault>
</operation>
</binding>
<service name="ExampleService">
<port name="ExampleInterfacePort" binding="tns:ExampleInterfacePortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
schema1.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://example.com/" xmlns:tns="http://example.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="com.example">
<xs:import namespace="com.example" schemaLocation="schema2.xsd"/>
<xs:element name="ExampleServiceException" type="tns:ExampleServiceException"/>
<xs:element name="create" type="tns:create"/>
<xs:element name="createResponse" type="tns:createResponse"/>
<xs:complexType name="create">
<xs:sequence>
<xs:element name="request" type="ns1:Request" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="createResponse">
<xs:sequence>
<xs:element name="response" type="ns1:Response" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExampleServiceException">
<xs:sequence>
<xs:element name="message" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
schema2.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="com.example" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="com.example">
<xs:import namespace="http://example.com/" schemaLocation="schema1.xsd"/>
<xs:complexType name="Request">
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Response">
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Now, I've created a sample message on Soap UI and online WSDL analyser. The result of create messages are followings;<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exam="http://example.com/">
<soapenv:Header/>
<soapenv:Body>
<exam:create>
<!--Optional:-->
<request>
<!--Optional:-->
<id>?</id>
</request>
</exam:create>
</soapenv:Body>
</soapenv:Envelope>
<ns1:create xmlns:ns1='http://example.com/'>
<!-- optional -->
<request>
<!-- optional -->
<ns2:id xmlns:ns2='com.example'>?XXX?</ns2:id>
</request>
</ns1:create>
The point is that online WSDL analyser's one has namespace com.example and Soap UI one doesn't. Well, from the beginning, I don't understand why both request element doesn't have namespace at all.As far as I know, JAX-WS requires Soap UI format so this is written some where in spec?
No comments:
Post a Comment