Return-Path: Mailing-List: contact axis-user-help@xml.apache.org; run by ezmlm Delivered-To: mailing list axis-user@xml.apache.org Delivered-To: moderator for axis-user@xml.apache.org Received: (qmail 37512 invoked from network); 3 Mar 2002 04:14:33 -0000 Received: from relay.sdsc.edu (132.249.20.66) by daedalus.apache.org with SMTP; 3 Mar 2002 04:14:33 -0000 Received: from ivanpc (ivan-pc.sdsc.edu [132.249.96.143]) (authenticated (0 bits)) by relay.sdsc.edu (8.11.1/8.11.1/SDSCrelay/8) with ESMTP id g234EfT05115 (using TLSv1/SSLv3 with cipher RC4-MD5 (128 bits) verified NO); Sat, 2 Mar 2002 20:14:43 -0800 (PST) Message-ID: <000a01c1c269$f1c9e6a0$8f60f984@sdsc.edu> From: "Frank van Lingen" To: Cc: Subject: bean serialization problem. Receiving null values on client side Date: Sat, 2 Mar 2002 20:14:39 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0007_01C1C226.E1AD47A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C1C226.E1AD47A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I am trying to build a simple example using bean serialization, based on = the examples from Axis. I want to transfer two values of type String = from my service to my client using an object that contains two strings. = However my client receives only objects with null values. The following object is used for transfer: public class MyStartNowTransferObject { protected String S1; protected String S2; public MyStartNowTransferObject() { } public MyStartNowTransferObject(String a, String b) { S1=3Da; S2=3Db; } .......+ some get and set methods } At the service side I have this method: public MyStartNowTransferObject getStrings() { MyStartNowTransferObject TO=3Dnew MyStartNowTransferObject(S1,S2); // S1 and S2 are public static strings of the service side object return TO; } My wsdd file looks like this: The client side has the following piece of code to get a = MyStartNowTransferObject. This code is based on example5 of the = userguide and the bid example of Axis. public static MyStartNowTransferObject getStrings(String endpointURL) = throws Exception =20 { Service service =3D new Service(); Call call =3D (Call) service.createCall(); call.setTargetEndpointAddress( new = java.net.URL(endpointURL) ); =20 QName qn =3D new QName( "MyStartNowService", = "MyStartNowTransferObject" );=20 =20 Class cls =3D MyStartNowTransferObject.class; call.addSerializer(cls, qn, new BeanSerializer(cls));=20 call.addDeserializerFactory(qn, cls, = BeanSerializer.getFactory());=20 =20 call.setOperationName( "getStrings" );=20 call.setProperty( Call.NAMESPACE, "MyStartNowService" ); MyStartNowTransferObject result =3D = (MyStartNowTransferObject) call.invoke( new Object[] {} ); return result; } Everything works, except that the string values of the = MyStartNowTransferObject on the client side have value null after the = service is invoked, while I know that when the getStrings method is = invoked on the serverside, the MyStartNowTransferObject created on the = serverside has the required not null values. I also have some methods on the clientside that do get and sets on the = server side using strings (so not serialization). This works fine. Is there anybody with similar problem or has a solution? Frank van Lingen ------=_NextPart_000_0007_01C1C226.E1AD47A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I am trying to build a simple example using bean serialization, = based on=20 the examples from Axis. I want to transfer two values of type String = from my=20 service to my client using an object that contains two strings. However = my=20 client receives only objects with null values.
 
The following object is used for transfer:
 
public class=20 MyStartNowTransferObject
{
      = protected String=20 S1;
      protected String S2;
 
      public=20 MyStartNowTransferObject()
     =20 {
      }
 
      public = MyStartNowTransferObject(String a,=20 String b)
     =20 {
      =20 S1=3Da;
      =20 S2=3Db;
      = }
     =20 .......+ some get and set methods
}
 
At the service side I have this method:
 
public MyStartNowTransferObject getStrings()
   =20 {
     MyStartNowTransferObject TO=3Dnew=20 MyStartNowTransferObject(S1,S2);
     // S1 and = S2 are=20 public static strings of the service side = object
    =20 return TO;
    }
 
My wsdd file looks like this:
 
<deployment xmlns=3D"http://xml.apache.org/axis/wsdd= /"
          &nb= sp;=20 xmlns:java=3D"http://xml.apache= .org/axis/wsdd/providers/java">
 
 <service name=3D"MyStartNowService"=20 provider=3D"java:RPC">
  <parameter name=3D"className"=20 value=3D"samples.userguide.MyStartNow.MyStartNowService"/>
 =20 <parameter name=3D"methodName" value=3D"*"/>
 
 <beanMapping qname=3D"myNs:MyStartNowTransferObject"=20
           &nb= sp;  =20 xmlns:myNs=3D"MyStartNowService"
      &= nbsp;       languageSpecificType=3D"ja= va:samples.userguide.MyStartNow.MyStartNowTransferObject"/>
 
 </service>
 </deployment>
 
The client side has the following piece of code to get a=20 MyStartNowTransferObject. This code is based on example5 of the = userguide and=20 the bid example of Axis.
 
public static MyStartNowTransferObject getStrings(String = endpointURL)=20 throws Exception
   
   =20 {
        Service  service = =3D new=20 Service();
       =20 Call     call    =3D (Call)=20 service.createCall();
        =       =20 call.setTargetEndpointAddress( new java.net.URL(endpointURL)=20 );
           &= nbsp;  =20
        QName   =20 qn      =3D new QName( "MyStartNowService",=20 "MyStartNowTransferObject" );
     =20
        Class cls =3D=20 MyStartNowTransferObject.class;
      &n= bsp;=20 call.addSerializer(cls, qn, new BeanSerializer(cls));=20
           &nb= sp;  =20 call.addDeserializerFactory(qn, cls, BeanSerializer.getFactory());=20
      =20
        call.setOperationName(=20 "getStrings" );
        = call.setProperty(=20 Call.NAMESPACE, "MyStartNowService"=20 );
           &= nbsp;  =20 MyStartNowTransferObject result =3D (MyStartNowTransferObject) = call.invoke( new=20 Object[] {} );
 
        return=20 result;
    }
 

Everything works, except that the string values of the=20 MyStartNowTransferObject on the client side have value null after the = service is=20 invoked, while I know that when the getStrings method is invoked on the=20 serverside, the MyStartNowTransferObject created on the serverside has = the=20 required not null values.
 
I also have some methods on the clientside that do get and sets on = the=20 server side using strings (so not serialization). This works fine.
 
Is there anybody with similar problem or has a solution?
 
Frank van Lingen
------=_NextPart_000_0007_01C1C226.E1AD47A0--