• Post Reply Bookmark Topic Watch Topic
  • New Topic

difference between complex type and XML type ?  RSS feed

 
frest tan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a way to create an "XML" data type in a java derived web service ? Or, is "complex" "xsd:schema" type the only way to achieve "ordered" element style data which the consumer may then use to create a WSDL ?

Is there a book or site with example of "XML" data type created in a java code which produces WSDL ?

TIA
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that I understand your question.
I am assuming that you want to exchange arbitrary XML Data through a Web service endpoint.

If you are developing Java-to-WSDL you would have to send the XML data in a string.
Mapping XML Document to xsd:string

If you are developing WSDL-to-Java, you can specify xsd:anyType in your WSDL. WSDL-to-java will then map the xsd:anyType to javax.xml.soap.SOAPElement which implements org.w3c.dom.Element, org.w3c.dom.Node, and, javax.xml.soap.Node.
Mapping XML document to xsd:anyType
Java Interface for WSDL

Realizing Strategies for Document-Based Web Services With JAX-WS 2.0: Part 3 in a Series
 
frest tan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, you did understand given you answered the question ! My synopsis of whatI read in your link refences:

3 ways to exchange XML documents under J2EE as a service provider:

1st way: passing XML docs as attachments - good only for all java environments (both consumer & provider).

2nd way: for interoperability between languages (ie- better), design service endpoint so WSDL maps xsd:string as an XML document.

3rd way is exchange XML doc as a "SOAP doc fragment". With this option, you map XML document to xsd:anyType in service's WSDL.

It is recommended that Web services exchange XML documents as SOAP document fragments because passing XML documents like this is portable across J2EE and interoperable with all platforms.

Thanks!

Now I just need to see code examples which do options 2 & 3. The links you sent are informative as a doc but the "code example" links in the doc don't point to actual code. It would be a real bonus if I could see example of #3 while using axis WSDL generator & libs.

Anyway, I'm much further along !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!