You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Andy Foster <an...@fostersontheweb.com> on 2006/01/26 17:28:38 UTC

Serialisation Issue

Hi all,

Sorry to bug you again but I'm finding nothing on the NETE around this at
all

_____________________________________________
From: Andy Foster [mailto:andy@fostersontheweb.com] 
Sent: 25 January 2006 18:04
To: axis-user@ws.apache.org
Subject: Invoking De-Serialisation

Hi all,

The following code takes the generated axis objects for the SRW
explainResponse, returned from the RPC call invoked through axis and
serialises them out to XML

		// obtain the serialiser to return this to XML
		QName explainQName = new
QName("http://www.loc.gov/zing/srw/", "explainResponse");
		Serializer responseSer =
ExplainResponseType.getSerializer(null, ExplainResponseType.class,
explainQName);

		StringWriter responseWriter = new StringWriter();
		SerializationContext context = new
SerializationContext(responseWriter);
		context.setPretty(false);
		responseSer.serialize(explainQName, null, response,
context);

		String SRWResult = responseWriter.getBuffer().toString();
            
This code all works perfectly fine, my problem is that I now need to do the
reverse operation and wish to use the axis generated classes.

Points to note:

1.	In the example above axis binding stubs were invoked first, the
server called and the serialisation performed on the returned objects from
axis
2.	In this scenario this will not have happened I just want to use the
deserialisation code generated by axis to recreate the objects from XML and
not invoke any RPC calls/ binding stub code, hence I'm concerned that some
of the QNames may not have been registered correctly for the process to work

So with these in mind I know I must at least do the following

		QName explainQName = new
QName("http://www.loc.gov/zing/srw/"," explainResponse ");
		Deserializer ser = ExplainResponseType.getDeserializer(null,
ExplainResponseType.class, explainQName);

However, what do I need to now to turn my XML back into a fully populated
ExplainResponseType object?

Regards

Andy Foster