Reputation: 345
Can we generate an xml file using webservices in Java, and if so how?
Upvotes: 3
Views: 2294
Reputation: 149007
There are two Java Web Service Standards:
Each spec has multiple implementations. GlassFish is the reference implementation for both these standards.
You can either interact directly with XML, or with POJOs that are converted to XML via an XML binding layer. The standard binding layer for JAX-WS and JAX-RS is Java Architecture for XML binding (JAXB).
For an example of a JAX-RS Webservice check out:
Upvotes: 2
Reputation: 114767
Generating XML files has nothing to do with webservices. The common SOAP based webservices communicate with messages written in XML. So to call a webservice, you'll have to create a XML document that implements some xml schema and send the xml document to the servers address. And you won't need files, usually the XML documents are created in memory and not written to files.
Apache Axis2 is a quite powerful library that takes care of most of the marshalling/unmarshalling and communication stuff.
Upvotes: 2
Reputation: 75376
Create a web service (e.g. using Java 6 annotations) and let the annotated method return a DOM tree transformed to a string.
Upvotes: 1