You have an error in the WSDL, therefore neither message is correct.
Since you haven't specified a style attribute, it defaults to document style. When using document style, your message body part must reference an element definition rather than a type definition. Axis deals with this error by automatically creating a wrapper element with the name you specified for the message part (<notification4>). xmlspy deals with it by just including the child elements of the type. Neither is approved behavior.
Your choices:
- Specify RPC style. If you take this option, you must also add namespace attributes to your <soap:body> definitions.
- Stick with Document style. If you take this option, then you must define an element in your schema that is of type "listeCRsType", and reference this element from your "notification4" message part.
On 6/7/06, Olivier Mocquais RD-BIZZ <[EMAIL PROTECTED]> wrote:
Hi,
I use Axis 1.2.1 with Jonas 4.6.6 and I have written a wsdl which
describe an operation which receives in parameters a complex type and a
binary file in attachment (with Multipart/*).
In the type definitions of the wsdl, I have defined this complexType:
<xsd:complexType name="listeCRsType">
<xsd:sequence>
<xsd:element name="crs" type="xsd:string"/>
<xsd:element name="idPJ" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
In the operation section of the wsdl:
<wsdl:operation name="testPastel4">
<wsdl:input message="tns:testPastel4Request"/>
<wsdl:output message="tns:testPastel4Response"/>
</wsdl:operation>
In the message section of the wsdl:
<wsdl:message name="testPastel4Request">
<wsdl:part name="notification4" type="tns:listeCRsType"/>
<wsdl:part name="photoAttachment4" type="xsd:hexBinary"/>
</wsdl:message>
<wsdl:message name="testPastel4Response">
<wsdl:part name="clientidrep14" type="xsd:string"/>
<wsdl:part name="clientidrep24" type="xsd:string"/>
</wsdl:message>
In the binding part of the wsdl file:
<wsdl:operation name="testPastel4">
<soap:operation
soapAction=" http://www.example.org/bot/testPastel"/>
<wsdl:input>
<mime:multipartRelated>
<mime:part>
<soap:body parts="notification4" use="literal"/>
</mime:part>
<mime:part>
<mime:content part="photoAttachment4" type="multipart/*"/>
</mime:part>
</mime:multipartRelated>
</wsdl:input>
<wsdl:output>
<soap:body parts="clientidrep14 clientidrep24" use="literal"/>
</wsdl:output>
</wsdl:operation>
I have written an implementation of the web service and I have used Axis
client (version 1.2.1) to call it.
Inside the wsdd file:
<operation name="testPastel4" qname="testPastel4"
soapAction="http://www.example.org/bot/testPastel" >
<parameter qname="notification4" type="ptns:listeCRsType"
xmlns:ptns=" http://www.example.org/bot/"/>
<parameter qname="photoAttachment4" type="ptns:Multipart"
xmlns:ptns=" http://xml.apache.org/xml-soap"/>
<parameter qname="clientidrep14" type="ptns:string"
xmlns:ptns="http://www.w3.org/2001/XMLSchema " mode="OUT"/>
<parameter qname="clientidrep24" type="ptns:string"
xmlns:ptns="http://www.w3.org/2001/XMLSchema " mode="OUT"/>
</operation>
But I have an exception:
<faultstring>org.xml.sax.SAXException: Invalid element in
com.ws.ListeCRsType - notification4</faultstring>
<detail>
<ns1:stackTrace
xmlns:ns1="http://xml.apache.org/axis/">org.xml.sax.SAXException:
Invalid element in com.ws.ListeCRsType - notification4
at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:258)
at
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
<?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>
<testPastel4 xmlns="">
<notification4>
<crs>crs1</crs>
<idPJ>idpj1</idPJ>
</notification4>
<photoAttachment4 href=""> </testPastel4>
</soapenv:Body>
</soapenv:Envelope>
I have used the XML Spy SOAP client which has generated a sample soap
message and sent it to the web service, and it works:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<crs>crs1</crs>
<idPJ>idpj1</idPJ>
<photoAttachment4 href=""> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The difference between the 2 messages is that Axis adds an
"notification4" element corresponding to the name of the first part.
1/ Which soapmessage is correct ? Which implementatio is correct ?
2/ Have you any information about this subject ?
3/ If the input message of the operation has 2 parts, why Axis adds an
element with the name of the part and encapsulates datas ?
Thanks for your help.
Olivier
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
