WEB SERVICES IN JAVA - GitHub Pages
Transcript of WEB SERVICES IN JAVA - GitHub Pages
![Page 1: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/1.jpg)
WEB SERVICES IN JAVA
16/09/2020 tdi@cphbus 1
![Page 2: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/2.jpg)
Java Technologies for Processing Web Services
16/09/2020 tdi@cphbus 2
![Page 3: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/3.jpg)
JAX-WS
§ Java API for XML Web Services (JAX-WS) § a technology for building web services and clients that communicate using XML
§ Hides the complexity of SOAP
§ Enables implementation of both§ RPC-oriented web services§ message-oriented web services
§ Provides platform independence§ non-Java clients can use Java service
16/09/2020 tdi@cphbus 3
![Page 4: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/4.jpg)
How Does JAX-WS Work?
§ While creating a client to consume a web service§ creates a local copy of the remote WSDL § maps the URL of the service provider to the local copy
§ this is defined in jax-ws-catalog.xml§ this makes the implementation of the service at the client easier and faster
§ Example of jax-ws-catalog.xml<?xml version="1.0" encoding="UTF-8" standalone="no"?><catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<system systemId="http://www.webservicex.net/geoipservice.asmx?WSDL" uri="wsdl/www.webservicex.net/geoipservice.asmx.wsdl"/>
</catalog>
16/09/2020 tdi@cphbus 4
![Page 5: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/5.jpg)
JAXB – Java Architecture for XML Binding
§ Converts Java objects to XML representation and vice-versa
§ Used to transform an user-defined object types and collections into XML as a part of SOAP message
16/09/2020 tdi@cphbus 5
![Page 6: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/6.jpg)
Java vs XML
In Javapublic class MyClass
{int attr1;double attr2;String attr3;
}
In XML<MyClass>
<attr1>value</attr1><attr2>value</attr2><attr3>value</attr3>
</MyClass>
16/09/2020 tdi@cphbus 6
![Page 7: WEB SERVICES IN JAVA - GitHub Pages](https://reader036.fdocuments.net/reader036/viewer/2022073123/62e5d3b0a97b421ee90fe70d/html5/thumbnails/7.jpg)
JAXB Annotations
§ Annotations, placed in Java code to instruct JAXB§ not needed for simple transformation§ needed for customisation of default values
§ Examples of annotations§ @XmlRootElement, @XmlType, @XmlElement
16/09/2020 tdi@cphbus 7