Since there is no XML data type that I can define, I was wondering if I pass XML as a string but semantics of XML will lost in this case. Will it cause difficulty in parsing the XML string at the server? The XML string must be validated against a schema.
Will Documemt/Literal type of SOAP encoding solve my peoblem, or is there some other way.
As such sending XML Data as a String Parameter to a call on Webservice does not pose any problems.
We have used String Represntations of XML Data, infact we even used encryption / Decryption of the String and all worked fine, including the Validation of the file after decryption.
May be you are worried about the size of the XML file...., we probably did not have a huge file...it was about 20 - 25 lines containing customer data.
I think you will have to write a Bean representation of your XML File, you can make use of JAXB for the same.
Yes, as it's you who's responsible for doing all XML parsing -- you get a single element into your Java code which you need to interpret.
Originally posted by Pradeep Bhat:
Will Documemt/Literal type of SOAP encoding solve my peoblem
if you are refering to be a webservice method, then I think it will not be possible to pass an Element object as a SOAP Message.
All the Objects that we intend to send accross the network to invoke business services should be converted into a SOAP message (also referred to as the Serialization and Deserialization), as far as I know we can exchange the primitive java types and some utility classes in Java, and all the Other Objects which follow the Bean Patterns...(ie., Default constructor, getter and setter methods).
Element neither satisfies the Bean Patterns (it is an interface I think), nor are there any Serializers or Deserializers I think in either JWSDP or AXIS).
so in that case you will have to create your own serializers / Deserializers, but that will mean creating a dependency and also B2B integration will become difficult as also the cross platform integration.
what best we can do is we could construct Java Objects from the XML(DTD) Files on the server side and use these Objects to create the WSDL, and then you can also provide a "client.jar" files that contains the same beans so that the construction of the beans for serialization is easier on the client side, or the client side can generate using its own processes.
Lasse is definitively right.
you should consider reading again about Web Services and Document/Literal.
An Element is an correct datatype for web services using literal encoding style
Originally posted by Pradeep Bhat:
Is the single element the SOAP body contents?
Yes it is.
In Document/Literal, the Body element only contains the XML document you exchange through your web service.
This XML document is in plain text. It is Literal
The difference with RPC/Literal is that in RPC, the XML is enclosed in a method name. (The method you call in a RPC way)
Originally posted by Balaji Loganathan:
This http://test.javaranch.com/wiki/view?XmlFaq will help you.
The above link is broken. could you please provide me the correct link.
Anyway here it is http://faq.javaranch.com/view?XmlFaq
Design a Schema file for your input request message and output response message and generate the appropriate serializers/de-serializers using XMLBeans and it is very easy to use also. You can use the same classes to program your client also. As the whole schema is represented as a Java Object, it is very easy to retrieve data and construct the response also.