Professional Documents
Culture Documents
DSG-IDistrSys: Introduction to
Distributed Systems
11.06.2018
JAXB
Web Service
Interaction using XML
Java implementation
Web Services
using XML
JAX-WS
WSDL
Java
SOAP
JAXB
https://de.wikipedia.org/wiki/Web_Services_Description_Language
<SOAP-ENV:Envelope (…)>
SOAP message
<SOAP-ENV:Body>
Envelope (required) <sayHelloRequest>
<firstName>John</firstName>
Header (optional) </sayHelloRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Body (required)
Fault (optional)
<SOAP-ENV:Envelope (…)>
<SOAP-ENV:Body>
<sayHelloResponse>
<greeting>Hello John!</greeting>
</sayHelloResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
https://katalog.ub.uni-bamberg.de/query/BV037352060
@WebService(endpointInterface=“Greetings“)
public class GreetingsImpl implements Greetings {
public String greet(String name) {
return name + " says: Hello Web Services!";
}
}
@WebMethod
@XmlType @XmlRootElement
@WebService
propOrder public class Greetings {
@WebMethod
public Object greet(Object name) {
return name.getName() + " says: Hello WS!";
}
}
Annotations on
classes
public variables or getter of private variables
…
JAXB samples
jaxws-samples /type-mapping /java-first/custom
http://www.oracle.com/technetwork/articles/javase/index-140168.html
@XmlRootElement(name = "Chancellor")
@XmlType(propOrder = { "name", "party", "start", "to" }, namespace="http://uniba.de/dsg/jaxws/")
public class Chancellor {
@XmlElement(required=true)
public String name;
public String party;
@XmlElement(name="from")
public Date start;
public Date to;
}
import javax.xml.ws.Endpoint;
Endpoint.publish(
"http://localhost:8080/GreetingsService",
new GreetingsImpl()
);
Deployment-styles samples
jaxws-samples /deployment-styles
WS
WSDL Interface
WS Impl
e.g. wsimport
Exception Operation
classes Wrappers
Service
Client
WSDL wsimport
Service
Endpoint
Interface
Async JAXB
Response
Beans Beans
WS Endpoint Interface
WS Client
Interface
implement
HistoryService History
this interface
ObjectFactory package-info
GetChancellors
GetChancellors Chancellor
Response
*.java
wsdlimport samples
jaxws-samples /ws-client
WSDL Reference
Server location,
WSDL service
WSDL port
WS Endpoint Interface
WS Client
Interface
Types
Get it!
www.soapui.org
SimpleTicketStore
Ticket- Ticket- (in memory)
Management- Search-
Backend Backend
WSRemoteAccess
WSTicket-
Management-
Backend
= Configuration needed
SearchServer
= Actual programming tasks
Still questions?
Read the provided material and the official documentation
Use the VC forum
Ask me!