Discussion:
Calling an Axis Web Service with a SOAP client
Ben Abramson
2005-06-01 15:29:54 UTC
Permalink
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
'http://schemas.xmlsoap.org/soap/encoding/:string' using
encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.;
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.
===========================================================================
Scott Nichol
2005-06-01 18:19:07 UTC
Permalink
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" <***@upco.co.uk>
To: <soap-***@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.
===========================================================================
Scott Nichol
2005-06-02 14:03:27 UTC
Permalink
Anyone without an established investment in Apache SOAP should choose Axis. It supports more specifications and will continue to support newer ones as they are developed.

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" <***@upco.co.uk>
To: "Scott Nichol" <***@scottnichol.com>; <soap-***@ws.apache.org>
Sent: Thursday, June 02, 2005 3:56 AM
Subject: RE: Calling an Axis Web Service with a SOAP client


Thanks Scott, that works perfectly.

Quick question: I'm building a web service system that includes some
stuff that's on a .NET platform. I'm trying to assess whether I'm better
off using Axis or standard (apache) SOAP, bearing in mind that I may
have pass around non-basic types. What do the experts say?

Thanks again,

Ben

-----Original Message-----
From: Scott Nichol [mailto:***@scottnichol.com]
Sent: 01 June 2005 19:19
To: soap-***@ws.apache.org
Cc: Ben Abramson
Subject: Re: Calling an Axis Web Service with a SOAP client

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" <***@upco.co.uk>
To: <soap-***@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.
========================================================================
===
Ben Abramson
2005-06-02 07:56:23 UTC
Permalink
Thanks Scott, that works perfectly.

Quick question: I'm building a web service system that includes some
stuff that's on a .NET platform. I'm trying to assess whether I'm better
off using Axis or standard (apache) SOAP, bearing in mind that I may
have pass around non-basic types. What do the experts say?

Thanks again,

Ben

-----Original Message-----
From: Scott Nichol [mailto:***@scottnichol.com]
Sent: 01 June 2005 19:19
To: soap-***@ws.apache.org
Cc: Ben Abramson
Subject: Re: Calling an Axis Web Service with a SOAP client

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" <***@upco.co.uk>
To: <soap-***@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.
========================================================================
===

Continue reading on narkive:
Search results for 'Calling an Axis Web Service with a SOAP client' (Questions and Answers)
17
replies
What's preventing TV over the internet?
started 2007-10-02 13:41:09 UTC
internet
Loading...