• Post Reply Bookmark Topic Watch Topic
  • New Topic

Send XML code to a Web Service  RSS feed

 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Right now i'm sending XML code inside a String (the WS takes a String parameter), is this bad practice ? I have to use SOAP. This method cause some problems, is there another way ?

Thanks,
Alex
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you are doing WSDL-first development, you should consider using the XML schema type anyType for the parameter.
If you are doing Java-first development, then take a look at the API documentation for @XmlAnyElement for examples on how to pass XML data to a method in the web service endpoint implementation class. I suspect that, in this case, it may be easier to write a WSDL and generate some code, to see how it is to be done properly.
Best wishes!
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex,

Plain old XML is definitely acceptable depending on the scenario.

REST and POX says -

This sample demonstrates how to use HTTP transport in Windows Communication Foundation (WCF) to send and receive "plain old XML" (POX) messages - that is, messages that consist solely of XML payloads without any enclosing SOAP envelope. POX messages can be sent and received by many types of clients, including clients such as Web browsers that do not have any native support for SOAP-based protocols. POX is a suitable choice for services that exchange data over HTTP and have no requirement to use the advanced protocol capabilities of SOAP and WS-* such as non-HTTP transports, message exchange patterns other than request/response, and message-based security, reliability, and transactions.


Regards,
Dan
 
Alex Parvan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!