Developer Tools
Enterprise Pack for Eclipse
Handlers are interceptors that can be easily plugged into the Java API for XML-Based Web Services (JAX-WS) 2.0 runtime environment to do additional processing of inbound and outbound messages.
JAX-WS defines two types of handlers:
In this step, you will write a SOAP protocol handler and a logical handler for the use with JAX-WS services. You will describe the handlers in a custom bindings file using the JAX-WS Bindings Editor .
You will perform following tasks in this step:
MessageContext.MESSAGE_OUTBOUND_PROPERTY from
SOAPMessageContext. The value of the
MESSAGE_OUTBOUND_PROPERTY indicates the message direction. A value of
true means that the message is outbound. A value of
false indicates an inbound message. Based on the property value,
logToSystemOut()
shall print either "Outbound message" or "Inbound message." Also, retrieve the
SOAPMessage and print it as shown below.
|
private void logToSystemOut(SOAPMessageContext context) {
if (outboundProperty.booleanValue()) {
SOAPMessage message = context.getMessage();
|
|
@Override
@Override
|
In this step, you will implement a ProductLogicalHandler, which handles inbound messages and modifies the message payload; i.e. convert the value of the product name node to uppercase.
MessageContext.MESSAGE_OUTBOUND_PROPERTY from
LogicalMessageContext. The value of
MESSAGE_OUTBOUND_PROPERTY indicates the message direction. A value of
true means that the message is outbound. A value of
false indicates an inbound message. Ignore further processing, if the message is outbound.
|
@Override
Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); // ignore OUTBOUND requests
Source payload = lm.getPayload(); if (payload instanceof DOMSource) {
Node rootNode = source.getNode(); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList nodes;
}
|
In this step, you will describe the handlers in custom bindings file using the JAX-WS Bindings Editor .
button and choose SOAP Handler. Enter handler name as
SOAPLoggingHandler and specify
com.oracle.ticketsystem.handlers.SOAPLoggingHandler as the class name.
Since, you have modified the proudctBindings.xml file with additional JAX-WS handlers, you are required to re-generate the Web Service client artifacts.
Click the arrow below to navigate through the tutorial: