Thanks Thanks a lot.
Yep that was it.
I had all sorts of constructors but the default one. Upon adding that along
with the other constructors that I had removed, it worked!. YIPPEEE!
As for R J Scheuerle's reply to have found the field 'password' and bean
accessors as 'setPasswd', I apologize as that was just a temporary change I
had made to see if it changed the soap message and I forgot to correct it
before posting the message. I appreciate your time for replying me though.

----- Original Message -----
From: "Tom Jordahl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 29, 2002 4:27 PM
Subject: RE: NullPointerException while returning an arbitrary Java object


>
> Did you have 2 constructors, the default and the initializer?
>
> There is a bug in Axis which doesn't handle the case of a missing default
constructor correctly.  It fails to create the object, but then continues,
causing the null pointer error later.  I will fix this.
>
> The BeanSerializer always requires a default constructor (I think the
JavaBean patter requires this).
>
> --
> Tom Jordahl
> Macromedia
>
>
>
> -----Original Message-----
> From: Vaishakhi Ajmera [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 29, 2002 4:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: NullPointerException while returning an arbitrary Java
> object
>
>
> I was finally able to resolve my issue but the resolution confuses me so I
> still need some insight from anyone who can give me some.
>
> My User class that I was trying to return from the webservice has a
> constructor as follows
>
> public User(String vFname, String vLname, String vPassword,
>      String vUuid, String vLogin)
>  {
>    //first name
>   _fname=vFname;
>   _lname=vLname;
>   _password=vPassword;
>   _uuid=vUuid;
>   _login=vLogin;
>  }
>
> My webservice method that returned me a User object is as follows
>
> public User getObject()
>  {
>   return new User("John", "Doe", "doe", "111-11-1111", "jdoe")
> }
>
> Now all I did was remove the constructor from the User object and create
the
> user object in the webservice using its default constructor and set the
> fields using the set methods and IT WORKED!
>
> My new webservice method looks like this
>
> public User getObject()
>  {
>   User user = new User();
>   user.setFname("John");
>   user.setLname("Doe");
>   user.setPasswd("doe");
>   user.setUuid("111-11-1111");
>   user.setLogin("jdoe");
>   return user;
>  }
>
> What does this mean? Why did this work? Does it mean that when I claim
that
> a class is bean like then it is not supposed to have a constructor? What
was
> wrong with my constructor?
>
> I would appreciate if someone could answer these questions of mine.
>
> Thanks
> Vaishakhi
> ----- Original Message -----
> From: "Vaishakhi Ajmera" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 29, 2002 11:43 AM
> Subject: NullPointerException while returning an arbitrary Java object
>
>
> > Hello,
> > I have a webservice method that returns to me a User object which is a
> bean
> > like class have getters and setters for fields like firstname, lastname,
> > password.
> >
> > My deploy.wsdd looks like this
> > <deployment xmlns="http://xml.apache.org/axis/wsdd/";
> >             xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";>
> >
> >  <service name="TestWs" provider="java:RPC">
> >   <parameter name="className"
value="com.ardec.ebf.test.TestWebService"/>
> >   <parameter name="allowedMethods" value="*"/>
> >
> >   <beanMapping qname="myNS:User" xmlns:myNS="urn:TestWebService"
> >                languageSpecificType="java:com.ardec.ebf.usermgr.User"/>
> >  </service>
> >
> > </deployment>
> >
> > and the client call is as follows
> >
> > String endpoint = http://localhost:8080/usermgr/services/TestWs
> > Service  service = new Service();
> > Call     call    = (Call) service.createCall();
> >
> > call.setTargetEndpointAddress( new java.net.URL(endpoint) );
> > call.setOperationName( "getObject" );
> >
> > QName    qn      = new QName( "urn:TestWebService", "User" );
> >
> > call.registerTypeMapping(User.class, qn,
> >                       new
> > org.apache.axis.encoding.ser.BeanSerializerFactory(User.class, qn),
> >                       new
> > org.apache.axis.encoding.ser.BeanDeserializerFactory(User.class, qn));
> >
> > call.setReturnType(qn);
> >
> > User usr = (User) call.invoke( new Object [] {});
> >
> >
> > Now when I run this class to call the service and get me the user object
I
> > get the following error
> >
> > - Could not convert java.lang.String to bean field 'password', type
> > java.lang.String
> >     [junit] - Exception:
> >     [junit] java.lang.NullPointerException
> >     [junit]  at
> org.apache.axis.encoding.ser.BeanPropertyTarget.set(Unknown
> > Source)
> >     [junit]  at
> > org.apache.axis.encoding.DeserializerImpl.valueComplete(Unknown Source)
> >     [junit]  at
> org.apache.axis.encoding.DeserializerImpl.endElement(Unknown
> > Source)
> >     [junit]  at
> > org.apache.axis.encoding.DeserializationContextImpl.endElement(Unknown
> > Source)
> >     [junit]  at org.apache.axis.message.SAX2EventRecorder.replay(Unknown
> > Source)
> >     [junit]  at
> > org.apache.axis.message.MessageElement.publishToHandler(Unknown Source)
> >     [junit]  at
> > org.apache.axis.encoding.DeserializerImpl.startElement(Unknown Source)
> >     [junit]  at
> > org.apache.axis.encoding.DeserializationContextImpl.startElement(Unknown
> > Source)
> >     [junit]  at org.apache.axis.message.SAX2EventRecorder.replay(Unknown
> > Source)
> >     [junit]  at
> > org.apache.axis.message.MessageElement.publishToHandler(Unknown Source)
> >     [junit]  at org.apache.axis.message.RPCElement.deserialize(Unknown
> > Source)
> >     [junit]  at org.apache.axis.message.RPCElement.getParams(Unknown
> Source)
> >     [junit]  at org.apache.axis.client.Call.invoke(Unknown Source)
> >     [junit]  at org.apache.axis.client.Call.invoke(Unknown Source)
> >     [junit]  at org.apache.axis.client.Call.invoke(Unknown Source)
> >     [junit]  at com.ardec.ebf.test.TestWsClient.testGetObject(Unknown
> > Source)
> >     [junit]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >     [junit]  at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> > )
> >     [junit]  at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> > .java:25)
> >     [junit]  at java.lang.reflect.Method.invoke(Method.java:324)
> > .
> > .
> > .
> > .
> >
> > I have tried to follow the example 5 and I know there are many of you
who
> > have tried to return a Java object from the webservice. Please check my
> wsdd
> > and client class. What am I doing wrong here. Please help me.
> >
> > Thanks a lot
> > Vaishakhi

Reply via email to