Introduction

The JAX-WS client-side library may be used to access the SOAP API for this application via the Java runtime, using JAX-WS. This is a slim, light, client library with minimal dependency bloat (as of Java 6, JAX-WS ships with the JDK), but it requires Java 5+.

The JAX-WS client-side library is also used to provide the set of Java objects that can be serialized to/from XML using JAXB. This is useful for accessing the REST endpoints that are published by this application.

JAX-WS Example

//instantiate a new service with an impl // (or through dependency injection, or whatever)... com.company.PurchaseOrderService service = new com.company.impl.PurchaseOrderServiceImpl(); //make the remote call to read the purchase order... com.company.PurchaseOrder order = service.readPurchaseOrder("123456"); //handle the purchase order as needed...

REST Example (Standard JAXB)

//read a purchase order from a REST url java.net.URL url = ...; JAXBContext context = JAXBContext.newInstance( com.company.PurchaseOrder.class ) Unmarshaller unmarshaller = context.createUnmarshaller(); com.company.PurchaseOrder order = (com.company.PurchaseOrder) unmarshaller.unmarshal( url ); //handle the purchase order as needed...

REST Example (Jersey client)

com.sun.jersey.api.client.Client client = com.sun.jersey.api.client.Client.create(); com.company.PurchaseOrder order = client.resource("http://path/to/purchase/order") .get(com.company.PurchaseOrder.class); //handle the purchase order as needed...