axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anne Thomas Manes" <atma...@gmail.com>
Subject Re: document/literal multiParts outMessage
Date Mon, 24 Jul 2006 13:22:15 GMT
When using document style, the message part must reference an element
rather than a type. (Axis is lax on this rule, which is why it works,
but don't expect interoperability to work.) Also, the message may have
at most one body part. (i.e., the <soap:Body> element may have only
one child element). Therefore your response message is not valid. Axis
ignores the second element.

When using document style, you must define your element structures
using XML Schema in the <wsdl:types> section. e.g.,

<wsdl:definitions
targetNamespace="urn:example.com:docliteral"
xmlns:tns="urn:example.com:docliteral"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<wsdl:types>
  <xsd:schema targetNamespace="urn:example.com:docliteral">
  <xsd:element name="in">
     <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="in1" type="xsd:string"/>
        </xsd:sequence>
     </xsd:complexType>
   </xsd:element/>
  <xsd:element name="out">
     <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="out1" type="xsd:string"/>
          <xsd:element name="out2" type="xsd:string"/>
        </xsd:sequence>
     </xsd:complexType>
   </xsd:element/>
  </xsd:schema>
</wsdl:types>
<wsdl:message name="in">
  <wsdl:part name="body" element="tns:in"/>
</wsdl:message>
<wsdl:message name="out">
  <wsdl:part name="body" element="tns:out"/>
</wsdl:message>

If you want to use document/literal but still want a programming model
that simulates the RPC style (so that you can still invoke the method
using parameters rather than using a wrapped object), then use the
"wrapped style.

See http://atmanes.blogspot.com/2005/03/wrapped-documentliteral-convention.html.

Anne

On 7/24/06, Charles Souillard <Charles.Souillard@ext.bull.net> wrote:
> Hi all,
>
> this is a general question about the Axis (1.4) use.
>
> I am trying to execute an example with a simple message as input with
> only one part :
> <message name="in">
>   <part name="in1" type="xsd:string"/>
> </message>
>
> I have a more complex output message having two parts :
> <message name="out">
>   <part name="out1" type="xsd:string"/>
>   <part name="out2" type="xsd:string"/>
> </message>
>
> I am using the document style and the literal use for this operation.
> When I catch the returned SOAP-enveloppe, I can see the following :
> <soapenv:Body>
>   <out1 xmlns="">out1</out1>
>   <out2 xmlns="">out2</out2>
> </soapenv:Body>
>
> Thanks to the WSDL and SOAP specifications, I suppose this SOAP body is
> correct. I can read the following sentence in the WSDL spec (3.5
> soap:body) :
> */If the operation style is document there are no additional wrappers,
> and the message parts appear directly under the SOAP Body element.
> /*
> After the call, the Axis Stub is trying to set the value of both out1
> and out2 StringHolder. This is done by taking the value in a Map called
> _output.
> try {
>   out1.value = (java.lang.String) _output.get(new
> javax.xml.namespace.QName("", "out1"));
> } catch (java.lang.Exception _exception) {
>   out1.value = (java.lang.String)
> org.apache.axis.utils.JavaUtils.convert(_output.get(new
> javax.xml.namespace.QName("", "out1")), java.lang.String.class);
> }
> try {
>   out2.value = (java.lang.String) _output.get(new
> javax.xml.namespace.QName("", "out2"));
> } catch (java.lang.Exception _exception) {
>   out2.value = (java.lang.String)
> org.apache.axis.utils.JavaUtils.convert(_output.get(new
> javax.xml.namespace.QName("", "out2")), java.lang.String.class);
> }
>
> The problem is that this map only contains information about out1. I had
> a look at the Axis code and it seems only the first SOAP Body child is
> analysed.
>
> Can you tell me how this is running ?
> Is it a bug or a bad use on my side ?
> Thanks a lots for your answer.
>
> Regards,
> Charles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message