I'm currently serializing/deserializing java objects...using doc/literal
WSDL.
Here are the steps I took.
1. Create a java class (should be just a container with getters and
setters) that implements java.io.Serializable.
2. Client: Before calling the invoke method call the registerTypeMapping
method on the call object to register you class with an appropriate
serializer/deserializer.
DTSRequestRouting is my container class.
QName qn = new
QName("http://www.datatransportstandard.com","DTSRequestRouting");
_call.registerTypeMapping(DTSRequestRouting.class,
qn,
new BeanSerializerFactory(DTSRequestRouting.class, qn),
new BeanDeserializerFactory(DTSRequestRouting.class, qn));
3. Service: Modify your deployment descriptor (.wsdd) file to include
beanMapping elements for all of the objects you need to
serialize/deserialize and deploy the service.
<beanMapping xmlns:myNS="http://www.datatransportstandard.com"
qname="myNS:DTSRequestRouting"
languageSpecificType="java:com.datatransportstandard.www.utils.DTSRequestRouting"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"/>
We use this object in the SOAP Header to determine routing information.
I'm certainly not an expert, but this works for us.
Hopefully, this helps.
Mark A. Malinoski
AES/PHEAA
Technical Coordinator/Web Development
717-720-2413
[EMAIL PROTECTED]
"Levy, Avi"
<[EMAIL PROTECTED]
te.wi.us> To
"'[EMAIL PROTECTED]'"
11/23/2004 10:11 <[EMAIL PROTECTED]>
AM cc
Subject
Please respond to RE: Using a serializer and
[EMAIL PROTECTED] deserializer
he.org
This helps. Thanks.
However, I'm stil vage on how to deserialize XML into java objects
(predefined classes).
Thanks,
-- AV
-----Original Message-----
From: toby cabot [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 23, 2004 8:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Using a serializer and deserializer
Don't know about any docs or tutorials but something like...
void axisSerialize(Object report, Writer whereTo) throws IOException {
SerializationContext ser = new SerializationContext(whereTo);
ser.setPretty(true);
ser.setSendDecl(true);
AttributesImpl ns = new AttributesImpl();
// add attributes here
ser.serialize(new QName("elementName"), ns, report, null,
Boolean.FALSE, Boolean.FALSE);
whereTo.flush();
}
... should get you pretty close. Make sure that you're using the latest
and
greatest Axis as there have been a few bugs fixed recently.