Ben Abramson
2005-06-01 15:29:54 UTC
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.
===========================================================================
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.
===========================================================================