You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Charles Souillard <Ch...@ext.bull.net> on 2006/07/24 14:14:31 UTC

document/literal multiParts outMessage

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


Re: document/literal multiParts outMessage

Posted by Charles Souillard <Ch...@ext.bull.net>.
Thanks for this answer.
Can you explain me why in the document style I must have only one part ?
I have never seen any rule about that in specifications... Can you tell 
me where I can find it please ?
In SOAP 1.1 spec, I can see that a body could have many children (4.3 
SOAP Body) :
/*All immediate child elements of the Body element are called body 
entries and each body entry is encoded as an independent element within 
the SOAP Body element.*/
In wsdl 1, I can read (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.
The optional **parts attribute of type nmtokens indicates which parts 
appear somewhere within the SOAP Body portion of the message (other 
parts of a message may appear in other portions of the message such as 
when SOAP is used in conjunction with the multipart/related MIME 
binding). If the parts attribute is omitted, then all parts defined by 
the message are assumed to be included in the SOAP Body portion.*/
/*If use is literal, then each part references a concrete schema 
definition using either the **element or **type attribute. In the first 
case, the element referenced by the part will appear directly under the 
Body element (for document style bindings) or under an accessor element 
named after the message part (in rpc style). In the second, the type 
referenced by the part becomes the schema type of the enclosing element 
(Body for document style or part accessor element for rpc style).

*/Thanks for your explanations.
Regards,
Charles



Anne Thomas Manes wrote:
> 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 <Ch...@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


Re: document/literal multiParts outMessage

Posted by Anne Thomas Manes <at...@gmail.com>.
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 <Ch...@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