You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sam <sa...@yahoo.com> on 2004/02/11 22:17:51 UTC
XML Encoding for a void type?
Hi,
I need to invoke a web service that takes in a void type and returns a Vector. Thanks to Venkatesh Kancherla, I am able to do the Vector part fine. But I am now stuck with the void thing. (I am using Java)
what do I need to do in the client if I have a service that takes in a void?
Here's my situation:
I have 2 services:
One takes in Order class (custom, used the beanSerializer and it works fine) and returns a void. For this, in the client, I called addParameter() with my custom Qname that I created with the beanSerializer, but didnot specify anything fo the return type. (Did not call setReturnType() at all)
This works fine.
Another service takes in a void and returns a Vector. Now, I have to call setReturnType() with a QName for Vector, that I created. It is fine. But if I dont call call.addParameter(), it throws an AxisFault, saying "addParameter() should be called along with setReturnType()". So my question is, how should I call addParameter() for this?
I am giving my code fragment below
Thanks a lot,
Sam
------
Vector retVector = new Vector();
String serviceURL = http://localhost:8080/axis/services/SamService;
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(serviceURL) );
call.setOperationName( new QName("SamService", "serviceMethod") );
// HOW SHOULD THIS BE???
// QName qVoid=new QName("samNS","void");
// call.addParameter( "arg1", qVoid, ParameterMode.IN);
QName qVec=new QName("samNS","Vector");
call.setReturnType( qVec );
retVector = (Vector) call.invoke();
------
My corresponding deploy.wsdd file is
------
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="SamService" provider="java:RPC">
<parameter name="className" value="myPackage.SamClass"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="samNS:Order" xmlns:samNS="urn:OrderService" languageSpecificType="myPackage.Order"/>
</service>
</deployment>
-----
---------------------------------
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online