• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Send XML code to a Web Service

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you both.
 
reply
    Bookmark Topic Watch Topic
  • New Topic