How to generate xml file using web services in Java?

Can we generate an xml file using web services in Java, and if so, how?

+3
source share
3 answers

Generating XML files has nothing to do with web services. SOAP-based shared web services exchange messages written in XML. Therefore, to invoke the web service, you will need to create an XML document that implements some XML schema and sends the XML document to the server address. And you don’t need files, usually XML documents are created in memory and not written to files.

Apache Axis2 is a fairly powerful library that takes care of most of the marshalling / decoupling and communication tools.

+2
source

There are two Java web service standards:

  • Java API for XML Web Services (JAX-WS)
  • Java API for RESTful Web Services (JAX-RS)

Each specification has several implementations. GlassFish is the reference implementation of both of these standards.

You can either directly interact with XML or with POJOs that are converted to XML through the XML binding layer. The standard middleware for JAX-WS and JAX-RS is Java Architecture for XML Binding (JAXB).

JAX-RS Webservice Example:

+2
source

- (, Java 6), DOM, .

+1

Source: https://habr.com/ru/post/1765035/


All Articles