HI Naveen,
I am very new to this. I am not sure if I am following your instructions. I am hoping there is a simpler solution to this.
Thanks,
Tony.
Navneet Joneja <[EMAIL PROTECTED]> wrote:
Navneet Joneja <[EMAIL PROTECTED]> wrote:
Sounds like bug #17017 to me. If it is: it's a bug in the code-generator. Tweaking the generated code for the containing bean should help.Or use 1.1 RC2, that's the only version of Axis that I saw actually do the right thing, for a brief while before 1.1 was released.- Navneet.-----Original Message-----
From: Tony Blair [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 8:18 AM
To: [EMAIL PROTECTED]
Subject: Re: SimpleDeserializer errorHi 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+" &nb! sp; "+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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>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 i! ts 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
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online