Programming the JWS File 4-13
4.4.3 Using the MessageContext Property Values
The following table defined the javax.xml.ws.handler.MessageContext property values that you can access from a message handler—from the client
application or Web service—or directly from the WebServiceContext from the Web service. For more information, see the javax.xml.ws.handler.MessageContext
Javadocs at
http:download.oracle.comjavaee5apijavaxxmlwshandlerMes sageContext.html
.
Table 4–5 Methods of the WebServiceContext
Method Returns
Description
getMessageContext MessageContext
Returns the MessageContext for the current service request. You can access properties that are application-scoped only,
such as HTTP_REQUEST_HEADERS, MESSAGE_ ATTACHMENTS
, and so on, as defined in Section 4.4.3, Using
the MessageContext Property Values. getUserPrincipal
java.security.P rincipal
Returns the Principal that identifies the sender of the current service request. If the sender has not been authenticated, the
method returns null. isUserInRolejava.lang
.String role boolean
Returns a boolean value specifying whether the authenticated user is included in the specified logical role. If
the user has not been authenticated, the method returns false
.
Table 4–6 Properties of MessageContext
Property Type
Description
HTTP_REQUEST_HEADERS java.util.Map
Map of HTTP request headers for the request message. HTTP_REQUEST_METHOD
java.lang.String HTTP request method for example GET, POST, or PUT.
HTTP_RESPONSE_CODE java.lang.Intege
r HTTP response status code for the last invocation.
HTTP_RESPONSE_HEADERS java.util.Map
HTTP response headers. INBOUND_MESSAGE_
ATTACHMENTS java.util.Map
Map of attachments for the inbound messages. MESSAGE_OUTBOUND_PROPERTY
java.lang.Boolea n
Message direction. This property is true for outbound messages and false for inbound messages.
OUTBOUND_MESSAGE_ ATTACHMENTS
java.util.Map Map of attachments for the outbound messages.
PATH_INFO java.lang.String
Request path information. QUERY_STRING
java.lang.String Query string for request.
REFERENCE_PARAMETERS java.awt.List
WS-Addressing reference parameters. The list must include all SOAP headers marked with the
wsa:IsReferenceParameter=true attribute.
SERVLET_CONTEXT javax.servlet.Se
rvletContext Servlet context object associated with request.
SERVLET_REQUEST javax.servlet.ht
tp.HttpServletRe quest
Servlet request object associated with request. SERVLET_RESPONSE
javax.servlet.ht tp.HttpServletRe
sponse Servlet response object associated with request.
4-14 Getting Started With JAX-WS Web Services for Oracle WebLogic Server
4.5 Should You Implement a Stateless Session EJB?