You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "jer ." <je...@hotmail.com> on 2004/04/11 14:03:26 UTC

Re: Requestparameters

Hi !

Since your answer gave me a hint on what to look for I have read up on this 
and concluded
that the WSDL description says this is a type "document" service ( not "rcp" 
) and it says "literal" below also. This would explain the difference in 
syntax needed for my requestst.

Thanks for pushing me in the right direction :-)

Here is the parts of the WSDL that will clear up your questions I guess...

<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:s="http://www.w3.org/2001/XMLSchema"
             xmlns:s0="http://www.yaddayadday.com/webservices/customer"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
             
targetNamespace="http://www.yaddayadday.com/webservices/customer"
             xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <s:schema elementFormDefault="qualified"
              
targetNamespace="http://www.yaddayadday.com/webservices/customer">

.....
.......
.....

  <binding name="customerSoap" type="s0:customerSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
style="document" />
    <operation name="RequestProductList">
      <soap:operation 
soapAction="http://www.yaddayadday.com/webservices/customer/RequestProductList" 
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>

....
...
...

Thanks, again.

/Jer




----Original Message Follows----
From: "Scott Nichol" <sn...@scottnichol.com>
Reply-To: soap-user@ws.apache.org
To: <so...@ws.apache.org>
Subject: Re: Requestparameters
Date: Fri, 9 Apr 2004 22:16:42 -0400

Anne,

Thanks for the correction.

Section 3.5 of WSDL 1.1 (http://www.w3.org/TR/wsdl.html#_soap:body) 
specifies "reader makes right" versus "writer makes right" for certain 
scenarios.  Given, as you have pointed out, that rpc requires the wrapper 
that will not be specified in the schema even when concrete types are forced 
(using literal), I do not see how the service described below can require a 
particular namespacing of the parameters (writer makes right) unless the 
operation binding is doc/lit.  What am I missing?

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.

----- Original Message -----
From: "Anne Thomas Manes" <an...@manes.net>
To: <so...@ws.apache.org>
Sent: Friday, April 09, 2004 2:31 PM
Subject: Re: Requestparameters


Actually, the elementFormDefault attribute doesn't apply to RPC-style 
messages, because you don't have a schema that defines either the wrapper 
element (the method name) or the parameter elements. These elements are 
automatically generated by the SOAP runtime. The SOAP 1.1 specification 
doesn't specify what namespace the parameter elements should belong to.

Per the WS-I Basic Profile (which defines RPC/Literal, but not RPC/Encoded), 
the parameter elements should be in no namespace. See:

http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a.html#refinement35268960


5.6.20 Namespace for Part Accessors
For rpc-literal SOAP messages, WSDL 1.1 is not clear what namespace, if any, 
the accessor elements for parameters and return value are a part of. 
Different implementations make different choices, leading to 
interoperability problems.

R2735 A MESSAGE described with an rpc-literal binding MUST place the part 
accessor elements for parameters and return value in no namespace.

Settling on one alternative is crucial to achieving interoperability. The 
Profile places the part accessor elements in no namespace as doing so is 
simple, covers all cases, and does not lead to logical inconsistency.


At 02:16 PM 4/9/2004, you wrote:

   This is an aspect of XML that was poorly defined until the XML Schema 
spec.  That spec defines an attribute named 'elementFormDefault', which can 
have values 'qualified' and 'unqualified'.  With a value of 'unqualified', 
the XML looks like the Apache SOAP payload you show below.  That the MS SOAP 
service you are working with wants namespaces for each element implies that 
the WSDL for the service contains a schema that specifies the 'qualified' 
form.  (Note: elementFormDefault is commonly used to set global behavior, 
i.e. behavior for all complexTypes in a schema.  I think there is also an 
elementForm attribute that affects behavior for a single complexType.)

   In the current nightly build of Apache SOAP, the SOAPContext class has a 
method

        public void setQualifyElements(boolean qualifyElements)

   that allows you to specify whether elements should be qualified.  If you 
use that code base and call this method with a parameter of true, you should 
be the behavior you desire.

       ...
       call.setSOAPMappingRegistry(Smr);
       call.getContext().setQualifyElements(true);
       ...

   Scott Nichol

   Do not send e-mail directly to this e-mail address,
   because it is filtered to accept only mail from
   specific mail lists.
   ----- Original Message -----
   From: "jer ." <je...@hotmail.com>
   To: <so...@ws.apache.org>
   Sent: Friday, April 09, 2004 1:19 PM
   Subject: Requestparameters


   Hello !

   Could someone please explain to me the following ? Please !!!

   All the request examples from Apache SOAP use different namespaces for 
the
   first subelement
   to the SOAP body and the parameter elements.

   My SOAP request sent to a MS SOAP server failes due to the fact that SOAP
   parameters having another
   namespace then the first SOAPbody subelement. Renaming the parameters 
with
   the prefix "ns1:"
   makes the requests work so I know thats where the problem is.

   According to the sample requests on the w3c forum
   ( see. http://www.w3.org/TR/2003/REC-soap12-part0-20030624/#L1165 ) the 
same
   namespace is used
   for all SOAP parameter elements in the same body subelement so from my 
point
   of view it looks
   like Apache SOAP is making non standard requests !?!??

   I have even seen some samples of requests from Axis that shows the same
   behavior ?!?

   See below how the "Login" element doesn't use the qualified name
   "ns1:Login"....

   My request from Apache SOAP
   ---------------------------

   POST http://www.yaddayadday.com/webservices/customer/customer.asmx 
HTTP/1.0
   Host: www.yaddayadday.com:80
   Content-Type: text/xml; charset=utf-8
   Content-Length: 554
   SOAPAction:
   "http://www.yaddayadday.com/webservices/customer/RequestProductList"

   <?xml version='1.0' encoding='UTF-8'?>
   <SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <SOAP-ENV:Body>
       <ns1:RequestProductList
   xmlns:ns1="http://www.yaddayadday.com/webservices/customer"
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <Login xsi:type="xsd:string">USERID</Login>
          <Password xsi:type="xsd:string">PASSWORD</Password>
       </ns1:RequestProductList>
   </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>


   What it should look like ( According to the MS server and me...)
   -----------------------------------------------------------------

   POST http://www.yaddayadday.com/webservices/customer/customer.asmx 
HTTP/1.0
   Host: www.yaddayadday.com:80
   Content-Type: text/xml; charset=utf-8
   Content-Length: 554
   SOAPAction:
   "http://www.yaddayadday.com/webservices/customer/RequestProductList"

   <?xml version='1.0' encoding='UTF-8'?>
   <SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <SOAP-ENV:Body>
       <ns1:RequestProductList
   xmlns:ns1="http://www.yaddayadday.com/webservices/customer"
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <ns1:Login xsi:type="xsd:string">USERID</ns1:Login>
          <ns1:Password xsi:type="xsd:string">PASSWORD</ns1:Password>
       </ns1:RequestProductList>
   </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>


   Below is my code ( that looks like all the samples I found around).
   -------------------------------------------------------------------

   URL url = new
   URL("http://www.yaddayadday.com/webservices/customer/customer.asmx");

   Call call = new Call();
   call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
   
call.setTargetObjectURI("http://www.yaddayadday.com/webservices/customer");
   call.setMethodName("RequestProductList");
   call.setSOAPMappingRegistry(Smr);

   Vector params = new Vector();

   params.add(new Parameter("Login",String.class,"USERID",null) );
   params.add(new Parameter("Password",String.class,"PASSWORD",null) );

   call.setParams(params);

   resp =
   
call.invoke(url,"http://www.yaddayadday.com/webservices/customer/RequestProductList");


   Conclusion
   ----------

   So my question is if Apache SOAP is using a non standard implementation 
or
   if I am doing something wrong
   in my code/assumption. Anyone know how to solve this without rewriting 
the
   SOAP Apache implementation or the service ?

   /Thanks, Jer

   _________________________________________________________________
   Auktioner: Tjäna en hacka på gamla prylar http://tradera.msn.se
~~~~~~~~~~~~~~~~~~
Anne Thomas Manes
VP & Research Director
Burton Group

_________________________________________________________________
Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/