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 Scott Nichol <sn...@scottnichol.com> on 2002/07/02 19:42:04 UTC
Re: No Deserializer found
The service is returning the value in an XML element (named 'return') that
has no xsi:type attribute. Therefore, your client must provide a type
mapping for this element, such as by adding code like:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("", "return"),
null, null, new FloatDeserializer());
call.setSOAPMappingRegistry(smr);
Scott Nichol
----- Original Message -----
From: "Siddique Farhan-W13881" <fa...@motorola.com>
To: <sn...@computer.org>
Sent: Tuesday, July 02, 2002 1:31 PM
Subject: No Deserializer found
> Hi Scott:
> I am getting this error message, when I try to run a sample web
> service. Can you please me if I missing anything. Thanks
>
> [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to
> deserialize a ':return' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.;
> targetException=java.lang.IllegalArgumentException: No Deserializer found
to
> deserialize a ':return' using encoding style
> 'http://schemas.xmlsoap.org/soap/encoding/'.] at
> org.apache.soap.rpc.Call.invoke(Call.java:244) at
> TempClient.getTemp(TempClient.java:28) at
> TempClient.main(TempClient.java:48)
>
> Code is as follows
>
> import java.io.*;
> import java.net.*;
> import java.util.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
> public class TempClient{
>
> public static float getTemp (URL url, String zipcode) throws Exception
{
>
> Call call = new Call ();
>
> // Service uses standard SOAP encoding
> String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
> call.setEncodingStyleURI(encodingStyleURI);
>
> // Set service locator parameters
> call.setTargetObjectURI ("urn:xmethods-Temperature");
> call.setMethodName ("getTemp");
>
> // Create input parameter vector
> Vector params = new Vector ();
> params.addElement (new Parameter("zipcode", String.class, zipcode,
> null));
> call.setParams (params);
>
> // Invoke the service ....
> Response resp = call.invoke (url,"");
>
> // ... and evaluate the response
> if (resp.generatedFault ()) {
> throw new Exception();
> } else {
> // Call was successful. Extract response parameter and return
> result
> Parameter result = resp.getReturnValue ();
> Float rate=(Float) result.getValue();
> return rate.floatValue();
> }
> }
>
> // Driver to illustrate service invocation
> public static void main(String[] args)
> {
> try
> {
> URL url=new
> URL("http://services.xmethods.com:80/soap/servlet/rpcrouter");
> String zipcode= "94041";
> float temp = getTemp(url,zipcode);
> System.out.println(temp);
> }
> catch (Exception e) {e.printStackTrace();}
> }
> }
>
> Regards,
>
> Farhan Siddique
>
>