You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Chris Coyle <ch...@yahoo.com> on 2002/08/10 12:32:26 UTC
Deserializing a String (string)
I am new to SOAP and I am trying to implement a simple HelloWorld type app. When I use the TcpTunnelGui I can see my expected response from the SOAP app. However, my client fires off the following fault:
I thought SOAP understood how to serialize/deserialize type String by default...
[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 is my DeploymentDescriptor.xml:
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:HelloTest">
<isd:provider type="java"
scope="Application"
methods="sayHello">
<isd:java class="samples.hellotest.HelloTest" static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
<isd:mappings />
</isd:service>
Here is my client code (HelloClient.java)
import java.io.*;
import java.util.*;
import java.net.*;
import org.apache.soap.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.rpc.*;
public class HelloClient {
public static void main(String[] args) {
try {
System.out.println("Calling rpc servlet...");
URL url = new URL(args[0]);
String name = args[1];
Call call = new Call();
call.setTargetObjectURI("urn:HelloTest");
call.setMethodName("sayHello");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("name", String.class, name, null));
call.setParams(params);
System.out.println("Server says: ");
Response resp = call.invoke(url, "");
if(resp.generatedFault()) {
Fault fault = resp.getFault();
System.out.println("\nOuch call failed.");
System.out.println(" Fault Code = " + fault.getFaultCode());
System.out.println(" Fault String = " + fault.getFaultString());
}
else {
Parameter result = resp.getReturnValue();
System.out.print(result.getValue());
System.out.println();
}
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Any help would be greatly appreciated.
Chris Coyle
---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs