Scott Nichol wrote:

Your objective, as I understood it, was to serialize Java objects as XML
over a proprietary protocol.  You have written the protocol already
(right?), so all you want to do is serialize Java objects as XML.  Given
technologies such as JAXB and Castor that were created to do exactly
that, they seem like a better place to start and are likely to be more
efficient and (hopefully) easier to use.

Scott Nichol

Hello Scott and all others who may help me,

I took a look at Castor and it seams much more complex and harder to use. I think as we plan maybe to later offer web-service-functionality, we'll probably prefer SOAP (actually our protocol is flexible and we can add different serializing forms later).

Now, I really would like to get the Apache SOAP BeanSerializer running. You said, I would get the parameters together myself. Well, I think that I have to admit that I need a bit help:

I think, I start this way:

---------
Config config = Config.getConfig();

BeanSerializer beanSerializer = new BeanSerializer();
XMLJavaMappingRegistry xmlJavaMapReg = new XMLJavaMappingRegistry();
xmlJavaMapReg.setDefaultEncodingStyle(Constants.NS_URI_SOAP_ENC);

xmlJavaMapReg.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("urn:xml-soap-testsoap", "transobj"),
config.getClass(), beanSerializer, beanSerializer
);

//****** Do I really have to register each member object that I want to
//****** transfer here??? Is there no way to use the beanSerializer for
//****** ALL objects per default?
//****** Otherwise I would have to recursively go through all the members
//****** of my object. I really don't want to do this, because it takes
//****** time to analyze the objects recursively, each time before I send it.

NSStack nsStack = new NSStack();
//****** Can I use this object this way or do I have to prepare anything?

SOAPContext soapContext = new SOAPContext();
//****** Can I use this object this way or do I have to prepare anything?

FileWriter fileWriter = new FileWriter("testFile.xml");

beanSerializer.marshall(
Constants.NS_URI_SOAP_ENC,
config.getClass(),
config,
context, //*** What is this???
fileWriter,
nsStack,
xmlJavaMapReg,
soapContext
);

---------

I tried it once with context=config, but this created an empty XML file.

Help would be very appreciated!

Best regards, Marco ;-)




--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to