axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Souther" <bsout...@fwdco.com>
Subject Re: BeanSerializer
Date Tue, 13 Aug 2002 13:40:34 GMT

  ----- Original Message ----- 
  From: Ben Souther 
  To: axis-user@xml.apache.org 
  Sent: Tuesday, August 13, 2002 9:38 AM
  Subject: BeanSerializer


  Can anyone point me to an example of a Java client that calls a webservice who's return
type is a JavaBean?
  I've looked at  samples/userguide/example5/BeanService.java. in the samples section of Axis.
This example demonstrates how to send a bean as an argument but doesn't show how to recieve
one as a returnType.


  Here is my attempt:
   try{
              String  endpoint = "http://localhost:8080/axis/services/EmployerService";
              Service service  = new Service();
              System.out.println("service Created");
              
              Call  call = (Call)service.createCall();
              System.out.println("Call Created");
              
              call.setTargetEndpointAddress(new java.net.URL(endpoint));
              QName qn = new QName("EmployerService", "getEmployerData");
              call.setOperationName(qn);
              
              System.out.println("ready to invoke call....");
              
              EmployerBean employerBean = (EmployerBean)call.invoke(new Object[]{"1"});
              System.out.println("Call invoked...");
              
              if(employerBean == null)
                  System.out.println("EmployerBean is null");
              
              String employerName = employerBean.getEmployerName();
              System.out.println("Name: " + employerName);
          }catch(Exception e){
              System.out.println("Error: " + e.toString());
          }
      }


  Here is the error that I am fighting with:

  - Exception:
  org.xml.sax.SAXException: Deserializing parameter 'getEmployerDataReturn':  could not find
deserializer for type {com.fwdco.shared}EmployerBean
          at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:231)
          at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:857)
          at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
          at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:644)
          at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:235)
          at org.apache.axis.message.RPCElement.getParams(RPCElement.java:259)
          at org.apache.axis.client.Call.invoke(Call.java:1806)
          at org.apache.axis.client.Call.invoke(Call.java:1711)
          at org.apache.axis.client.Call.invoke(Call.java:1251)
          at ReadEmployer.main(ReadEmployer.java:35)
  Error: org.xml.sax.SAXException: Deserializing parameter 'getEmployerDataReturn':  could
not find deserializer for type {com.fwdco.shared}EmployerBean



  Here is my WSDD:

  <deployment xmlns="http://xml.apache.org/axis/wsdd/"
              xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

       <service name="EmployerService" provider="java:RPC">
        <parameter name="className"      value="EmployerService"/>
        <parameter name="allowedMethods" value="*"/>
      
        <beanMapping qname="ns1:EmployerBean" xmlns:ns1="com.fwdco.shared"
               languageSpecificType="java:com.fwdco.shared.EmployerBean" />
               
       </service>

  </deployment>


  I'm using Tomcat 4.0.3 


  Thank you.



Mime
View raw message