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 Eric Chijioke <ec...@erisk.com> on 2004/09/03 20:08:18 UTC

document/literal (wrapped) Response - soap body Top level element naming?

I am currently using Axis 1.2 beta to expose my web service. 
I am using the document/literal (wrapped) configuration. 
 
The axis server does something that seems strange, and I'm not sure if
it's intentional or not. This email is not as long as it seems. Thank
you for taking the time to respond. 
 
 
Given this operation (defined in my WSDL):

<operation name="getFactor">

    <input name="getFactorRequest" message="impl:getFactorIn"/>

    <output name="getFactorResponse" message="impl:getFactorOut"/>

</operation>

------------------------------------------------------------------------
--------- 



The corresponding input and output messages are defined a follows:

<message name="getFactorIn">

    <part name="parameters" element="intf:getFactor"/>

</message>

<message name="getFactorOut">

    <part name="parameters" element="intf:getFactorResponse"/>

</message>

------------------------------------------------------------------------
--------- 
 


The corresponding elements are defined as follows:
<element name="getFactor">

    <complexType>

        <sequence>

            <element minOccurs="1" maxOccurs="1" name="id"
type="xsd:string"/>

           </sequence>

    </complexType>

</element>

<element name="getFactorResponse">

    <complexType>

        <sequence>

            <element name="factor" minOccurs="1" maxOccurs="1"
type="intf:Factor"/>

        </sequence>

    </complexType>

</element>
------------------------------------------------------------------------
--------- 


I won't bother providing the schema for the intf:Factor type.
 
Here's the question:
When a client calls the getFactor() method, why does the response always
contain a top level element in the soap body call getFactorReturn
instead of using the name provided in the getFactorResponse element
schema: in this case "factor"? 
 
So the response to this method looks like this (the top level element of
the body tag is <getFactorReturn>):
 
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ">
 <soapenv:Body>
  <getFactorResponse xmlns="http://object.hydra.erisk.com
<http://object.hydra.erisk.com/> ">
   <getFactorReturn>
    <name>My Test Factor</name>
    <id>1</id>
   </getFactorReturn>
  </getFactorResponse>
 </soapenv:Body>
</soapenv:Envelope>

 
I would have expected the response to this method to look like this (the
top level element of the body tag is <factor>):
 
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ">
 <soapenv:Body>
  <getFactorResponse xmlns="http://object.hydra.erisk.com
<http://object.hydra.erisk.com/> ">
   <factor>
    <name>My Test Factor</name>
    <id>1</id>
   </factor>
  </getFactorResponse>
 </soapenv:Body>
</soapenv:Envelope>

 
The reason this is an issue is that when you auto generate code (at
least in .NET) using the WSDL I described above, it assumes (rightly
so?) that the top level element of the response SOAP body will be named
as you name it in your WSDL. 
 
PLease let me know if this is an issue with Axis or if there is a spec
somewhere that requires the top level element to be named
getFactorReturn (in this case).
 
Thank you for taking the time.

Eric Chijioke 
ERisk
echijioke@erisk.com 

RE: document/literal (wrapped) Response - soap body Top level element naming?

Posted by Anne Thomas Manes <an...@manes.net>.
According to your WSDL, the child element of getFactorResponse should be
<factor>, as you expected. 

I suggest you file a bug report.

Anne

-----Original Message-----
From: Eric Chijioke [mailto:echijioke@erisk.com] 
Sent: Friday, September 03, 2004 2:08 PM
To: axis-user@ws.apache.org
Subject: document/literal (wrapped) Response - soap body Top level element
naming?

I am currently using Axis 1.2 beta to expose my web service. 
I am using the document/literal (wrapped) configuration. 
 
The axis server does something that seems strange, and I'm not sure if
it's intentional or not. This email is not as long as it seems. Thank
you for taking the time to respond. 
 
 
Given this operation (defined in my WSDL):

<operation name="getFactor">

    <input name="getFactorRequest" message="impl:getFactorIn"/>

    <output name="getFactorResponse" message="impl:getFactorOut"/>

</operation>

------------------------------------------------------------------------
--------- 



The corresponding input and output messages are defined a follows:

<message name="getFactorIn">

    <part name="parameters" element="intf:getFactor"/>

</message>

<message name="getFactorOut">

    <part name="parameters" element="intf:getFactorResponse"/>

</message>

------------------------------------------------------------------------
--------- 
 


The corresponding elements are defined as follows:
<element name="getFactor">

    <complexType>

        <sequence>

            <element minOccurs="1" maxOccurs="1" name="id"
type="xsd:string"/>

           </sequence>

    </complexType>

</element>

<element name="getFactorResponse">

    <complexType>

        <sequence>

            <element name="factor" minOccurs="1" maxOccurs="1"
type="intf:Factor"/>

        </sequence>

    </complexType>

</element>
------------------------------------------------------------------------
--------- 


I won't bother providing the schema for the intf:Factor type.
 
Here's the question:
When a client calls the getFactor() method, why does the response always
contain a top level element in the soap body call getFactorReturn
instead of using the name provided in the getFactorResponse element
schema: in this case "factor"? 
 
So the response to this method looks like this (the top level element of
the body tag is <getFactorReturn>):
 
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ">
 <soapenv:Body>
  <getFactorResponse xmlns="http://object.hydra.erisk.com
<http://object.hydra.erisk.com/> ">
   <getFactorReturn>
    <name>My Test Factor</name>
    <id>1</id>
   </getFactorReturn>
  </getFactorResponse>
 </soapenv:Body>
</soapenv:Envelope>

 
I would have expected the response to this method to look like this (the
top level element of the body tag is <factor>):
 
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:xsd="http://www.w3.org/2001/XMLSchema
<http://www.w3.org/2001/XMLSchema> "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ">
 <soapenv:Body>
  <getFactorResponse xmlns="http://object.hydra.erisk.com
<http://object.hydra.erisk.com/> ">
   <factor>
    <name>My Test Factor</name>
    <id>1</id>
   </factor>
  </getFactorResponse>
 </soapenv:Body>
</soapenv:Envelope>

 
The reason this is an issue is that when you auto generate code (at
least in .NET) using the WSDL I described above, it assumes (rightly
so?) that the top level element of the response SOAP body will be named
as you name it in your WSDL. 
 
PLease let me know if this is an issue with Axis or if there is a spec
somewhere that requires the top level element to be named
getFactorReturn (in this case).
 
Thank you for taking the time.

Eric Chijioke 
ERisk
echijioke@erisk.com