aspose file tools
The moose likes Web Services and the fly likes Object  data type as parameter + Webservice + Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Object  data type as parameter + Webservice + Tomcat" Watch "Object  data type as parameter + Webservice + Tomcat" New topic
Author

Object data type as parameter + Webservice + Tomcat

Arvind Chavar
Ranch Hand

Joined: May 16, 2001
Posts: 53
I have deployed a webservice on tomcat, which has a method accepting Object as parameter.The web service code is
package onjava;
public class MyCalcService {
public int add(Object num) {
TwoNumbers inNum = (TwoNumbers)num;
return inNum.getNum1() + inNum.getNum2();
}
public int substract(Object num) {
TwoNumbers inNum = (TwoNumbers)num;
return inNum.getNum1() - inNum.getNum2();
}
public String reverseId(Object num){
TwoNumbers inNum = (TwoNumbers)num;
return (new StringBuffer(inNum.getId())).reverse().toString();
}
}

When I execute the client I am getting following error
Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client; msg=No Ser
ializer found to serialize a 'java.lang.Object' using encoding style 'http://sch
emas.xmlsoap.org/soap/encoding/'.; targetException=java.lang.IllegalArgumentExce
ption: No Serializer found to serialize a 'java.lang.Object' using encoding styl
e 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnec
tion.java:324)
at org.apache.soap.rpc.Call.invoke(Call.java:205)
at onjava.MyCalcClient.main(MyCalcClient.java:34)
I understand the error, but isn't there a predefined mapping for data type of Object(which meets Java Bean specification).I understand that if above is the case I dont have to specify any serializer or deserializer for the object type.

Can anyone please tell me, what else I need to do to make it work?

Thanks!
Arvind
Thanks
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Object data type as parameter + Webservice + Tomcat
 
Similar Threads
is NS_URI_LITERAL_XML encoding language independent?
problem with SOAP
No Serializer found to serialize a 'org.w3c.dom.Element' - Web Services
No deserializer error
Issue accessing restful service