wood burning stoves 2.0
The moose likes Web Services and the fly likes WSAD 5.1.1 SOAP RPC return type of Object[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSAD 5.1.1 SOAP RPC return type of Object[]" Watch "WSAD 5.1.1 SOAP RPC return type of Object[]" New topic

WSAD 5.1.1 SOAP RPC return type of Object[]

Antoine Catalfano

Joined: Feb 24, 2004
Posts: 4
I have a java bean with a method:
public Object[] methodOne(String s, Object obj) {...}
I've used the WSAD wizard to generate a web service from the java bean.
The client looks like this:
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL("http://localhost:9080/RPCWeb/services/AWebService"));
call.setOperationName(new QName(getNamespace(), getMethodName()));
Object[] invocationParameters =new Object[] { "input", "more input" };
Object returnValue = call.invoke(invocationParameters);
I can see that the request is getting to the web service. However, the returnValue from the call.invoke(...) is always null.
Any ideas?
Vinod John
Ranch Hand

Joined: Jun 23, 2003
Posts: 162
Did you check whether the webservice is returing a valid response ?. An easy way to moniter this is by writing a simple app that stands between the web service and the client an trace out the XML and redirects the req/res to the corresponding destination. Apache SOAP used to have one utility to this. I don't know about WSAD impl
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Axis has tcpmon (see the Axis User's Guide). There are other "logging proxy" type of programs out there as well. One of the good ones is tcpsniffer.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
This won't work in Apache SOAP (which you're using) or Apache Axis for that matter because the SOAP engine doesn't know what type of objects it is serializing and during the generation of the stub and server will not generate/link in the appropriate serializer types. You should never use an Object type or Object Array in Web Services -- use an array typed to your actual type you want returned instead.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Antoine Catalfano

Joined: Feb 24, 2004
Posts: 4
I'm using the TCPMonitor in WSAD. I see the following response is being sent:
HTTP/1.1 200 OK
Server: WebSphere Application Server/5.0
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<methodOneResponse xmlns="http://service.web">
<methodOneReturn xsi:type="soapenc:Array" soapenc:arrayType="xsd:anyType[2]" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns="">
<item xsi:type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema">Morandi</item>
<item xsi:type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema">Hello Antoine</item>
I'm just not sure how to get it.
Antoine Catalfano

Joined: Feb 24, 2004
Posts: 4
This is currently working using Apache AXIS and a Jetty server. We (John Deere and Thought Works) built a custom EAI framework. Our SOAP adapters support RPC and JAXM Messaging. We've exposed our framework as a SOAP service.
The method signature is as follows:
public Object[] execute(String service, String activity, String ativityMsgVersion, String sourceSystem,Object payload) throws ISFException
The .wsdd looks like:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
<service name="isf" provider="java:RPC">
<parameter name="className" value="com.deere.isf.adapters.soap.ISFSOAP"/>
<parameter name="allowedMethods" value="*"/>
We have a JUnit script that generates wsdl, stubs, starts a Jetty server, deploys the web service and tests it. I'm currently trying to get the unit tests running in WSAD.
Antoine Catalfano

Joined: Feb 24, 2004
Posts: 4
I should have mentioned that since this is an integration framework, we have to support taking a payload of any type (a java Object).
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: WSAD 5.1.1 SOAP RPC return type of Object[]
It's not a secret anymore!