This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Web Services and the fly likes Issue accessing restful service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Issue accessing restful service" Watch "Issue accessing restful service" New topic
Author

Issue accessing restful service

Thomas Green
Greenhorn

Joined: Aug 08, 2008
Posts: 3
I'm getting the below exception while accessing a restful web service

[SOAPException: faultCode=SOAP-ENV:Client; msg=No Serializer found to serialize a 'org.apache.soap.rpc.Parameter' using encoding style 'http://schemas.xmlsoap.org/soap/envelope/'.; targetException=java.lang.IllegalArgumentException: No Serializer found to serialize a 'org.apache.soap.rpc.Parameter' using encoding style 'http://schemas.xmlsoap.org/soap/envelope/'.]

This is the public URL of wsdl and client program

http://68.87.86.50/oss/services/ScoutPACKETCABLEResetService?wsdl
------------------------------------------------------------------------------
import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.*;

public class WSClient {

public static void main (String[] args) {

String strInput = "<?xml version=\"1.0\" ?><request><query app_key=\"GS_TEST\">";
strInput+="<device-list><device device_type=\"mac\">00:0e:5c:e7:a0:08</device>";
strInput+="</device-list></query></request>";

try {
URL url = new URL ("http://68.87.86.50/oss/rest/ScoutPACKETCABLEResetService");
Call call = new Call();
call.setTargetObjectURI("urn:resetPACKETCABLEDevice");
call.setMethodName("resetPACKETCABLEDevice");

call.setEncodingStyleURI(org.apache.soap.Constants.NS_URI_SOAP_ENV);
Vector params = new Vector ( );
params.addElement(new Parameter("parameter", String.class, strInput, null));
call.setParams (params);
call.setSOAPTransport(new SOAPHTTPConnection()) ;

Response resp = call.invoke(url, "");
if (resp.generatedFault( )) {
Fault fault = resp.getFault ( );
System.out.println ("\nOuch, the 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 ( ));
}
}catch(Exception e) {
System.out.println(e);
}
}
}
Thomas Green
Greenhorn

Joined: Aug 08, 2008
Posts: 3
Could any one kindly help me to get out of this issue?
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
Hi Thomas,

Do you use, by any chance, WebSphere? IBM says at -

http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.waszos40.doc/html/WebSphere_Application_Server_for_z_OS/swg1PQ66589.html



When a client attempts to invoke a SOAP method which returns a complex type (for example, JavaBean), and WebSphere attempts to serialize the complex return type as part of the output of a SOAP call, this error occurs: java.lang.IllegalArgumentException: No Serializer found to serialize a ''org.apache.soap.rpc.Parameter'' using encoding style ''null''. ....

This is a bug in the soap.jar 2.2 code shipped with WebSphere Application Server zOS v4.01. The bug has been fixed and shipped in both soap.jar 2.3, as well as workstation ...



I hope it helps.

Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
Hi Thomas,

One question - do you really need a complexType for the resetPACKETCABLEDevice and resetPACKETCABLEDeviceResponse strings?

Regards,
Dan
Thomas Green
Greenhorn

Joined: Aug 08, 2008
Posts: 3
Thank you Dan.

I have not used a complex type here. Argument as well as the return type are String. I tried axis2 client as well as jaxrpc client to access the web service. Used the latest version of soap jar. Also the service provides both rest as well as normal url's to access the service. I tried both url's and failed

Thank you once again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issue accessing restful service