axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerome moliere <jmoli...@nerim.net>
Subject Re: Problem with custom return type[Long]
Date Fri, 18 Oct 2002 15:17:48 GMT
jerome moliere wrote:

> 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..
>
Humm, sorry i found what the problem is..
In fact the problem is that I 've some inner bean (an order   contains 
data about customer, and contains items) so I was obliged to add bean 
mappings  to  my .wsdd & to register them into the client code....
My problem is now that my list of items is a collection (java.util.Vector)..
SO I'll fetch how to serialize this kind of items into the manual..
Sorry.
This reply is just for the archive system... I guess it could be usefull 
for other new users...

Jerome



Mime
View raw message