Hi all,
I'm a newbie with web services and axis too...
I'm trying to bench this techno , comparing it to a servlet /serializing Beans as XML
so I decided to publish a small service returning an Order (Bean like component containing
a collection of Item (javabean too) and a few fields (strings)).

So I made my .wsdd to deploy this web service :
<deployment xmlns="http://xml.apache.org/axis/wsdd/";
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
<service name="OrderService" provider="java:RPC">
<parameter name="className" value="fr.infologic.tests.mapping.OrderService"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="myNS:MyOrder" xmlns:myNS="urn:BeanService"
languageSpecificType="java:fr.infologic.tests.mapping.MyOrder"/>

</service>
</deployment>

then I coded the service (I don't think that any problem occur from this very simple code)
and a client:
package fr.infologic.tests.mapping;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;

import javax.xml.rpc.ParameterMode;

/**
* @author jerome
*
*/
public class SOAPClient {
public static void main(String [] args)
{
try {
Options options = new Options(args);
String endpointURL = options.getURL();
String textToSend;
args = options.getRemainingArgs();
if ((args == null) || (args.length < 1)) {
textToSend = "<nothing>";
} else {
textToSend = args[0];
}
Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
call.setOperationName( "getOrder" );
QName qn = new QName( "urn:BeanService", "MyOrder" );
call.registerTypeMapping(MyOrder.class, qn,
new org.apache.axis.encoding.ser.BeanSerializerFactory(MyOrder.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(MyOrder.class, qn)); call.setReturnType( qn);
double start=System.currentTimeMillis();
MyOrder ret_order = (MyOrder) call.invoke( new Object[]{} );
double stop=System.currentTimeMillis();
System.err.println("Elapsed time for getting order = " + (stop-start)/1000);
System.err.println("Order contains " +ret_order.getItemsList().size() + " items");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}

deploy succeed in but invoking the client induces an internal error in the Axis servlet,
due to an java.io.IOException no serializer found for this type mapping.
I hoped that registering the type mapping was made by the call.registerTypeMapping but it seems taht 's not the case....

SO any help greatly appreciated
Sorry for inconveniance...

Cheers
Jerome

PS:
the code is slighlty adapted from the samples..



Reply via email to