Hi folks, As Chris's previous mail, it seems like when sending SOAP message, Celtix binding delegates the java2xml conversion to SDO binding, and the SDO binding converts SDO object to xml using Object.toString() (to our surprise).
Therefore, the resulting SOAP message is something like: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <p0:getPatient xmlns:p0="http://www.foo.com/bar"> <p0:patient> [EMAIL PROTECTED] (Id: 0, Dob: null, FirstName: Li, Gender: null, LastName: Shen, MiddleName: null, Phone: null, Ssn: null) </p0:patient> </p0:getPatient> </SOAP-ENV:Body> </SOAP-ENV:Envelope> The content inside <patient/> is the string generated from Patient.toString(), but the expected elements inside <patient/> should conform to the schema in WSDL: <xs:complexType name="Patient"> <xs:sequence> <xs:element minOccurs="1" name="Id" nillable="true" type="xs:int"/> <xs:element minOccurs="1" name="Dob" nillable="true" type="xs:dateTime"/> <xs:element minOccurs="1" name="FirstName" nillable="true" type="xs:string"/> <xs:element minOccurs="1" name="Gender" nillable="true" type="xs:string"/> <xs:element minOccurs="1" name="LastName" nillable="true" type="xs:string"/> <xs:element minOccurs="1" name="MiddleName" nillable="true" type="xs:string"/> <xs:element minOccurs="1" name="Phone" nillable="true" type="xs:string"/> <xs:element minOccurs="1" name="Ssn" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType> I found the toString conversion is done at SDOUtil. convertToString(Type dataType, Object value) which eventually calls into ModelFactoryImpl. convertToString(EDataType eDataType, Object instanceValue), and then object. toString() gets called. Finally the string is returned to DataObjectXMLStreamReader and Celtix binding gets the string using getText(). This might be caused by misusage of SDO binding, wrong SDO objects generated by tool, or something else? Sounds like in celtix/axis binding, the parameter of service method is added to DataObject using dataObject.set(i, methodParameters[i]), which means the parameter such as Patient object becomes a common object property of the DataObject and then is convert to xml simply using toString()? Could someone familiar with SDO binding provide help on this? Thanks! Regards, Li -----Original Message----- From: Liu, Jervis [mailto:[EMAIL PROTECTED] Sent: 2006年8月30日 12:12 To: [email protected] Subject: RE: How to invoke a web service with complex types? Java object / SDO conversion? Hi Chris, see comments in-line. Cheers, Jervis > -----Original Message----- > From: Chris Wall [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 30, 2006 6:01 AM > To: [email protected] > Subject: Re: How to invoke a web service with complex types? > Java object > / SDO conversion? > > > Hi Raymond. > > In our case, the client is privy to the domain objects - Java objects > (interfaces/classes) - used by the web service. For example, > locally the > client uses org.client.Patient throughout the application. > Before invoking > a web service the client converts org.client.Patient to > org.service.Patient(provided by service provider), and then invokes > the web service passing > org.service.Patient. > > Migrating this code to Tuscany we're finding that SDO handles > the outbound > by converting the Patient object to a String (I think). The > inbound doesn't > convert at all, but instead sends back null. > I am not sure whether or not you are talking about the Celtix binding. It looks like you are referring to the Celtix binding code from last week, I am afraid it was not complete at that stage. But the latest version should allow both inbound and outbound working, I have tested helloworldwsclient sample, it works fine. Please note there is a hack currently in Celtix binding NodeDataReader/NodeDataWriter code. I have to convert SDO object to stream first, then stream to XML Node. This is because Celtix 1.0 does not have a direct support to stax. Problem can be fixed once we move Celtix binding to be based on the latest CeltixFire code base. CeltixFire repository is already available from apache incubator. As Raymond has mentioned, a pluggable databinding framework is under construction at the moment. Before this happens, if you are keen to use other databindings such as JAXB or xmlbeans, you can do so by implementing your own NodeDataReader/NodeDataWriter. Let me know if you need any helps. > It would be cool if the binding layer was able to dynamically > convert a Java > object to a schema type matching the package name and class > name in the > WSDL. This is the ultimate non-invasive approach. > > It sounds as if the WS binding layer for both Axis2 and > Celtix support only > SDO as of today. If this is true, what are the steps to > communicate with a > complex type web service? My guess is: > > 1.) Generate SDO objects from WSDL using tuscany-sdo-plugin. > > 2.) Create a service component (@Service) that matches the > web service's > method signatures. > > 3.) In the application scdl, import the WSDL into SDO > (<import.sdolocation="..."/>). Although, I'm not sure exactly what > this does. > > 4.) In the application scdl, configure the service component with the > binding.ws. > > 5.) Within the client application, convert local Java objects > to SDO object > using the Factory created in #1. > > 6.) Within the client application, locate the service via > Tuscany context > and invoke web service proxy method passing in the SDO object. > > How does that sound? > > -Chris > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
