Aug 11th, 2006, 08:46 PM
Pass XML as String
Hi, this is a general web service question i think.
My web service takes a String type parameter and the string could be any valid xml document (we have another paramter with which we can get all the details as to how to interpret the xml string). The web service is implemented using AXIS.
This works fine but one issue coming up is our clients use all kinds of SOAP client, some of them creating the SOAP payload by themselves. In that case, they have to escape the xml string parameter ( using < and > to escape the < and > tags). Othewise Axis on the server side will throw exceptions. If the client use axis client tool or .net, usually they do not have to do that manually.
I'd like to see a solution that does not require the client to do any xml escaping.
Aug 12th, 2006, 12:44 AM
I just found that putting the xml in a CDATA section does the trick.
Aug 14th, 2006, 08:45 AM
spring web services
Maybe you should look at the spring-ws model instead of axis.
With that you should be able to generate classes from your xsd (for say jaxb2), populate your class, and then marshall it all with something like:
new QName(NAMESPACE_URI, affiliations_RESPONSE_LOCAL_NAME), WorkflowListResponse.class, workflowResponse),result);
The content of the fields in your class should not be a problem after that.
I was using Axis recently and am trying the spring-ws model instead now. It's different in that you start with the contract and then code to it, whereas axis will generate a wsdl on the fly for you.
I am liking the spring-ws model because I find it easier to debug since it is not a separate container where axis is.