You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Daryoush Mehrtash <dm...@bea.com> on 2005/04/21 23:20:36 UTC

what is the correct namespaces in case of qualified RPC/Literal web services?

I am trying to find out the what is the "correct" response message in
case of RPC/Literal web service with elementFromDefault="qualified" in
the WSDL schema.  I appreciate your input on this.

 

The issue is with the result element of the response message.  This is
an example of the soap message that axis returns from a call to a
"qualified" RPC/literal service:

 

 

<?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>

                        <createAddressResponse xmlns="">

 
<ReturnCreateAddressResult>0</ReturnCreateAddressResult>

                                    <out_param_body>

                                                <ns1:city
xmlns:ns1="http://beehive.apache.org/web/webservice/rpc-examples">Kirkla
nd</ns1:city>

                                                <ns2:phoneNumber
xmlns:ns2="http://beehive.apache.org/web/webservice/rpc-examples">

 
<ns2:areaCode>425</ns2:areaCode>

 
<ns2:exchange>555</ns2:exchange>

 
<ns2:number>1234</ns2:number>

                                                </ns2:phoneNumber>

                                                <ns3:state
xmlns:ns3="http://beehive.apache.org/web/webservice/rpc-examples">

 
<ns3:state>WA</ns3:state>

                                                </ns3:state>

                                                <ns4:streetName
xmlns:ns4="http://beehive.apache.org/web/webservice/rpc-examples">NE
Points Drive</ns4:streetName>

                                                <ns5:streetNum
xmlns:ns5="http://beehive.apache.org/web/webservice/rpc-examples">9999</
ns5:streetNum>

                                                <ns6:zip
xmlns:ns6="http://beehive.apache.org/web/webservice/rpc-examples">98008<
/ns6:zip>

                                    </out_param_body>

                        </createAddressResponse>

            </soapenv:Body>

</soapenv:Envelope>

 

 

The question is, given that the schema specifies "qualified" should the
ReturnCreateAddressResult  (shown in bold below) include its namespaces
as follows or not?

 

 

<?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>

                        <createAddressResponse xmlns="">

                                    <ns1:ReturnCreateAddressResult
xmlns:ns1="http://beehive.apache.org/web/webservice/rpc-examples">0</ns1
:ReturnCreateAddressResult>

                                    <ns2:out_param_body
xmlns:ns2="http://beehive.apache.org/web/webservice/rpc-examples">

 
<ns2:city>Kirkland</ns2:city>

                                                <ns2:phoneNumber>

 
<ns2:areaCode>425</ns2:areaCode>

 
<ns2:exchange>555</ns2:exchange>

 
<ns2:number>1234</ns2:number>

                                                </ns2:phoneNumber>

                                                <ns2:state>

 
<ns2:state>WA</ns2:state>

                                                </ns2:state>

                                                <ns2:streetName>NE
Points Drive</ns2:streetName>

 
<ns2:streetNum>10230</ns2:streetNum>

                                                <ns2:zip>98008</ns2:zip>

                                    </ns2:out_param_body>

                        </createAddressResponse>

            </soapenv:Body>

</soapenv:Envelope>

 

 

Any ideas on which one is the correct/desirable response?

 

Thanks

 

Daryoush Mehrtash


Re: what is the correct namespaces in case of qualified RPC/Literal web services?

Posted by Anne Thomas Manes <at...@gmail.com>.
Daryoush,

The <ReturnCreateAddressResult> and <out_param_body> elements should
be unqualified (in no namespace). I can't tell you what namespaces the
child elements of <out_param_body> are supposed to be in without
seeing the schema.

According to the WS-I Basic Profile (which is the only definitive
source of information for RPC/Literal), namespaces follow the
following rules:

The child element of the SOAP body (the autogenerated wrapper element
-- in this case <createAddressResponse>) is in the namespace specified
in the <wsdlsoap:body> definition in the WSDL binding:

  <wsdl:output name="impl:createAddressResponse">
    <wsdlsoap:body use="literal" namespace="some-uri"/>
  </wsdl:output>

Since this element is unqualified in both your examples, I assume that
you neglected to specify a namespace in your WSDL binding. (You
should, though.)

The children of this wrapper element (the autogenerated parameter
elements) are in *no* namespace. These elements aren't defined in the
WSDL -- only their types are defined:

  <wsdl:message name="createAddressResponse">
     <wsdl:part name="ReturnCreateAddressResult" type="xsd:int"/>
     <wsdl:part name="out_param_body" type="ns1:out_param_body"/>
  </wsdl:message>

The children of <out_param_body> will be in the namespace(s) as
defined by the schema that defines the out_param_body type (ns1). If
you specified elementFormDefault="qualified",  and you define all the
children within that namespace, then the children of <out_param_body>
will be in the ns1 namespace. But, if the children are defined in
separate schemas, then they will be in different namespaces.

For example, if the schema looks something like this:

   <xsd:complexType name="out_param_body">
      <xsd:sequence>
          <xsd:element ref="ns1:city"/>
          <xsd:element ref="ns2:phoneNumber"/>
          <xsd:element ref="ns3:state"/>
          ...
      </xsd:sequence>
   </xsd:complexType>

then each child element will be in the appropriately referenced namespace.

Anne

On 4/21/05, Daryoush Mehrtash <dm...@bea.com> wrote:
>  
>  
> 
> I am trying to find out the what is the "correct" response message in case
> of RPC/Literal web service with elementFromDefault="qualified" in the WSDL
> schema.  I appreciate your input on this. 
> 
>   
> 
> The issue is with the result element of the response message.  This is an
> example of the soap message that axis returns from a call to a "qualified"
> RPC/literal service: 
> 
>   
> 
>   
> 
> <?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> 
> 
>                         <createAddressResponse xmlns=""> 
> 
>                                    
> <ReturnCreateAddressResult>0</ReturnCreateAddressResult> 
> 
>                                     <out_param_body> 
> 
>                                                 <ns1:city
> xmlns:ns1="http://beehive.apache.org/web/webservice/rpc-examples">Kirkland</ns1:city>
> 
>                                                
> <ns2:phoneNumber
> xmlns:ns2="http://beehive.apache.org/web/webservice/rpc-examples">
> 
>                                                            
> <ns2:areaCode>425</ns2:areaCode> 
> 
>                                                            
> <ns2:exchange>555</ns2:exchange> 
> 
>                                                            
> <ns2:number>1234</ns2:number> 
> 
>                                                
> </ns2:phoneNumber> 
> 
>                                                 <ns3:state
> xmlns:ns3="http://beehive.apache.org/web/webservice/rpc-examples">
> 
>                                                            
> <ns3:state>WA</ns3:state> 
> 
>                                                
> </ns3:state> 
> 
>                                                
> <ns4:streetName
> xmlns:ns4="http://beehive.apache.org/web/webservice/rpc-examples">NE
> Points Drive</ns4:streetName> 
> 
>                                                
> <ns5:streetNum
> xmlns:ns5="http://beehive.apache.org/web/webservice/rpc-examples">9999</ns5:streetNum>
> 
>                                                 <ns6:zip
> xmlns:ns6="http://beehive.apache.org/web/webservice/rpc-examples">98008</ns6:zip>
> 
>                                     </out_param_body> 
> 
>                         </createAddressResponse> 
> 
>             </soapenv:Body> 
> 
> </soapenv:Envelope> 
> 
>   
> 
>   
> 
> The question is, given that the schema specifies "qualified" should the
> ReturnCreateAddressResult  (shown in bold below) include its namespaces as
> follows or not? 
> 
>   
> 
>   
> 
> <?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> 
> 
>                         <createAddressResponse xmlns=""> 
> 
>                                    
> <ns1:ReturnCreateAddressResult
> xmlns:ns1="http://beehive.apache.org/web/webservice/rpc-examples">0</ns1:ReturnCreateAddressResult>
> 
>                                     <ns2:out_param_body
> xmlns:ns2="http://beehive.apache.org/web/webservice/rpc-examples">
> 
>                                                
> <ns2:city>Kirkland</ns2:city> 
> 
>                                                
> <ns2:phoneNumber> 
> 
>                                                            
> <ns2:areaCode>425</ns2:areaCode> 
> 
>                                                            
> <ns2:exchange>555</ns2:exchange> 
> 
>                                                            
> <ns2:number>1234</ns2:number> 
> 
>                                                
> </ns2:phoneNumber> 
> 
>                                                 <ns2:state>
> 
>                                                            
> <ns2:state>WA</ns2:state> 
> 
>                                                
> </ns2:state> 
> 
>                                                
> <ns2:streetName>NE Points Drive</ns2:streetName> 
> 
>                                                
> <ns2:streetNum>10230</ns2:streetNum> 
> 
>                                                
> <ns2:zip>98008</ns2:zip> 
> 
>                                     </ns2:out_param_body> 
> 
>                         </createAddressResponse> 
> 
>             </soapenv:Body> 
> 
> </soapenv:Envelope> 
> 
>   
> 
>   
> 
> Any ideas on which one is the correct/desirable response? 
> 
>   
> 
> Thanks   
> 
>   
> 
> Daryoush Mehrtash