• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object data type as parameter + Webservice + Tomcat

 
Arvind Chavar
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!