aspose file tools*
The moose likes Web Services and the fly likes msg=No Deserializer found to deserialize a ':return' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "msg=No Deserializer found to deserialize a Watch "msg=No Deserializer found to deserialize a New topic
Author

msg=No Deserializer found to deserialize a ':return'

tien liu
Greenhorn

Joined: Dec 13, 2002
Posts: 18
Hello,
I've deployed the web service on the server, and I've been trying to get a message back from it. But I got the error message below.
Any help is appreciated.
[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserial
ize 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/en
coding/'.]
Here's the client code:
import java.net.*;
import java.util.*;
import org.w3c.dom.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.messaging.*;
public class AuthenticationService7Proxy
{
private Call call = new Call();
private URL url = null;
private String stringURL = "http://xxxx/Auth7/servlet/rpcrouter";
private SOAPMappingRegistry smr = call.getSOAPMappingRegistry();

public AuthenticationService7Proxy()
{
}
public synchronized void setEndPoint(URL url)
{
this.url = url;
}
public synchronized URL getEndPoint() throws MalformedURLException
{
return getURL();
}
private URL getURL() throws MalformedURLException
{
if (url == null && stringURL != null && stringURL.length() > 0)
{
url = new URL(stringURL);
}
return url;
}
public synchronized java.lang.String authenticate(java.lang.String ldapURL,java.lang.String uid,java.lang.String ouString,java.lang.String oString,java.lang.String pwd,java.lang.String ldapBase,java.lang.String ldapFilter) throws Exception
{
String targetObjectURI = "http://xxx/AuthenticationService7";
String SOAPActionURI = "";

String message = null;
if(getURL() == null)
{
throw new SOAPException(Constants.FAULT_CODE_CLIENT,
"A URL must be specified via AuthenticationService7Proxy.setEndPoint(URL).");
}
call.setMethodName("authenticate");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setTargetObjectURI(targetObjectURI);
Vector params = new Vector();
Parameter ldapURLParam = new Parameter("ldapURL", java.lang.String.class, ldapURL, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapURLParam);
System.out.println("added ldapURL parameter");
Parameter uidParam = new Parameter("uid", java.lang.String.class, uid, Constants.NS_URI_SOAP_ENC);
params.addElement(uidParam);
Parameter ouStringParam = new Parameter("ouString", java.lang.String.class, ouString, Constants.NS_URI_SOAP_ENC);
params.addElement(ouStringParam);
Parameter oStringParam = new Parameter("oString", java.lang.String.class, oString, Constants.NS_URI_SOAP_ENC);
params.addElement(oStringParam);
Parameter pwdParam = new Parameter("pwd", java.lang.String.class, pwd, Constants.NS_URI_SOAP_ENC);
params.addElement(pwdParam);
Parameter ldapBaseParam = new Parameter("ldapBase", java.lang.String.class, ldapBase, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapBaseParam);
Parameter ldapFilterParam = new Parameter("ldapFilter", java.lang.String.class, ldapFilter, Constants.NS_URI_SOAP_ENC);
params.addElement(ldapFilterParam);
System.out.println("added ldapFilter parameter");
call.setParams(params);
System.out.println("setParams");
System.out.println("before call invoke");
Response resp = call.invoke(getURL(), SOAPActionURI);
System.out.println("Response");
//Check the response.
if (resp.generatedFault())
{
System.out.println("Response generated fault");
Fault fault = resp.getFault();
call.setFullTargetObjectURI(targetObjectURI);
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
else
{
Parameter refValue = resp.getReturnValue();
return ((java.lang.String)refValue.getValue());

}

}

}

Thanks.
Tien
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
What is the data type of the response you are trying to send back to the consumer ?
Depending of this datatype, you'll have to register a (De)Serializer, both in the server and in the client


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
tien liu
Greenhorn

Joined: Dec 13, 2002
Posts: 18
Thanks for your prompt response. It's a String.

<message name="authenticateResponse">
<part name="result" type="xsd:string"/>
</message>

AuthenticationService7-binding.wsdl (Websphere 4.1.1):
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="AuthenticationService7-binding"
targetNamespace="http://www.authenticationservice7.com/definitions/AuthenticationService7RemoteInterface"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.authenticationservice7.com/definitions/AuthenticationService7RemoteInterface" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="authenticateRequest">
<part name="ldapURL" type="xsd:string"/>
<part name="uid" type="xsd:string"/>
<part name="ouString" type="xsd:string"/>
<part name="oString" type="xsd:string"/>
<part name="pwd" type="xsd:string"/>
<part name="ldapBase" type="xsd:string"/>
<part name="ldapFilter" type="xsd:string"/>
</message>
<message name="authenticateResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="AuthenticationService7">
<operation name="authenticate" parameterOrder="ldapURL uid ouString oString pwd ldapBase ldapFilter">
<input message="tns:authenticateRequest" name="authenticateRequest"/>
<output message="tns:authenticateResponse" name="authenticateResponse"/>
</operation>
</portType>
<binding name="AuthenticationService7Binding" type="tns:AuthenticationService7">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="authenticate">
<soap peration soapAction="" style="rpc"/>
<input name="authenticateRequest">
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://atl.frb.org/AuthenticationService7" use="encoded"/>
</input>
<output name="authenticateResponse">
<soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://atl.frb.org/AuthenticationService7" use="encoded"/>
</output>
</operation>
</binding>
</definitions>
Sanjay Mishra
Ranch Hand

Joined: Jul 08, 2000
Posts: 84
Hi,
Use TCPMON utility to see what kind of message is being sent from client to server. It will show you the return message from server to client also.
So you will be able to see whether the message coming from server is OK or not. Or the problem is with de-serialization.
Tcpmon comes with apache axis.
Regards
Sanjay
tien liu
Greenhorn

Joined: Dec 13, 2002
Posts: 18
Thanks for suggesting to use TCPMON utility in apache axis. I'm using WSAD 4.1.1 (Websphere server). Is there a similar utility in WSAD?
Tien
Sanjay Mishra
Ranch Hand

Joined: Jul 08, 2000
Posts: 84
I am using WSAD 5.0 . tcpmon is in-build in WSAD 5.0. Not sure if it is in 4.1.1. Use WSAD help to search if it is there. If yes, how to use that.
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
As far as I know, the tcpMonitor did not exist in WSAD 4.

But you can use Axis TCPMon with your WSAD. Actually, that's what I do even if I am in WSAD 5.
You just have to send your requests to a TCPMon port, and to redirect them to the WSAD port (I mean WTE here of course). Nomally, it's 9080.
BTW, something is strange in your problem. If you only deal with Strings, I can't figure out how a "No Deserializer Error" can occur...
TCPMon will definitively helps here.
[ July 03, 2003: Message edited by: Jean-Louis Marechaux ]
tien liu
Greenhorn

Joined: Dec 13, 2002
Posts: 18
Hi,
Thanks for your responses. I did figure out the problem and fix it.
I turns out I do have to deserialize the return by adding this code to the class that invokes the web service:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "return"), null, null, sd);
call.setSOAPMappingRegistry(smr);
It has to do with the xsi:type, which is seen as "the most common interop problem." The Apache soap puts the xsi:type elements for all parameters in the request. But, the xsi:type is missing in the response, which includes result or return.
When the xsi:type attribute of the result or return element is missing, the error message will say "SOA-ENV:Client;No deserialization found....."
The solution is to add code to deserialize the return.
The xsi:type problem does not show up when I run the application within WSAD 4.1.1. It only shows up when I run the client outside it.
I hope this will help others to solve the deserialization problem on the client side. If it happens on the server side, you'll need to add the deserialization stuff in the deployment descriptor.
Thanks for your help. You ranchers are a bunch of great guys.
Thanks.
Tien
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Originally posted by tien liu:
Hi,
I turns out I do have to deserialize the return by adding this code to the class that invokes the web service:
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "return"), null, null, sd);
call.setSOAPMappingRegistry(smr);

Hi Tien,
Somethimg is puzzling me.
With Axis, you state it is necessary to register a serializer for String (un)marshalling...
Is the return type not enough ??
I mean, if you have something like :
call.setReturnType(XMLType.XSD_STRING)
is it working the same way or not ??
(I'm really surprise you have to register a serializer for such a simple data type)
[ July 14, 2003: Message edited by: Jean-Louis Marechaux ]
tien liu
Greenhorn

Joined: Dec 13, 2002
Posts: 18
Hi Jean-Louis,
Je suis vraiment choque aussi. Je ne pige pas du tout pourquoi je dois ajouter le deserializer. As you stated, it's a simple String data type.
I tried your code: call.setReturnType(XMLType.XSD_STRING);
Where do you get XMLType.XSD_STRING? The compiler can't find it, and it's not in xerces.jar or soap.jar.
Salut.
Tien
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906

Where do you get XMLType.XSD_STRING? The compiler can't find it, and it's not in xerces.jar or soap.jar.

org.apache.axis.encoding
If you're not an Axis user, I guess you can do instead :
call.setReturnType(java.lang.String)


Je suis vraiment choque aussi. Je ne pige pas du tout pourquoi je dois ajouter le deserializer. As you stated, it's a simple String data type.

Hum, some french here ?? Is this thread gonna be a place to learn human laguages in addition to programming languages ??
[ July 16, 2003: Message edited by: Jean-Louis Marechaux ]
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
I have a slight problem :
I am used to axis and web services for only a week now.
I write : Cal.java

and compile and write a deployment discriptor deploy.wsdd as :

And then run the AdminClient to deploy the web service after placing the class file and the wsdd under the WEB-INF/classes/<package> directory.
Well, it works.
How is this different from the code posted before ( with the problem?? )??
Cheers
Lupo
P.S. Please understand I am relatively a newbie for the Webservices world.


"In the country of the blind, the one eyed man is the King"
Gautham Kasinath CV at : http://www.geocities.com/gkasinath
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
well??
Dont anybody know??
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by gautham kasinath:
[QB]Well, it works.
How is this different from the code posted before ( with the problem?? )??

what is that code? can you post it again on a new thread ?


Spritle Software Blogs
Jetender Singh
Greenhorn

Joined: Sep 13, 2005
Posts: 1
Hi,
I had the same problem as tien liu ie

" No Deserializer found to deserialize a ':return' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/' "

I am Using Jboss server and was trying to return a Sttring though

This was solved based on tien's suggestion of including the Deserializer code.

Thanks
Jetender
Gajalo Lopez
Greenhorn

Joined: Jun 27, 2014
Posts: 1
Hi,

I have the same problem, but I dont have the Call object but instead I have a Stub. I mean, my approach was to have Jdeveloper create a JAX-RPC client, something with code like this:

@Generated("Oracle JDeveloper")
public void addBSTCredentialProvider(String clientKeyStore, String clientKeyStorePass, String clientKeyAlias,
String clientKeyPass, X509Certificate serverCert) throws Exception {
CredentialProvider cp =
new ClientBSTCredentialProvider(clientKeyStore, clientKeyStorePass, clientKeyAlias, clientKeyPass, "JKS", serverCert);
addCredentialProvider(cp);
}

public void setProxyServerInfo(String proxyHost, int proxyPort, String username, String password) {
Proxy p = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
HttpTransportInfo info = new HttpTransportInfo();
info.setProxy(p);

((Stub) getPort())._setProperty("weblogic.wsee.connection.transportinfo", info);

if (username != null)
((Stub) getPort())._setProperty("weblogic.webservice.client.proxyusername", username);

if (password != null)
((Stub) getPort())._setProperty("weblogic.webservice.client.proxypassword", password);
}

It means I have a Stub and not a Call… I don’t know if I made myself clear, but can someone point me in some direction to apply this solution to this jdeveloper generated code? I can post more code if needed.

Any help will be much appreciated
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: msg=No Deserializer found to deserialize a ':return'