ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Nichol" <snicholn...@scottnichol.com>
Subject Re: Calling an Axis Web Service with a SOAP client
Date Wed, 01 Jun 2005 18:19:07 GMT
Apache SOAP 2.3.1 does not de-serialize SOAP-ENC types by default (they are not mapped), just
XSD types.  The current source (post 2.3.1) will de-serialize SOAP-ENC types, I believe. 
Alternatively, your code map

SOAPMappingRegistry smr = new SOAPMappingRegistry();

       StringDeserializer sd = new StringDeserializer();

       smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("http://schemas.xmlsoap.org/soap/encoding/",
"string"), null, null, sd);

       cl.setSOAPMappingRegistry(smr);


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: "Ben Abramson" <Ben.Abramson@upco.co.uk>
To: <soap-dev@ws.apache.org>
Sent: Wednesday, June 01, 2005 11:29 AM
Subject: Calling an Axis Web Service with a SOAP client


Hello,

 

I have written an Axis web service, which I have successfully invoked
with an Axis client. I'm now trying to write an equivalent client using
standard SOAP. The relevant code in the SOAP client looks something
like:

 

cl.setTargetObjectURI("urn:dohello");

       cl.setMethodName("sayHello");

       cl.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

        

       Vector params = new Vector();

       params.addElement(new Parameter("name", String.class, name,
null));

       params.addElement(new Parameter("age", Integer.class, a, null));

       cl.setParams(params);

 

When I then try to invoke the call using the command:

 

response = cl.invoke(ept, "");

 

Where 'ept' is the URL of my service. I'm expecting a string back
(nothing complex), but I get an exception that tells me it can't find a
deserializer:

 

[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
deserialize a
&apos;http://schemas.xmlsoap.org/soap/encoding/:string&apos; using
encoding style &apos;http://schemas.xmlsoap.org/soap/encoding/&apos;.;
targetException=java.lang.IllegalArgumentException: No Deserializer
found to deserialize a
'http://schemas.xmlsoap.org/soap/encoding/:string' using encoding style
'http://schemas.xmlsoap.org/soap/encoding/'.]

 

 

I've tried messing around with SOAPMappingRegistry, but it seems to make
no difference at all, I added the lines:

 

SOAPMappingRegistry smr = new SOAPMappingRegistry();

       StringDeserializer sd = new StringDeserializer();

       smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("",
"sayHelloReturn"), null, null, sd);

       cl.setSOAPMappingRegistry(smr);

 

But it made no difference. I know I'm getting a valid response from my
Web Service, the xml that comes back from the call looks like:

 

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

  <ns1:sayHelloResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:dohello">

    <sayHelloReturn xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">

      Hello Ben, aged 26

    </sayHelloReturn>

  </ns1:sayHelloResponse>

</soapenv:Body>

</soapenv:Envelope>

 

It just seems that my client can't unwrap it properly to give me the
result.

 

I can't find anywhere that seems to provide me with enough detail to
identify the root of my problem. Can anyone help?

 

Ben

P.S. Are there any plans to put functionality into Axis so that complex
types can be easily passed around to other platforms? (I know there's
some bean stuff, but what about collections etc.?)


===========================================================================
The contents of this email are intended for the named addresses and may 
contain confidential and/or privileged material. If received in error, 
please contact UPCO head office on +44(0)113 201 0600 and then delete 
the entire mail from your system. Unauthorised review, distribution, 
disclosure or other use of information could constitute a breach of 
confidence. Your co-operation in this matter is greatly appreciated.

Every effort has been taken to ensure that this email and any 
attachments are virus-free. However, UPCO does not make any warranty 
to this effect, and is not liable for any damage done by an infected 
email message or attachment. UPCO recommends that all emails and 
attachments are checked before opening.

All views or opinions expressed in this electronic message and its 
attachements are those of the sender and do not necessarily reflect 
the views and opinions of The Ultimate People Company Ltd.
===========================================================================




Mime
View raw message