Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 38974 invoked from network); 5 Feb 2004 17:29:28 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Feb 2004 17:29:28 -0000 Received: (qmail 81710 invoked by uid 500); 5 Feb 2004 16:17:54 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 81650 invoked by uid 500); 5 Feb 2004 16:17:53 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 81578 invoked from network); 5 Feb 2004 16:17:52 -0000 Received: from unknown (HELO web60607.mail.yahoo.com) (216.109.118.245) by daedalus.apache.org with SMTP; 5 Feb 2004 16:17:52 -0000 Message-ID: <20040205161754.97355.qmail@web60607.mail.yahoo.com> Received: from [4.20.74.62] by web60607.mail.yahoo.com via HTTP; Thu, 05 Feb 2004 08:17:54 PST Date: Thu, 5 Feb 2004 08:17:54 -0800 (PST) From: Tony Blair Subject: Re: SimpleDeserializer error To: axis-user@ws.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1306080717-1075997874=:96793" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --0-1306080717-1075997874=:96793 Content-Type: text/plain; charset=us-ascii Hi Venkatesh, Thanks for the suggestion. I slightly modified my code from yesterday where my bean takes a Collection and my service also returns a Collection. Based on the error I get I am not sure if the ser/deser are the problem. Here is the error and thanks for all the help you can give me. -----------error msg------------- SEVERE: Exception: org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class apacheax is.Param) at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:311) at org.apache.axis.encoding.DeserializationContextImpl.startElement(Dese rializationContextImpl.java:963) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja va:198) at org.apache.axis.message.MessageElement.publishToHandler(MessageElemen t.java:722) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347) at org.apache.axis.client.Call.invoke(Call.java:2272) at org.apache.axis.client.Call.invoke(Call.java:2171) at org.apache.axis.client.Call.invoke(Call.java:1691) at apacheaxis.Client.main(Client.java:41) Error : org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class apacheaxis.Param) -------------------The first bean------------------ public class Request { / ********** this bean now handles collections*************/ private Collection params=null public Collection getParams() { return params; } public void setParams(Collection data) { params=data; } } ------------- The 2nd bean ------------ public class Param implements java.io.Serializable { /********** this class remains unchanged **************/ private String name=null; private Object value=null; public String getName() { return name; } public void setName(String data) { name = data; } public Object getValue() { return value; } public void setValue(Object data) { value=data; } } -------------- The service -------------- public class PublicService3 { /********Service now is returning Collection *******/ public Collection getSeveralBusinessLocation(Request req){ Collection busLoc = new ArrayList(2); Param line1= new Param(); line1.setName("LINE_1"); line1.setValue("121 River Street"); busLoc.add(line1); Param name= new Param(); name.setName("BUSINESS_NAME"); name.setValue("Marsh"); busLoc.add(name); return busLoc; } } ------------Client --------- public class Client { public static void main(String [] args) throws Exception { Options options = new Options(args); Request req = new Request(); Service service = new Service(); Call call = (Call) service.createCall(); QName qn = new QName( "urn:PublicService3", "Request" ); call.registerTypeMapping(Request.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(Request.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Request.class, qn)); call.registerTypeMapping(Param.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory(Param.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory(Param.class, qn)); Collection result=null; try { call.setTargetEndpointAddress( new java.net.URL(options.getURL()) ); call.setOperationName( new QName("PublicService3", "getSeveralBusinessLocation") ); call.addParameter( "arg1", qn, ParameterMode.IN ); call.setReturnClass(Param.class); result = (ArrayList) call.invoke( new Object[] { req } ); } catch (AxisFault fault) { String error = "Error : " + fault.toString(); System.out.println(error); } System.out.println("Name Value"); System.out.println("------------------------"); Iterator itr = result.iterator(); while(itr.hasNext()){ Param p = (Param)itr.next(); String name = p.getName(); String value = (String)p.getValue(); System.out.println(name+" "+value); } } } -----------deploy.wsdd---------------- Thanks, Tony. Venkatesh Kancharla wrote: Have a look at org.apache.axis.encoding.ser package. It contains all the serializers and deserializers for some collecion objects. On Wed, 4 Feb 2004, Tony Blair wrote: > Venkatesh, > > Does Axis allow beans to have Collections as their data member? > > Thanks, > Tony. > > Venkatesh Kancharla wrote: > > > > Error : org.xml.sax.SAXException: SimpleDeserializer encountered a child element > > , which is NOT expected, in something it was trying to deserialize. > > > > My client is invoking a call to the service and pass it a bean that has a complex type as a data member. Should I post the code and deploy.wsdd? > > is your complex object a bean? you can only pass beans ( it should have > setter/getter methods for all of its instance variables) > > > > > > Thanks in advance. > > > > > > --------------------------------- > > Do you Yahoo!? > > Yahoo! SiteBuilder - Free web site building tool. Try it! > > > --------------------------------- > Do you Yahoo!? > Yahoo! SiteBuilder - Free web site building tool. Try it! --------------------------------- Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online --0-1306080717-1075997874=:96793 Content-Type: text/html; charset=us-ascii
Hi Venkatesh,
 
Thanks for the suggestion. I slightly modified my code from yesterday where my bean takes a Collection and my service also returns a Collection. Based on the error I get I am not sure if the ser/deser are the problem. Here is the error and thanks for all the help you can give me.
 
-----------error msg-------------
SEVERE: Exception:
org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class apacheax
is.Param)
        at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:311)
        at org.apache.axis.encoding.DeserializationContextImpl.startElement(Dese
rializationContextImpl.java:963)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja
va:198)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElemen
t.java:722)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
        at org.apache.axis.client.Call.invoke(Call.java:2272)
        at org.apache.axis.client.Call.invoke(Call.java:2171)
        at org.apache.axis.client.Call.invoke(Call.java:1691)
        at apacheaxis.Client.main(Client.java:41)
Error : org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class
apacheaxis.Param)
 
-------------------The first bean------------------
public class Request 
{
   / ********** this bean now handles collections*************/
    private Collection params=null
    
    public Collection getParams()
    { return params; }
    public void setParams(Collection data)
    { params=data; }
   
}
------------- The 2nd bean ------------
public class Param implements java.io.Serializable
{
/********** this class remains unchanged **************/   
    private String name=null;
    private Object value=null;
    public String getName()
    { return name; }
    public void setName(String data)
    { name = data; }
   
    public Object getValue()
    { return value; }
    public void setValue(Object data)
    { value=data; }
}
-------------- The service --------------
public class PublicService3
{
  /********Service now is returning Collection *******/
    public Collection getSeveralBusinessLocation(Request req){
        Collection busLoc = new ArrayList(2);
        Param line1= new Param();
        line1.setName("LINE_1");
        line1.setValue("121 River Street");
        busLoc.add(line1);
        Param name= new Param();
        name.setName("BUSINESS_NAME");
        name.setValue("Marsh");
        busLoc.add(name);

        return busLoc;
    }
}
------------Client ---------
public class Client
{
    public static void main(String [] args) throws Exception
    {
        Options options = new Options(args);
       
        Request req = new Request();
       
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
        QName    qn      = new QName( "urn:PublicService3", "Request" );
        call.registerTypeMapping(Request.class, qn,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(Request.class, qn),       
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(Request.class, qn));
        call.registerTypeMapping(Param.class, qn,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(Param.class, qn),       
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(Param.class, qn));       
        Collection result=null;
        try {
            call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
            call.setOperationName( new QName("PublicService3", "getSeveralBusinessLocation") );
            call.addParameter( "arg1", qn, ParameterMode.IN );
            call.setReturnClass(Param.class);
            result = (ArrayList) call.invoke( new Object[] { req } );
        } catch (AxisFault fault) {
          String  error = "Error : " + fault.toString();
          System.out.println(error);
        }
        System.out.println("Name               Value");
        System.out.println("------------------------");
        Iterator itr = result.iterator();
        while(itr.hasNext()){
            Param p = (Param)itr.next();
            String name = p.getName();
            String value = (String)p.getValue();
            System.out.println(name+"       "+value);
        }
    }
}
-----------deploy.wsdd----------------
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
    <service name="PublicService3" provider="java:RPC" style="wrapped">
        <parameter name="className" value="apacheaxis.PublicService3"/>
        <parameter name="allowedMethods" value="getSeveralBusinessLocation"/>
        <beanMapping qname="myNS:Request" xmlns:myNS="urn:PublicService3" languageSpecificType="java:apacheaxis.Request"/>
        <beanMapping qname="myNS:Param" xmlns:myNS="urn:PublicService3" languageSpecificType="java:apacheaxis.Param"/>
        <typeMapping qname="myNS:Param" xmlns:myNS="urn:PublicService3" languageSpecificType="java:apacheaxis.Param"
             deserializer="apacheaxis.ParamDeserFactory"/>
    </service>
</deployment>
 
Thanks,
Tony.

Venkatesh Kancharla <venkatesh@strandgenomics.com> wrote:
Have a look at org.apache.axis.encoding.ser package. It contains all the
serializers and deserializers for some collecion objects.

On Wed, 4 Feb 2004, Tony Blair wrote:

> Venkatesh,
>
> Does Axis allow beans to have Collections as their data member?
>
> Thanks,
> Tony.
>
> Venkatesh Kancharla wrote:
> >
> > Error : org.xml.sax.SAXException: SimpleDeserializer encountered a child element
> > , which is NOT expected, in something it was trying to deserialize.
> >
> > My client is invoking a call to the service and pass it a bean that has a complex type as a data member. Should I post the code and deploy.wsdd?
>
> is your complex object a bean? you can only pass beans ( it should have
> setter/getter methods for all of its instance variables)
>
>
> >
> > Thanks in advance.
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free web site building tool. Try it!
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online --0-1306080717-1075997874=:96793--