Hi Jason,
What you need to do is define your own serializer/deserializer that knows
how to convert your objects from/to XML. You do this implementing the
org.apache.axis.encoding.Serializer and
org.apache.axis.encoding.Deserializer interfaces. If you take a look at
the source for org.apach.axis.encoding.ser.BeanSerializer and
org.apache.axis.encoding.ser.BeanDeserializer, you'll see how to accomplish
this.
Once you've got your serailizer and deserializer implemented, provide
Factory classes for each (see org.apache.axis.encoding.SerializerFactory,
org.apache.axis.encoding.DeserializerFactory). Once you have the factories
implemented, you can register them within your WSDD using the typeMapping
element.
Example:
<typeMapping languageSpecificType
="java:net.bankone.midrange.emmis.asset.Hardware"
qname="ns3:Hardware" xmlns:ns3="http://emmis.bankone.net"
serializer
="net.bankone.midrange.emmis.ws.InterfaceSerializerFactory"
deserializer
="net.bankone.midrange.emmis.ws.InterfaceDeserializerFactory"/>
On the client side, you can also register them with a Call object
(org.apache.axis.client.Call) using one of the registerTypeMapping()
methods.
Let me know if you need any help figuring out the Serializer/Deserializer
interfaces.
Ian
Jason
McCormick To: [EMAIL PROTECTED]
<[EMAIL PROTECTED] cc:
com> Subject: Non-Bean Object Serialization
01/21/2004
01:37 PM
Please respond
to axis-user
Greetings everyone. I'm trying to use AXIS to extend a client-server
app we have to start using SOAP as the transport and I'm running into a
problem creating the WSDL. We have a quantity of code that are not
beans for one reason or another and I'm trying to figure out how to
send these over SOAP (note: I can't edit these objects to turn them
into beans). The objects are all serializable.
I've written a wrapper class around the current interfaces and I'm
attempting to run Java2WSDL to create the WSDL and I'm getting errors
like the following:
- The class com.lexi.publish.datamgr.SectionType does not contain a
default constructor, which is a requirement for a bean class. The
class cannot be converted into an xml schema type. An xml schema
anyType will be used to define this class in the wsdl file.
Then whenever I try to use WSDL2Java to create the skeleton code and to
make the WSDDs I get errors stating that {urn:Server}SectionType is
referenced but not defined.
I guess I'm not seeing how you deal with non-bean objects you're
trying to serialize. Do I need to not use Java2WSDL and WSDL2Java?
How else can you generate the wsdl and wsdd or do you write them by
hand?
I see from the documentation there are a number of other seralizers
native to AXIS and there's a statement in the docs about writing your
own seralizer and registering it in AXIS. However I'm unclear from the
documentation for AXIS how you go about defining how objects that don't
fit into the Bean[De]Serializer factory/class types can be serialized
successfully in AXIS and AXIS's components be made aware of this,
especially via Java2WSDL and WSDL2Java.
Thanks in advance for the thoughts and time. If I need to clarify
something, please let me know. I've been beating my head against this
for several days
Thanks
-- Jason McCormick
This transmission may contain information that is privileged, confidential and/or
exempt from disclosure under applicable law. If you are not the intended recipient,
you are hereby notified that any disclosure, copying, distribution, or use of the
information contained herein (including any reliance thereon) is STRICTLY PROHIBITED.
If you received this transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard copy format. Thank
you.