PDA

View Full Version : WSDL syntax; importing schema; complex type referencing.


dave_mwi
09-01-2006, 02:47 PM
Ok, I attempted some time ago to conquer this particular part of WSDL coding, but I failed. I'm giving it another go. I've just been successful at putting a complex type in my <types> section of my wsdl and referring to that complex type from the <message> part of my wsdl. Now, I would like to put those types into a schema that I import within the <import> tag. Unfortunately, I'm completely baffled and no amount of searching the internet is helping me. I already had to alter the schema syntax of my complex types to get them into the wsdl from an external xsd file and I'm lost at how to structure the the external file, namespaces, etc. If anyone can help I'd much appreciate it. Here is my WSDL with sensitive parts changed to applicablenameABC:

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="mysserviceABC"
targetNamespace="http://ws.domainABC.com/wsdl/mysserviceABC.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://ws.domainABC.com/wsdl/mysserviceABC.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOD="http://ws.domainABC.com/schema">


<types>
<xsd:schema targetNamespace="http://ws.domainABC.com/schema" xmlns="http://www.w3.org/2001/XMLSchema">

<!-- privatepartABC_note_response complexType -->
<xsd:complexType name="privatepartABC_note_response">
<xsd:sequence>
<xsd:element name="privatepartABC_notes" type="SOD:privatepartABC_notes" minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

<!-- privatepartABC_notes complexType-->
<xsd:complexType name="privatepartABC_notes">
<xsd:sequence>
<xsd:element name="privatepartABC_note" type="SOD:privatepartABC_note" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>

<!-- privatepartABC_note element-->
<xsd:complexType name="privatepartABC_note">
<xsd:sequence>
<xsd:element name="subject" type="xsd:string" minOccurs="1"/>
<xsd:element name="body" type="xsd:string" minOccurs="1"/>
<xsd:element name="timestamp" type="xsd:string" minOccurs="1"/>
<xsd:element name="name" type="xsd:string" minOccurs="1"/>
<xsd:element name="group" type="xsd:string" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>
</types>

<!-- Start privatepartABC_notes_retrieve message-->
<message name="privatepartABC_notes_retrieve">
<part name="username" type="xsd:string"/>
<part name="password" type="xsd:string"/>
<part name="version" type="xsd:string"/>
<part name="privatepartABCid" type="xsd:string"/>
<part name="since_timestamp" type="xsd:string"/>
</message>
<message name="privatepartABC_notes_retrieveResponse">
<part name="responseCode" type="xsd:string"/>
<part name="responseId" type="xsd:int"/>
<part name="responseString" type="xsd:string"/>
<part name="responseData" type="SOD:privatepartABC_note_response"/>
</message>

<!-- Port for domainABC Web APIs, "mysserviceABC" -->
<portType name="mysserviceABCPort">
<operation name="privatepartABC_notes_retrieve">
<input message="tns:privatepartABC_notes_retrieve"/>
<output message="tns:privatepartABC_notes_retrieveResponse"/>
</operation>
</portType>

<!-- Binding for domainABC Web APIs - RPC, SOAP over HTTP -->
<binding name="mysserviceABCBinding" type="tns:mysserviceABCPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="privatepartABC_notes_retrieve">
<soap:operation style="rpc" soapAction="urn:mysserviceABCAction"/>
<input>
<soap:body use="encoded" namespace="urn:mysserviceABC" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:mysserviceABC" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>

<!-- Endpoint for domainABC Web APIs -->
<service name="mysserviceABCService">
<port name="mysserviceABCPort" binding="tns:mysserviceABCBinding">
<soap:address location="https://me.domainABC.com/ws/"/>
</port>
</service>

</definitions>

so I'd like to move the schema info in the <types> block outside to an external xsd file. Then I'd like the line:

<part name="responseData" type="SOD:privatepartABC_note_response"/>

to point to that exeternal definition instead of the inline types definition section. The idea is that the types section is going to be very large and I really don't want to bloat this WSDL file with all the types. Thanks again for any help anyone can give. This is proving to be quite challenging. If any of you have any good (understandable) links online to WSDL structure, etc, please drop those as well. Thanks.