This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue accessing restful service

 
Thomas Green
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could any one kindly help me to get out of this issue?
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Dan Drillich
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thomas,

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

Regards,
Dan
 
Thomas Green
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic