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=a;
       S2=b;
      }
      .......+ some get and set methods
}
 
At the service side I have this method:
 
public MyStartNowTransferObject getStrings()
    {
     MyStartNowTransferObject TO=new MyStartNowTransferObject(S1,S2);
     // S1 and S2 are public static strings of the service side object
     return TO;
    }
 
My wsdd file looks like this:
 
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
 
 <service name="MyStartNowService" provider="java:RPC">
  <parameter name="className" value="samples.userguide.MyStartNow.MyStartNowService"/>
  <parameter name="methodName" value="*"/>
 
 <beanMapping qname="myNs:MyStartNowTransferObject"
               xmlns:myNs="MyStartNowService"
              languageSpecificType="java:samples.userguide.MyStartNow.MyStartNowTransferObject"/>
 
 </service>
 </deployment>
 
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
   
    {
        Service  service = new Service();
        Call     call    = (Call) service.createCall();
               call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
              
        QName    qn      = new QName( "MyStartNowService", "MyStartNowTransferObject" );
     
        Class cls = MyStartNowTransferObject.class;
        call.addSerializer(cls, qn, new BeanSerializer(cls));
               call.addDeserializerFactory(qn, cls, BeanSerializer.getFactory());
      
        call.setOperationName( "getStrings" );
        call.setProperty( Call.NAMESPACE, "MyStartNowService" );
               MyStartNowTransferObject result = (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

Reply via email to