uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

19.2.5 Using a message context

Within the support range of the JAX-WS APIs, you can access the message context from the handler, Web Services client, and Web Service.The details are as follows.

In the case of a handler
The message context is passed by the parameters of the called back method (such as the handleMessage method).

In the case of a Web Services client
You can access a copy of the message context using the getRequestContext method of the javax.xml.ws.BindingProvider interface and the getResponseContext method.

For Web Services
You can access the message context by using the getMessageContext method of the javax.xml.ws.WebServiceContext interface.

For details on the JAX-WS APIs, see the JAX-WS 2.2 specifications. Also, for details on the support range of the JAX-WS APIs in the Cosminexus JAX-WS functionality, see 19.2.1 List of interfaces and classes (JAX-WS). The Cosminexus JAX-WS functionality supports the standard properties defined in the JAX-WS 2.2 specifications and the vendor-specific properties.

The standard properties mentioned in Chapter 9 of the JAX-WS 2.2 specifications can only be referenced. The operations are not supported if the standard properties are changed.

Organization of this subsection
(1) Support range of the message context properties
(2) Notes on using a message context

(1) Support range of the message context properties

The following table describes the support range of the message context properties.

Table 19-32 List of message context properties

No. Property name Description location#1 Mandatory#2 Support
Web Service client Web Services#5 Handler
Web Service client Web Service
Out#3 In#4 Out#6 In#7 In#8 Out#9
javax.xml.ws.handler.message
1 .outbound#10 9.4.1.1 Y N#10 N#10 N R R R R
javax.xml.ws.binding.attachments
2 .inbound#10 9.4.1.1 Y N#10 N#10 R R R R R
3 .outbound#10 9.4.1.1 Y N#10 N#10 N R R R R
javax.xml.ws.reference
4 .parameters#10 9.4.1.1 Y N#10 N#10 R R R R R
javax.xml.ws.wsdl
5 .description#10, #12 9.4.1.1 -- N#10 N#10 N#11 N#11 N#11 N#11 N#11
6 .service#10, #12 9.4.1.1 -- N#10 N#10 R R R R R
7 .port#10, #12 9.4.1.1 -- N#10 N#10 R R R R R
8 .interface#10, #12 9.4.1.1 -- N#10 N#10 R R R R R
9 .operation#10, #12, #13 9.4.1.1 -- N#10 R#13 R R R R R
javax.xml.ws.http.request
10 .headers 9.4.1.1 Y R/C#14 N#10 R R/C#14 R#15 R R
11 .method#10, #11 9.4.1.1 Y N#10 N#10 R R#15 R#15 R R
12 .querystring#10, #11 9.4.1.1 Y N#10 N#10 R R#15 R#15 R R
13 .headers 9.4.1.1 Y N#10 N#10 R#16 R#15 R#15 R#16 R#16
javax.xml.ws.http.response
14 .headers#10 9.4.1.1 Y N#10 N#10 N R#17 R R#17 R#17
15 .code#10 9.4.1.1 Y N#10 N#10 N R#18 R R R
javax.xml.ws.servlet
16 .context#10, #11 9.4.1.1 Y N#10 N#10 R R#15 R#15 R R
17 .request#10 9.4.1.1 Y N#10 N#10 R R#15 R#15 R R
18 .response#10 9.4.1.1 Y N#10 N#10 R R#15 R#15 R R
javax.xml.ws.service.endpoint
19 .address#19 4.2.1.1 Y R/C R N R/C R R R
javax.xml.ws.security.auth
20 .username 4.2.1.1 Y R/C R N R/C R R R
21 .password 4.2.1.1 Y R/C R N R/C R R R
javax.xml.ws.session
22 .maintain 4.2.1.1 Y R/C R N R/C R R R
javax.xml.ws.soap.http.soapaction
23 .use 4.2.1.1 -- N#20 N#20 N#20 N#20 N#20 N#20 N#20
24 .uri 4.2.1.1 -- N#20 N#20 N#20 N#20 N#20 N#20 N#20
com.cosminexus.jaxws
25 .connect.timeout
 
 
R/C R N R/C R R R
26 .request.timeout
 
 
R/C R N R/C R R R
com.cosminexus.xml.ws.client.http
27 .HostnameVerificationProperty
 
 
R/C#21 N N N N N N

Legend:
Y: Indicates that the property is mandatory.
--: Indicates that the property is not mandatory.
R/C: Can be referenced and changed.
R: Can only be referenced. The operations are not guaranteed if the property is changed.
N: Cannot be referenced and changed.
Blank column: Indicates not applicable because this property is provided by the Cosminexus JAX-WS functionality.

#1
Indicates the locations defined in the JAX-WS 2.2 specifications.

#2
Indicates whether the property is mandatory in the JAX-WS 2.2 specifications.

#3
Indicates whether the property can be referenced or changed in the request context that can be obtained with javax.xml.ws.BindingProvider#getRequestContext.

#4
Indicates whether the property can be referenced or changed in the request context that can be obtained with javax.xml.ws.BindingProvider#getResponseContext.

#5
For details on injection of the Web Services context, see 10.21.2 Injecting aWeb Services context, and for details on the message context property in Web Services, see 19.2.5(2)(l) Message context property on Web Services.

#6
Indicates that the handler is associated with the Web Service client and whether the property can be referenced or changed for the outbound processing (when the request message is sent).

#7
Indicates that the handler is associated with the Web Service client and whether the property can be referenced or changed for the inbound processing (when the response message is received).

#8
Indicates that the handler is associated with the Web Service implementation class or provider implementation class and whether the property can be referenced or changed for the inbound processing (when the request message is received). For details on notes when adding the message context property, see 10.21.2(2) Notes when adding a user-defined message context property.

#9
Indicates that the handler is associated with the Web Service implementation class or provider implementation class and whether the property can be referenced or changed for the outbound processing (when the response message is sent). For details on notes when adding the message context property, see 10.21.2(2) Notes when adding a user-defined message context property.

#10
See 19.2.5(2)(e) Message context properties with HANDLER scope in the Web Service client.

#11
Always returns null.

#12
See 19.2.5(2)(h) Message context properties related to the WSDL.

#13
See 19.2.5(2)(i) Message context properties related to the WSDL operation name.

#14
You can only add and reference the HTTP header Accept-Encoding that is used for linking with the HTTP response compression functionality, and the HTTP header Content-Encoding that is used for gzip compression of the HTTP request body. For details on Accept-Encoding, see 10.18 Linking with the HTTP response compression functionality. For details on Content-Encoding, see 10.17 gzip compression of the HTTP request body.

#15
See 19.2.5(2)(a) Message context properties that are irrelevant even when operated with the handler in the Web Services client.

#16
See 19.2.5(2)(b) Path information.

#17
See 19.2.5(2)(c) HTTP header.

#18
See 19.2.5(2)(d) HTTP status code.

#19
See 19.2.5(2)(g) Message context properties specified in the service endpoint address.

#20
See 19.2.5(2)(f) Message context properties related to the SOAPAction header.

#21
See 19.2.5(2)(k) How to set up the com.cosminexus.xml.ws.client.http.HostnameVerificationProperty property.

(2) Notes on using a message context

This point describes the notes on using a message context.

(a) Message context properties that are irrelevant even when operated with the handler in the Web Service client

The property that stores the HTTP method map for the request message (such as the javax.xml.ws.http.request.method property) is obtained using the handler in the Web Service and is a relevant property. Therefore, when this property is referenced with the handler in the Web Service client, null is always returned.

(b) Path information

null is always stored for the javax.xml.ws.http.request.pathinfo property.

(c) HTTP header
(d) HTTP status code

The outbound handler in the Web Service client is processed before the HTTP communication is performed. Therefore, if the javax.xml.ws.http.response.code property storing the HTTP status code is referenced from the handler, null is always returned.

(e) Message context properties with HANDLER scope in the Web Service client

The standard message context properties include an APPLICATION scope and HANDLER scope, but only the message context properties with the APPLICATION scope can be referenced from the Web Service client. Therefore, with the Cosminexus JAX-WS functionality, the properties assigned #9 in the table in 19.2.5(1) Support range of the message context properties cannot be used with the Web Services client. The operations are not guaranteed if these properties are referenced.

(f) Message context properties related to the SOAPAction header

The Cosminexus JAX-WS functionality does not support the SOAPAction header, so the javax.xml.ws.soap.http.soapaction.use and javax.xml.ws.soap.http.soapaction.uri properties cannot be used. The operations are not guaranteed if these properties are referenced.

(g) Message context properties specified in the service endpoint address

You cannot set up spaces and null in the javax.xml.ws.service.endpoint.address property that specifies the service endpoint address. The operations are not guaranteed if a space or null is set up. For details on the other values specified in the javax.xml.ws.service.endpoint.address property, see 20.2(3) Values specifiable in the location attribute of the soap: address element or soap12: address element.

(h) Message context properties related to the WSDL

The dispatch-based Web Service client and provider-based Web Service do not contain the WSDL file, so null is always returned when the message context properties related to the WSDL are referenced.

(i) Message context properties related to the WSDL operation name

The javax.xml.ws.wsdl.operation property in the stub-based Web Service client can only be referenced with the request context that can be obtained with javax.xml.ws.BindingProvider#getResponseContext. If the property is referenced with the request context that can be obtained with javax.xml.ws.BindingProvider#getRequestContext, null is always returned. Also, even if a value is set in the javax.xml.ws.wsdl.operation property, the value does not affect the SOAP message to be sent.

(j) Specifying the service endpoint address for using the WS-RM 1.2 functionality

With the Web Service client that uses the WS-RM 1.2 functionality, specify the service endpoint address before you invoke the first Web Service. If the service endpoint is changed subsequent to the first communication, the WS-RM communication fails.

(k) How to set up the com.cosminexus.xml.ws.client.http.HostnameVerificationProperty property

Specify true or false in the message context for the com.cosminexus.xml.ws.client.http.HostnameVerificationProperty property using a java.lang.String type string, as shown in the following figure. The operations are not guaranteed if a string other than a java.lang.String type string is used to set up the value.

context.put("com.cosminexus.xml.ws.client.http.HostnameVerificationProperty", "true");
(l) Message context property in Web Services

The description of referencing and changing the message context property in Web Services is as follows: