XML & Web services: How do i serialize a string to a literal
The problem goes like this :
- Posted by: Nanda Kishore Kalakonda
- Posted on: July 25 2002 11:09 EDT
I am trying to deploy a webservice using Literal XML encoding as the encoding style instead of SOAP encoding. I am setting the valus of String Type in the methd call. As i am using the Literal XML encoding style, i have explicitely specified the Serializer and Deserializer methods from soap.jar, which are XMLParameterSerializer.class (for serailization) and StringDeserializer.class (for deserialization). But when i try to run the application, i get the run time error something like this :
exception: [SOAPException: faultCode=SOAP-ENV:Client; msg=I only know how to serialize an 'org.w3c.dom.Element'.; targetException=java.lang.IllegalArgumentException: I only know how to serialize an 'org.w3c.dom.Element'
Can you help, what exactly i am doing wrong.
Using document/literal is pretty easy once you get over the learning curve of exactly what values need to be used. It would help me if I knew which development tools you are using. Each tool has its own way to do this.
If you are using Apache SOAP then you need to create a message envelope and pass it the DOM object that contains your string.
I have written about this in my upcoming book Testing Web Services that will be published by Osborne McGraw Hill this Fall. Chapter 7 is on SOAP and includes details on RPC versus Document-style SOAP. The chapters are available for free download at http://www.pushtotest.com/ptt/thebook.html.