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 Roger Menday <r....@kfa-juelich.de> on 2002/11/21 14:30:37 UTC

serialization, xsd:any, type mappings - lots of different questions !!!

Hi, 

I have been looking at the samples in the test/wsdl/extensibility
package. My confusions can be illustrated using any of the examples i
think, but this is the one i've been experimenting with. Basically I
want to look at the request in it's component form (and before it's
added to the SOAPEnvelope). I could of course, just use TCPMon to see
all the details, but ..

For example, I take the BookType class generated from the schema
definition in the wsdl, and populate an instance of this class. What are
the programming steps necessary to view the XML representation of this
object (as it would be placed in a SOAP body) ? I think 
SerializationContext, MessageElement, TypeMapping  (and related) play a
big part but I'm not sure how they fit together. 

The following illustrates this a bit better ... 

In the ExtensibilityQueryTestCase class (as I understand it) the client
axis engine is configured in the code (instead of picking up
client-config.wsdd), and the configuration includes type mapping
information. 

The call to the service is :

  ExtensibilityType any = binding.query(expression);

I'm positive that this is not the best way of looking at the XML form of
the response but I tried it, and it does work : 

  MessageElement[] anyContent = any.get_any();
  System.out.println( anyContent[0].toString() );

So, i thought i would do the same for the request parameter, called
'expression'. like ... 

  MessageElement[] anyRequestContent = expression.get_any();
  System.out.println( anyRequestContent[0].toString() );

This gives the following  :

java.io.IOException: No serializer found for class
test.wsdl.extensibility.FindBooksQueryExpressionElement in registry
org.apache.axis.encoding.DefaultTypeMappingImpl@16546ef
	at
org.apache.axis.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:1235)
	at
org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:756)
	at
org.apache.axis.message.MessageElement.outputImpl(MessageElement.java:773)
	at
org.apache.axis.message.MessageElement.output(MessageElement.java:746)


I looked at TestSer.java in samples/encodings. This passes a 
SerializationContext object to the output(..) method of a MessageElement
(SOAPEnvelope) object, which is what's happening after calling the
toString by the looks of the stacktrace above. I realise that
ExtensibilityType is sort of special as it's it can hold any kind of
content (and hence the get_any method returning a MessageElement array).
I confess that i do not understand the details of the the TypeMapping
classes, but I do wonder why the FindBooksQueryExpressionElement object
cannot be serialized, as it does seem to be registered in a type mapping
registry. 

Well, I hope someone managed to sort through all that, and can answer my
questions !!

Thanks, 

Roger