Java Reference
In-Depth Information
@WebService(name="CustomerLookupService",
serviceName="CustomerLookupService",
targetNamespace="urn:com:soacookbook",
portName="customerLookupPort")
public class CustomerWS {
@SOAPBinding(
style=SOAPBinding.Style.DOCUMENT,
use=SOAPBinding.Use.LITERAL,
parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public @WebResult(name="customerFullName") String
getCustomerFullName(
@WebParam(name="customerID",
mode=WebParam.Mode.IN) int id) {
System.out.println("Getting name for customer with ID: " + id);
//go to database here, etc...
if (id == 888) return "Homer Jay Simpson";
if (id == 999) return "Henry Walton Jones";
return "???";
}
}
The CustomerWS class implements a web service with a single method. It retrieves the string
representing a customer's full name when passed an integer representing his ID.
Now verify that you can access the WSDL of your deployed service because the BPEL will
need to reference it. To do this, log into your Glassfish web administration console, go to Web
Services→CustomerLookupService and click the View WSDL link.
Here is the WSDL file that represents the service:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net.
RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net.
RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/
oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:com:soacookbook"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:com:soacookbook"
name="CustomerLookupService">
Search WWH ::




Custom Search