dear gurus:
how can I get XML string returned by web service in java?
not an object of web service .
thank you
Printable View
dear gurus:
how can I get XML string returned by web service in java?
not an object of web service .
thank you
If you type "java consume web service" about 25,000,000 results pop up showing you, with code even, how to consume a web service. There are two main ways that people do this: using JaxWS (a third party, open source, solution), or by using some of the following Java classes, already there in the SDK:
javax.xml.rpc.Service
javax.xml.rpc.ServiceFactory
The easiest and straightforward way would be to connect to the service and parse the response: http://java.sun.com/docs/books/tutor...eadingURL.html
The rest of solutions involve external APIs.
The Java recommended way is using JAX-WS, and as of JSR 109 and SDK 1.6 JAX-WS is actually part of the SDK. Using a WSDL and the classes provided is about 5 lines of code, AND the best part is that you don't have to write your own XML parser.
Try reading this article: http://java.sun.com/developer/techni...J2SE/jax_ws_2/.