I'm trying to compose a valid doc/literal WSDL but I'm having trouble.
If I use:
<wsdl:part name="phone" type="listing3:Phone"/>
this works and I can generate stubs and bindings but SOAPScope and
other tools clue me that this violates WS-I Basic Profile:
Missing "element" attribute - Wsdl:part phone does not have an "element"
attribute defined and is referred to by a "document" style soap:body.
So, if I change this to:
<wsdl:part name="phone" element="listing3:Phone"/>
then I get an error with wsdl2java:
WSDL processing error for AddressBook.wsdl : Element {urn:listing3}Phone
is referenced but not defined.
So I guess my question is what is the correct way to import this type
from another schema file and still satisfy the WS-I requirements? This
is just a basic example, my "real" problem involves creating a WSDL
for an existing set of complex schemas.
I've attached my WSDL and my XSD.
I'll be the first to admit any ignorance and/or misunderstand of the
concepts here -- but I'd really appreciate some help :-)
<?xml version="1.0" ?>
<wsdl:definitions targetNamespace="urn:listing2" xmlns:tns="urn:listing2"
xmlns:listing3="urn:listing3" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema targetNamespace="urn:listing2"
xmlns:listing3="urn:listing3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="urn:listing3" schemaLocation="listing3.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetPhoneRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="GetPhoneResponse">
<wsdl:part name="phone" element="listing3:Phone"/>
</wsdl:message>
<wsdl:portType name="AddressBook">
<wsdl:operation name="getPhone">
<wsdl:input message="tns:GetPhoneRequest"/>
<wsdl:output message="tns:GetPhoneResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AddressBookBinding" type="tns:AddressBook">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getPhone">
<soap:operation soapAction="getPhone"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AddressBookService">
<wsdl:port binding="tns:AddressBookBinding" name="AddressBookPort">
<soap:address
location="http://localhost:8000/axis/services/AddressBook"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions><?xml version="1.0" ?>
<xsd:schema targetNamespace="urn:listing3"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.w3.org/2001/XMLSchema"/>
<xsd:complexType name="Phone">
<xsd:sequence>
<xsd:element name="areaCode" type="xsd:int"/>
<xsd:element name="exchange" type="xsd:int"/>
<xsd:element name="number" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>