axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Chabanois <CChaban...@cognicase.fr>
Subject RE: Serializing / Deserializing
Date Tue, 19 Nov 2002 10:16:35 GMT
Hi,

I have passed a bean to an EJB (stateless) as a webservice and got a result
back ....

My bean was very simple though (only simple types, no HashMap)

In the server wsdd file, I put a beanMapping
 <beanMapping qname="ns:SEG1Bean" xmlns:ns="http://soapNcl/TEST1/"
 
languageSpecificType="java:fr.cognicase.webservices.COMMON.SEG1Bean"/>

I don't have any client wsdd file : I used wsdl2java to generate the client.


I used JBoss, but not Jboss.net.

Cédric Chabanois

> 
> Hi Again,
> I'm really sorry to go on about this issue on this list but 
> its driving me mad, I have been looking at this for over a 
> week now. I have even got the Axis source code and hacked 
> around with it so I can see at least which classes are doing 
> roughly what. Now... I notice there is a Macromedia engineer 
> on this list, and since you guys have successfully 
> intergrated Axis into both CFMX and Jrun 4 perhaps you will 
> be able to help with me with my ( ongoing ) problem, which is:
> 
> No matter what I put in the client and the wsdd file the 
> DeSerializer for my bean cannot be found. The bean has two 
> properties, a String and a HashMap and it is serialized fine 
> ( I have seen the resultant SOAP via tcpmon ), however Axis 
> always fails to deserialize the return frm the EJB that I am 
> calling as a webservice ( the EJB is a stateless session bean 
> ). The bean I am serializing , the (de)serializer factories 
> and the actual (de)serializers all seem to be ok, the EJB ( 
> deployed in JBoss ) works fine to. The EJB client I wrote to 
> test the EJB works too ( so the EJB is managing to enocode the bean ).
> 
> I am desperate here, and the thing is , it seems like a 
> relatively simple thing I am trying to do....
> 
> If someone just tells me they have passed a bean to an EJB as 
> a webservice and got a result back......well I'll keep trying.
> 
> 
> Regards in desperation
> 
> Russell
> 
> -----Original Message-----
> From: Russell Brown 
> Sent: 18 November 2002 09:12
> To: axis-user@xml.apache.org
> Subject: RE: Serializing / Deserializing
> 
> 
> Ben,
> I am, just here:
> 
>  call.registerTypeMapping(ArgumentSet.class, qn, 
> FSSerializerFactory.class, FSDeserializerFactory.class, t);
> 
> and yes, the ArgumentSet class ( that is the bean ) is 
> available as I make one and pass it to the webservice in the 
> call ( it is correctly serialized by the way, I have seen the 
> resulting SOAP with tcpmon )
> 
> 
> 
> HashMap ht = new HashMap(5);
> ht.put("postcode","LS176PJ");
> ht.put("addressLine1","2");
> 
> //create ArgumentSet
> ArgumentSet as = new ArgumentSet();
> as.setIdentifier("lookupPostCode");
> as.setArguments(ht);
> 
> 
> result = (ArgumentSet) call.invoke( new Object[] { as } );
> 
> 
> It is only the deserialization of the returned ArgumentSet 
> that is an issue. To be honest its driving me mad, I 'm going 
> to write a simple bean that returns a string and see how that 
> works, then I'll try a bean with simple values for its fields 
> ( Strings and Ints ) , if that works I'll blame it on the HashMap.
> 
> Cheers
> 
> Russell
> 
> -----Original Message-----
> From: Ben Souther [mailto:bsouther@fwdco.com]
> Sent: 15 November 2002 17:54
> To: axis-user@xml.apache.org
> Subject: Re: Serializing / Deserializing
> 
> 
> Are you calling:  call.registerTypeMapping(args...) anywhere 
> in your code?
> Is the class file for you javabean available to your client?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Friday 15 November 2002 12:46 pm, Russell Brown wrote:
> > Cheers ben,
> >
> > That is pretty much line for line what I have, except that 
> the service
> > provider is java:EJB and maybe that is where my problem is. 
> It migt be the
> > marshalling at the EJB end that is returning the wrong 
> type. I just don't
> > know enough about this to debug it. I have got the Axis 
> source code and am
> > reading through the stack trace trying to figure out why 
> this works in the
> > client
> >
> > TypeMapping tm = call.getTypeMapping();
> > DeserializerFactory dsf =
> > 
> (org.apache.axis.encoding.DeserializerFactory)tm.getDeserializer(qn);
> > if(dsf != null) {
> >  FSDeserializer fsd =
> > 
> (com.freeserve.fsmap.encoding.FSDeserializer)dsf.getDeserializ
> erAs(Constant
> >s.AXIS_SAX); }
> >
> > but not in the RPCHandler class ( where the error is being thrown )
> >
> > if (dser == null) {
> > //hack this to get our deserializer:
> > //*****************************************************
> >
> > TypeMapping tmfs = context.getTypeMapping();
> > DeserializerFactory dsf =
> > 
> (org.apache.axis.encoding.DeserializerFactory)tmfs.getDeserial
> izer(qname);
> > if(dsf != null) {
> > 	dser =
> > 
> (org.apache.axis.encoding.Deserializer)dsf.getDeserializerAs(C
> onstants.AXIS
> >_SAX); } else {
> > 	System.out.println("Still couldn't find it!!!");
> > throw new SAXException(Messages.getMessage("noDeser01", 
> localName,"" +
> > type)); }
> >
> > //*****************************************************
> >  //end hack
> > }
> >
> >
> > So, thanks for your help, I'll post to the list if I can 
> find out what is
> > going wrong with my code .
> >
> > Regards
> >
> > Russell
> >
> > -----Original Message-----
> > From: Ben Souther [mailto:bsouther@fwdco.com]
> > Sent: 15 November 2002 17:39
> > To: axis-user@xml.apache.org
> > Subject: Re: Serializing / Deserializing
> >
> >
> >
> > This is up and working with Axis 1.0. on tomcat 4.1.12.
> > I'm sorry if it's sloppy.
> > Good luck.
> >
> >
> >
> >
> > From the WSDD:
> >
> >  <service name="PayrollSummaryService" provider="java:RPC">
> >      <parameter name="className"          
> > 
> value="com.someone.somwhere.service.PayrollSummaryService"/> 
> <parameter
> > name="allowedMethods" value="*" />
> >
> >      <beanMapping qname="ns1:PayrollSummaryDataBean"
> >                   
> xmlns:ns1="com.someone.somewhere.payrollsummary.shared"
> >                  
> > 
> languageSpecificType="java:com.someone.somewhere.payrollsummar
> y.shared.Payr
> >ollSummaryDataBean" />
> >
> >      <beanMapping qname="ns1:EmployeeListDataBean"
> >                   
> xmlns:ns1="com.someone.somewhere.payrollsummary.shared"
> >                  
> > 
> languageSpecificType="java:com.someone.somewhere.payrollsummar
> y.shared.Empl
> >oyeeListDataBean" /> </service>
> >
> >
> >
> >
> > From the client:
> >
> >
> >                   try{
> >     112             Service service = new Service();
> >     113             Call    call    = (Call)service.createCall();
> >     114             call.setTargetEndpointAddress(
> >     115                 new URL(_payrollSummaryServiceURL));
> >     116
> >     117             QName qName = new QName(
> >     118                 "PayrollSummaryService",
> >     119                 "getPayrollSummaryData"
> >     120             );
> >     121             call.setOperationName(qName);
> >     122
> >     123             //
> >     124             // The QName for mapping the 
> PayrollSummaryDataBean
> >     125             // to the return value from the web service.
> >     126             //
> >     127             QName returnQName = new QName(
> >     128                 
> "com.someone.somewhere.payrollsummary.shared",
> >     129                 "PayrollSummaryDataBean"
> >     130             );
> >     131
> >     132             call.registerTypeMapping(
> >     133                 PayrollSummaryDataBean.class,
> >     134                 returnQName,
> >     135                 new BeanSerializerFactory(
> >     136                     PayrollSummaryDataBean.class,
> >     137                     returnQName
> >     138                 ),
> >     139                 new BeanDeserializerFactory(
> >     140                     PayrollSummaryDataBean.class,
> >     141                     returnQName
> >     142                 )
> >     143             );
> >     144
> >     145             call.setReturnType(
> >     146                 returnQName,
> >     147                 PayrollSummaryDataBean.class
> >     148             );
> >     149
> >     150             System.out.println("period: " + _period);
> >     151
> >     152             _dataBean = (PayrollSummaryDataBean)call.invoke(
> >     153                 new Object[]{
> >     154                         _clientID,
> >     155                         _employeeID,
> >     156                         _period,
> >     157                         _year
> >     158                 }
> >     159             );
> >     160         }catch(Exception e){
> >     161             System.out.println(
> >     162                 "Error in PayrollSummaryBean: "
> >     163                 + e
> >     164             );
> >     165         }
> >     16
> >
> > On Friday 15 November 2002 11:42 am, Russell Brown wrote:
> > > Hi,
> > >
> > > Has anyone on this list managed to serialize AND 
> deserialize a bean with
> > > Axis's bean serializer or there own custom serializer / 
> deserializer ever
> > > ?
> > >
> > > Just to know that it has been done once will fill me with 
> a renewed hope.
> > > If you can tell me how you side stepped the ubiquitous 
> error (Error :
> > > org.xml.sax.SAXException: Deserializing parameter 'arg1': 
>  could not find
> > > deserializer for type ANYTYPEWHATSOEVEREXCEPTPRIMATIVES) 
> as well I may
> > > very well weep with joy.
> > >
> > > Many thanks
> > >
> > > Russell
> > >
> > > PS check this out:
> > >
> > >  call.registerTypeMapping(ArgumentSet.class, qn,
> > > FSSerializerFactory.class, FSDeserializerFactory.class, t);
> > >
> > >  TypeMapping tm = call.getTypeMapping();
> > >  boolean isit = tm.isRegistered(ArgumentSet.class, qn);
> > >
> > >  System.out.println("Well isit ? : "+isit);
> > >
> > > DeserializerFactory dsf =
> > > 
> (org.apache.axis.encoding.DeserializerFactory)tm.getDeserializer(qn);
> > >
> > > if(dsf != null) {
> > > 	FSDeserializer fsd =
> > > 
> (com.freeserve.fsmap.encoding.FSDeserializer)dsf.getDeserializ
> erAs(Consta
> > >nt s.AXIS_SAX); }
> > >
> > > all works, yes I can find the f***** deserializer but 
> AxisEngine cannot:
> > > anyone, anyone ??
> > >
> > > RB
> 

Mime
View raw message