• Post Reply Bookmark Topic Watch Topic
  • New Topic

Apache AXIS client tries to invoke WSAD generated webservices!!!

 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
I have got a problem...I have used IBM WSAD 5.1.2 to develop & publish webservices. Now, I am trying to write a single Java class, which an apache AXIS client, calling one of these Webservices. But I am getting an error, which says "Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize".

Can you guys help me out in here?

Below, is the code I have written...(I am printing without formatting)
-----------------------------------------
public class TestClient {
public static void main(String [] args) {
try {
String endpoint = "http://localhost:9080/EODDService/services/Company";
System.out.println("1");
Service service = new Service();
Call call = (Call) service.createCall();
System.out.println("2");
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("", "companyGetAll"));
System.out.println("3");
String ret = (String)call.invoke( new Object[] {new Integer(1),new Integer(1),new Integer(10),"english"} );
System.out.println("4 utput="+ret);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
---------------------------------------
[ February 12, 2007: Message edited by: Subhadip Chatterjee ]
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either your SOAP request or response is not sending/reading proper SOAP message.
As long as your webservices method returns primitive data types like String/Int/decimel etc., then writing your client program will work fine. For other data types it better to use WSDL2Java utility from ApacheAxis to generate a Webservices Stub (client code). Later then you can modify this code to your needs.
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balaji,
You are absolutely right...In my webservice implementation, i have got a java VO object as response/return. Now, i have checked that my client program, is calling the webservice properly,and it does it's job, but while returning the response, it's throwing exception.

My return object is: CompanyDetailVO, it has an array of company rows in it.
each row is a new CompRowVO object.

So, what's your suggestion in this.How do i do it?
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Subhadip Chatterjee:
but while returning the response, it's throwing exception.

My return object is: CompanyDetailVO, it has an array of company rows in it.
[/QB]


For such cases, you need to write the Deserializer java class to interpret the CompanyDetailVO object. You can generate such java class using WSDL2Java utility from Apache Axis. This tutorial might also help you http://radio.javaranch.com/balajidl/2006/03/22/1143041392434.html
 
Kris Bal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to register serializer and deserializer for each object(VO) you send and receive before invoking the web service.This would solve your problem.
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
thanks for your prompt response. Can you please come up to my other problem; it's a new post "rpc.serviceException"?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!