axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinadh Karumuri <skaru...@bbn.com>
Subject RE: returning arrays of custom java objects
Date Wed, 11 May 2005 19:11:14 GMT
Ben,

Thanks for your reply. You gave me a ray of hope.
I am still getting the SAXException. I am not sure if I am calling it right 
in the client code.
I gave my details below.

PART of SaxException:
12:06:46,484 ERROR Call:2274 - Exception:
org.xml.sax.SAXException: No deserializer defined for array type 
{EmployeeLateTSSingle}EmployeeLateTSBean
at 
org.apache.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:304)
at 
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
at 
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at 
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.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 com.bbn.ws.EmployeeDataClient.main(EmployeeDataClient.java:84)
AxisFault
  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
:
:

PART of server-config.wsdd:
  <service name="EmployeeDataService" provider="java:RPC">
   <requestFlow>
    <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
   </requestFlow>
   <responseFlow>
    <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
   </responseFlow>
   <parameter name="allowedMethods" value="getEmployeeLateTSDataArray"/>
   <parameter name="scope" value="application"/>
   <parameter name="className" value="com.bbn.ws.EmployeeDataService"/>
   <beanMapping type="java:com.bbn.ws.EmployeeLateTSBean"
                qname="ns1:EmployeeLateTSBean"
                    xmlns:ns1="EmployeeLateTSSingle"/>
   <typeMapping qname="ns1:EmployeeLateTSBeanArray"
              xmlns:ns1="EmployeeLateTSArray"
              type="java:com.bbn.ws.EmployeeLateTSBean[]"
                 deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" 

                 serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" 

              encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
  </service>

WSDL:
   <wsdl:definitions 
targetNamespace="http://localhost:8080/bserv/services/EmployeeDataService">
         <wsdl:types>
         <schema targetNamespace="EmployeeLateTSSingle">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
         <complexType name="EmployeeLateTSBean">
         <sequence>
<element name="daysLate" nillable="true" type="xsd:decimal"/>
<element name="employeeFirstname" nillable="true" type="xsd:string"/>
<element name="employeeLastname" nillable="true" type="xsd:string"/>
<element name="employeeNumber" nillable="true" type="xsd:decimal"/>
<element name="totalCompliance" nillable="true" type="xsd:decimal"/>
</sequence>
</complexType>
</schema>
         <schema targetNamespace="EmployeeLateTSArray">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
         <complexType name="EmployeeLateTSBeanArray">
         <complexContent>
         <restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:EmployeeLateTSBean[]"/>
</restriction>
</complexContent>
</complexType>
</schema>
</wsdl:types>
         <wsdl:message name="getEmployeeLateTSDataArrayResponse">
<wsdl:part name="getEmployeeLateTSDataArrayReturn" 
type="tns2:EmployeeLateTSBeanArray"/>
</wsdl:message>
         <wsdl:message name="getEmployeeLateTSDataArrayRequest">
<wsdl:part name="admnum" type="xsd:int"/>
<wsdl:part name="mgrnum" type="xsd:int"/>
</wsdl:message>
         <wsdl:portType name="EmployeeDataService">
         <wsdl:operation name="getEmployeeLateTSDataArray" 
parameterOrder="admnum mgrnum">
<wsdl:input message="impl:getEmployeeLateTSDataArrayRequest" 
name="getEmployeeLateTSDataArrayRequest"/>
<wsdl:output message="impl:getEmployeeLateTSDataArrayResponse" 
name="getEmployeeLateTSDataArrayResponse"/>
</wsdl:operation>
</wsdl:portType>
         <wsdl:binding name="EmployeeDataServiceSoapBinding" 
type="impl:EmployeeDataService">
<wsdlsoap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/>
         <wsdl:operation name="getEmployeeLateTSDataArray">
<wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getEmployeeLateTSDataArrayRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://ws.bbn.com" use="encoded"/>
</wsdl:input>
         <wsdl:output name="getEmployeeLateTSDataArrayResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
namespace="http://localhost:8080/bserv/services/EmployeeDataService" 
use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
         <wsdl:service name="EmployeeDataServiceService">
         <wsdl:port binding="impl:EmployeeDataServiceSoapBinding" 
name="EmployeeDataService">
<wsdlsoap:address 
location="http://localhost:8080/bserv/services/EmployeeDataService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

CLIENT Code:
String method = args[0];
String arg1;
String arg2;
Service service = new Service();
Call call = (Call) service.createCall();
QName qname = null;
Class cls = null;
qname = new QName("EmployeeLateTSDataArray", "EmployeeLateTSBeanArray");
arg1 = args[1];
arg2 = args[2];
cls = EmployeeLateTSBean[].class;
call.registerTypeMapping (cls,
   qname,
   ArraySerializerFactory.class,
   ArrayDeserializerFactory.class);
call.setReturnType (qname);
//call.setReturnClass(cls);
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(method);
call.addParameter("admnum", XMLType.XSD_INTEGER, ParameterMode.IN);
call.addParameter("mgrnum", XMLType.XSD_INTEGER, ParameterMode.IN);
call.setReturnType(qname);
EmployeeLateTSBean e[] = (EmployeeLateTSBean[]) call.invoke(new Object[] { 
new Integer(22624), new Integer(8524) }); //arg1, arg2 });

System.out.println("Got result : " + e[0].getEmployeeNumber() + " " + 
e[0].toCSVString());

Thanks for any help,
-Sri

At 10:28 AM 5/10/2005, Benjamin.Temko@VerizonWireless.com wrote:
>Sri,
>
>I battled this same malady only a few days ago.  What worked for me was 
>finally figuring out the magic incantation required in the <typeMapping> 
>section.  What I am doing is to put in my server-config.wsdd file a line 
>which looks like this, for the single-value return:
>
><typeMapping
>     deserializer="your.special.class.package.TypeDeserFactory"
>     serializer="your.special.class.package.TypeSerFactory"
>     type="java:your.special.class.package.Type"
> 
>encodingStyle="<http://schemas.xmlsoap.org/soap/encoding/>http://schemas.xmlsoap.org/soap/encoding/"

>
>     qname="ns1:Type"
>     xmlns:ns1="http://com.vzw.sane5.util.configuration"/>
>
>  <typeMapping
>      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
>      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
>      type="java:your.special.class.package.Type[]"
> 
>encodingStyle="<http://schemas.xmlsoap.org/soap/encoding/>http://schemas.xmlsoap.org/soap/encoding/"

>
>      qname="ns1:TypeArray"
>      xmlns:ns1="http://your.special.class.package"/>
>If you want this to work for all services then put it under the 
><deployment> tag *not* in any service.  If you want it only to work for a 
>specific service, put it in that service's <service> tag, which means you 
>can put it in the service's WSDD file for when you deploy it.
>
>Hope this helps!
>
>Best,
>
>Ben
>
>
>  -----Original Message-----
>From: Srinadh Karumuri [mailto:skarumur@bbn.com]
>Sent: Monday, May 09, 2005 6:44 PM
>To: axis-user@ws.apache.org
>Subject: returning arrays of custom java objects
>
>I am a newbie to Axis1.1. I was able to return a custom object but 
>couldn't figure out sending arrays of custom object across using the 
>ArraySerializer.
>
>
>
>___________________________________________________________________
>The information contained in this message and any attachment may be
>proprietary, confidential, and privileged or subject to the work
>product doctrine and thus protected from disclosure.  If the reader
>of this message is not the intended recipient, or an employee or
>agent responsible for delivering this message to the intended
>recipient, you are hereby notified that any dissemination,
>distribution or copying of this communication is strictly prohibited.
>If you have received this communication in error, please notify me
>immediately by replying to this message and deleting it and all
>copies and backups thereof.  Thank you.
>

Mime
View raw message