You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Daniel Kutac <ku...@intersystems.cz> on 2002/06/11 12:25:48 UTC

Apache SOAP bug?

Hi,

this simple code:

 public static void main( String[] args) {

  try {
    //URL url = new URL(http://localhost/csp/demos/WS.Calc.cls);
    URL url = new URL("http://localhost:8080/csp/demos/WS.Calc.cls");
    String urn = "";

    // Build the call.
    Call call = new Call();


    call.setTargetObjectURI("http://tempuri.org/webservices/WS.Calc.Add");
    call.setMethodName ("Add");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

    Vector params = new Vector ();
    params.addElement (new Parameter("a", Float.class, new Float(1), null));
    params.addElement (new Parameter("b", Float.class, new Float(2), null));
    call.setParams (params);

    // make the call: note that the action URI is empty because the
    // XML-SOAP rpc router does not need this. This may change in the
    // future.
    Response resp = call.invoke (/* router URL */ url, /* actionURI */
urn );

    // Check the response.
    if (resp.generatedFault ()) {
      Fault fault = resp.getFault ();
      System.out.println ("Ouch, the call failed: ");
      System.out.println ("  Fault Code   = " + fault.getFaultCode ());
      System.out.println ("  Fault String = " + fault.getFaultString ());
    } else {
      Parameter result = resp.getReturnValue ();
      System.out.println (result.getValue ());
    }

    } catch (Exception e) {
      e.printStackTrace();
    }

puts <SOAP-ENV:encodingStyle ..> tag into envelope's body.

<?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:Add xmlns:ns1="http://tempuri.org/webservices/WS.Calc.Add"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <a xsi:type="xsd:float">1.0</a>
  <b xsi:type="xsd:float">2.0</b>
  </ns1:Add>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>


Why? Is this a bug or do I miss something?

Thanks a lot for any help



Dan

Re: Apache SOAP bug?

Posted by Scott Nichol <sn...@scottnichol.com>.
Dan,

The dump you should is quite legal.  From SOAP 1.1 section 4.1.1

>>>>
The SOAP encodingStyle global attribute can be used to indicate the
serialization rules used in a SOAP message. This attribute MAY appear on any
element, and is scoped to that element's contents and all child elements not
themselves containing such an attribute, much as an XML namespace declaration is
scoped. There is no default encoding defined for a SOAP message.

<<<<

Your call to "call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);" specified
this encoding style.  Note that SOAP-ENV:encodingStyle is an attribute, not an
element itself.

If this does not answer your question, or if you have other questions, please
don't hestitate to follow up on this mailing list.

Scott Nichol

----- Original Message -----
From: "Daniel Kutac" <ku...@intersystems.cz>
To: "Soap-Dev group" <so...@xml.apache.org>; "Soap-User group"
<so...@xml.apache.org>
Sent: Tuesday, June 11, 2002 6:25 AM
Subject: Apache SOAP bug?


> Hi,
>
> this simple code:
>
>  public static void main( String[] args) {
>
>   try {
>     //URL url = new URL(http://localhost/csp/demos/WS.Calc.cls);
>     URL url = new URL("http://localhost:8080/csp/demos/WS.Calc.cls");
>     String urn = "";
>
>     // Build the call.
>     Call call = new Call();
>
>
>     call.setTargetObjectURI("http://tempuri.org/webservices/WS.Calc.Add");
>     call.setMethodName ("Add");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
>     Vector params = new Vector ();
>     params.addElement (new Parameter("a", Float.class, new Float(1), null));
>     params.addElement (new Parameter("b", Float.class, new Float(2), null));
>     call.setParams (params);
>
>     // make the call: note that the action URI is empty because the
>     // XML-SOAP rpc router does not need this. This may change in the
>     // future.
>     Response resp = call.invoke (/* router URL */ url, /* actionURI */
> urn );
>
>     // Check the response.
>     if (resp.generatedFault ()) {
>       Fault fault = resp.getFault ();
>       System.out.println ("Ouch, the call failed: ");
>       System.out.println ("  Fault Code   = " + fault.getFaultCode ());
>       System.out.println ("  Fault String = " + fault.getFaultString ());
>     } else {
>       Parameter result = resp.getReturnValue ();
>       System.out.println (result.getValue ());
>     }
>
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>
> puts <SOAP-ENV:encodingStyle ..> tag into envelope's body.
>
> <?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:Add xmlns:ns1="http://tempuri.org/webservices/WS.Calc.Add"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <a xsi:type="xsd:float">1.0</a>
>   <b xsi:type="xsd:float">2.0</b>
>   </ns1:Add>
>   </SOAP-ENV:Body>
>   </SOAP-ENV:Envelope>
>
>
> Why? Is this a bug or do I miss something?
>
> Thanks a lot for any help
>
>
>
> Dan
>


Re: Apache SOAP bug?

Posted by Scott Nichol <sn...@scottnichol.com>.
Dan,

The dump you should is quite legal.  From SOAP 1.1 section 4.1.1

>>>>
The SOAP encodingStyle global attribute can be used to indicate the
serialization rules used in a SOAP message. This attribute MAY appear on any
element, and is scoped to that element's contents and all child elements not
themselves containing such an attribute, much as an XML namespace declaration is
scoped. There is no default encoding defined for a SOAP message.

<<<<

Your call to "call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);" specified
this encoding style.  Note that SOAP-ENV:encodingStyle is an attribute, not an
element itself.

If this does not answer your question, or if you have other questions, please
don't hestitate to follow up on this mailing list.

Scott Nichol

----- Original Message -----
From: "Daniel Kutac" <ku...@intersystems.cz>
To: "Soap-Dev group" <so...@xml.apache.org>; "Soap-User group"
<so...@xml.apache.org>
Sent: Tuesday, June 11, 2002 6:25 AM
Subject: Apache SOAP bug?


> Hi,
>
> this simple code:
>
>  public static void main( String[] args) {
>
>   try {
>     //URL url = new URL(http://localhost/csp/demos/WS.Calc.cls);
>     URL url = new URL("http://localhost:8080/csp/demos/WS.Calc.cls");
>     String urn = "";
>
>     // Build the call.
>     Call call = new Call();
>
>
>     call.setTargetObjectURI("http://tempuri.org/webservices/WS.Calc.Add");
>     call.setMethodName ("Add");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
>     Vector params = new Vector ();
>     params.addElement (new Parameter("a", Float.class, new Float(1), null));
>     params.addElement (new Parameter("b", Float.class, new Float(2), null));
>     call.setParams (params);
>
>     // make the call: note that the action URI is empty because the
>     // XML-SOAP rpc router does not need this. This may change in the
>     // future.
>     Response resp = call.invoke (/* router URL */ url, /* actionURI */
> urn );
>
>     // Check the response.
>     if (resp.generatedFault ()) {
>       Fault fault = resp.getFault ();
>       System.out.println ("Ouch, the call failed: ");
>       System.out.println ("  Fault Code   = " + fault.getFaultCode ());
>       System.out.println ("  Fault String = " + fault.getFaultString ());
>     } else {
>       Parameter result = resp.getReturnValue ();
>       System.out.println (result.getValue ());
>     }
>
>     } catch (Exception e) {
>       e.printStackTrace();
>     }
>
> puts <SOAP-ENV:encodingStyle ..> tag into envelope's body.
>
> <?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:Add xmlns:ns1="http://tempuri.org/webservices/WS.Calc.Add"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <a xsi:type="xsd:float">1.0</a>
>   <b xsi:type="xsd:float">2.0</b>
>   </ns1:Add>
>   </SOAP-ENV:Body>
>   </SOAP-ENV:Envelope>
>
>
> Why? Is this a bug or do I miss something?
>
> Thanks a lot for any help
>
>
>
> Dan
>