G'day,
I've done a lot of reading on this topic, tried a lot of the suggested
strategies, but I have yet to find a suitable solution. I am using Axis
to generate client-side stubs from WSDL provided to us from another
party. The resulting request messages when connecting to the target web
service (not Axis-based) contain xsi:type attributes that are preventing
that service from validating the message. I'm using Axis 1.2.1.
Any advice would be appreciated.
cheers
Mark
The (edited) message that is produced is
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Request xmlns="http://blah/foo/WebService">
<Header>
<ns1:Environment
xmlns:ns1="http://blah/foo">DEV</ns1:Environment>
<ns2:System xmlns:ns2="http://blah/foo">BLAH</ns2:System>
<ns3:SystemVersion xsi:type="xsd:int"
xmlns:ns3="http://blah/foo">1</ns3:SystemVersion>
<ns4:Service
xmlns:ns4="http://blah/foo">WEBSERVICE</ns4:Service>
<ns5:ServiceVersion xsi:type="xsd:int"
xmlns:ns5="http://blah/foo">1</ns5:ServiceVersion>
<ns6:CountryCode
xmlns:ns6="http://blah/foo">AU</ns6:CountryCode>
<ns7:Trace xsi:type="xsd:int"
xmlns:ns7="http://blah/foo">0</ns7:Trace>
<ns8:DealerCode xmlns:ns8="http://blah/foo"></ns8:DealerCode>
<ns9:SSO-ID xmlns:ns9="http://blah/foo">ABC123</ns9:SSO-ID>
</Header>
</Request>
</soapenv:Body>
</soapenv:Envelope>
The (edited) WSDL/XSD for this service is
<?xml version="1.0" encoding="UTF-8" ?><definitions name="WSDLDef"
targetNamespace="http://blah/foo/WebService"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://blah/foo"
xmlns:ns2="http://blah/foo" xmlns:ns3="http://blah/foo/WebService"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://blah/foo/WebService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://blah/foo/WebService"
schemaLocation="WebServiceRequest.xsd"></xsd:import>
</xsd:schema>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://blah/foo/WebService"
schemaLocation="WebServiceResponse.xsd"></xsd:import>
</xsd:schema>
</types>
<message name="WebServiceRequest">
<part element="tns:Request" name="Next_Request"></part>
</message>
<message name="WebServiceResponse">
<part element="tns:Response" name="Next_Response"></part>
</message>
<portType name="WebServicePortType">
<operation name="WebService">
<input message="tns:WebServiceRequest"></input>
<output message="tns:WebServiceResponse"></output>
</operation>
</portType>
<binding name="WebServiceBinding" type="tns:WebServicePortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
<operation name="WebService">
<soap:operation soapAction="WebService"></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="WebService">
<port binding="tns:WebServiceBinding" name="WebServicePort">
<soap:address
location="http://localhost:8080/mediator/services/WebService"></soap:address>
</port>
</service>
</definitions>
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://blah/foo/WebService"
xmlns="http://blah/foo/WebService" xmlns:ns1="http://blah/foo"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://blah/foo"
schemaLocation="RequestHeader.xsd"></xs:import>
<xs:element name="Request">
<xs:complexType>
<xs:sequence>
<xs:element name="Header" type="ns1:Header"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://blah/foo"
xmlns="http://blah/foo" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Header">
<xs:sequence>
<xs:element name="Environment">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4"></xs:maxLength>
<xs:minLength value="2"></xs:minLength>
<xs:enumeration value="DEVL"></xs:enumeration>
<xs:enumeration value="QA"></xs:enumeration>
<xs:enumeration value="PROD"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="System">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="15"></xs:maxLength>
<xs:minLength value="3"></xs:minLength>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SystemVersion">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"></xs:minInclusive>
<xs:maxInclusive value="999"></xs:maxInclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Service">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"></xs:maxLength>
<xs:minLength value="3"></xs:minLength>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ServiceVersion">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"></xs:minInclusive>
<xs:maxInclusive value="999"></xs:maxInclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CountryCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="2"></xs:length>
<xs:enumeration value="AU"></xs:enumeration>
<xs:enumeration value="NZ"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Trace">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:minInclusive value="0"></xs:minInclusive>
<xs:maxInclusive value="9"></xs:maxInclusive>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DealerCode">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="5"></xs:minLength>
<xs:maxLength value="8"></xs:maxLength>
<xs:pattern value="([A-Z0-9])*"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SSO-ID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="6"></xs:minLength>
<xs:maxLength value="8"></xs:maxLength>
<xs:pattern value="([A-Z0-9])*"></xs:pattern>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>