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 Alen Ribic <al...@fuzzylogic.co.za> on 2002/08/26 10:17:17 UTC

No Serialize found...

Hi All

I am trying to encode the body of my soap envelope with the
NS_URI_LITERAL_XML.
I have a single method in my service class that contains a single argument
of type String[].
I wish to pass a parameter with NS_URI_SOAP_ENC encoding on to this service
method.

I get the following exception:
......................................
Caught SOAPException (SOAP-ENV:Client) No Serialize found to serialize a
'java.
lang.String' using encoding style
'http://xml.apache.org/xml-soap/literalxml'.
......................................

Client code
----------------------------------------------------------------------------
-----------------------------------
         URL url =
           new URL(
     "http://alen:8080/soap/servlet/rpcrouter" );

         Call call = new Call();
         call.setTargetObjectURI("urn:StockPriceService3");
   call.setMethodName("getCurrencyValue");
         call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
         Vector params = new Vector();
         params.addElement(new Parameter("currency",
                          String[].class, (String[])args,
Constants.NS_URI_SOAP_ENC ));
        call.setParams(params);

         try {
           Response resp = call.invoke(url, "");

    if ( resp.generatedFault() ) {
     Fault fault = resp.getFault();
           System.out.println ( "Fault Code = " + fault.getFaultCode() );
           System.out.println ( "Fault String = " +
fault.getFaultString() );
    }
    else
    {
             Parameter ret = resp.getReturnValue();
             Element value = (Element)ret.getValue();
     System.out.println( DOM2Writer.nodeToString(value) );
    }
        } catch (SOAPException e) {
           System.err.println( "Caught SOAPException (" +
                           e.getFaultCode() + ") "  +

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

It appears as if the the above Parameter object is using the bodies encoding
and it just ignores the NS_URI_SOAP_ENC.
If I change my service methods argument to String instead of the String[]
and I modify my client side to pass String parameter the code works fine!

I am using the Apache SOAP 2.2 implementation.

Any suggestions would be good.

Alen Ribic






Re: No Serialize found...

Posted by Scott Nichol <sn...@scottnichol.com>.
You can only serialize org.w3.dom.Element using Apache SOAP's literal XML
encoding.  Note that Apache SOAP's literal XML encoding is *not* the same as
document/literal encoding defined in WSDL that is the default for .NET.

Scott Nichol

----- Original Message -----
From: "Alen Ribic" <al...@fuzzylogic.co.za>
To: "Soap-User@Xml. Apache. Org" <so...@xml.apache.org>
Sent: Monday, August 26, 2002 4:17 AM
Subject: No Serialize found...


Hi All

I am trying to encode the body of my soap envelope with the
NS_URI_LITERAL_XML.
I have a single method in my service class that contains a single argument
of type String[].
I wish to pass a parameter with NS_URI_SOAP_ENC encoding on to this service
method.

I get the following exception:
......................................
Caught SOAPException (SOAP-ENV:Client) No Serialize found to serialize a
'java.
lang.String' using encoding style
'http://xml.apache.org/xml-soap/literalxml'.
......................................

Client code
----------------------------------------------------------------------------
-----------------------------------
         URL url =
           new URL(
     "http://alen:8080/soap/servlet/rpcrouter" );

         Call call = new Call();
         call.setTargetObjectURI("urn:StockPriceService3");
   call.setMethodName("getCurrencyValue");
         call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
         Vector params = new Vector();
         params.addElement(new Parameter("currency",
                          String[].class, (String[])args,
Constants.NS_URI_SOAP_ENC ));
        call.setParams(params);

         try {
           Response resp = call.invoke(url, "");

    if ( resp.generatedFault() ) {
     Fault fault = resp.getFault();
           System.out.println ( "Fault Code = " + fault.getFaultCode() );
           System.out.println ( "Fault String = " +
fault.getFaultString() );
    }
    else
    {
             Parameter ret = resp.getReturnValue();
             Element value = (Element)ret.getValue();
     System.out.println( DOM2Writer.nodeToString(value) );
    }
        } catch (SOAPException e) {
           System.err.println( "Caught SOAPException (" +
                           e.getFaultCode() + ") "  +

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

It appears as if the the above Parameter object is using the bodies encoding
and it just ignores the NS_URI_SOAP_ENC.
If I change my service methods argument to String instead of the String[]
and I modify my client side to pass String parameter the code works fine!

I am using the Apache SOAP 2.2 implementation.

Any suggestions would be good.

Alen Ribic








Re: No Serialize found...

Posted by Scott Nichol <sn...@scottnichol.com>.
You can only serialize org.w3.dom.Element using Apache SOAP's literal XML
encoding.  Note that Apache SOAP's literal XML encoding is *not* the same as
document/literal encoding defined in WSDL that is the default for .NET.

Scott Nichol

----- Original Message -----
From: "Alen Ribic" <al...@fuzzylogic.co.za>
To: "Soap-User@Xml. Apache. Org" <so...@xml.apache.org>
Sent: Monday, August 26, 2002 4:17 AM
Subject: No Serialize found...


Hi All

I am trying to encode the body of my soap envelope with the
NS_URI_LITERAL_XML.
I have a single method in my service class that contains a single argument
of type String[].
I wish to pass a parameter with NS_URI_SOAP_ENC encoding on to this service
method.

I get the following exception:
......................................
Caught SOAPException (SOAP-ENV:Client) No Serialize found to serialize a
'java.
lang.String' using encoding style
'http://xml.apache.org/xml-soap/literalxml'.
......................................

Client code
----------------------------------------------------------------------------
-----------------------------------
         URL url =
           new URL(
     "http://alen:8080/soap/servlet/rpcrouter" );

         Call call = new Call();
         call.setTargetObjectURI("urn:StockPriceService3");
   call.setMethodName("getCurrencyValue");
         call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
         Vector params = new Vector();
         params.addElement(new Parameter("currency",
                          String[].class, (String[])args,
Constants.NS_URI_SOAP_ENC ));
        call.setParams(params);

         try {
           Response resp = call.invoke(url, "");

    if ( resp.generatedFault() ) {
     Fault fault = resp.getFault();
           System.out.println ( "Fault Code = " + fault.getFaultCode() );
           System.out.println ( "Fault String = " +
fault.getFaultString() );
    }
    else
    {
             Parameter ret = resp.getReturnValue();
             Element value = (Element)ret.getValue();
     System.out.println( DOM2Writer.nodeToString(value) );
    }
        } catch (SOAPException e) {
           System.err.println( "Caught SOAPException (" +
                           e.getFaultCode() + ") "  +

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

It appears as if the the above Parameter object is using the bodies encoding
and it just ignores the NS_URI_SOAP_ENC.
If I change my service methods argument to String instead of the String[]
and I modify my client side to pass String parameter the code works fine!

I am using the Apache SOAP 2.2 implementation.

Any suggestions would be good.

Alen Ribic








--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>