Network Deployment (Distributed operating systems), v8.0 > Reference > Developer detailed usage information


WSIFOperation - Context

Although WSDL does not define context, a number of uses of the Web Services Invocation Framework (WSIF) require the ability to pass context to the port that is invoking the service.

For example, a SOAP over HTTP port might require an HTTP user name and password. This information is specific to the invocation, but is not a parameter of the service. In general, context is defined as a set of name-value pairs. However, because web services tend to define the types of data by using XML schema types, WSIF represents the name-value pairs of the context by using the same representation that WSIFMessage classes use; that is, a set of named parts, each of which equates to an instance of an XML schema type.

You use the WSIFOperation interface setContext and getContext methods to pass context information to the binding. The port implementation can use this context, for example to update a SOAP header. There is no definition of how a port can use the context.

The parameter of the setContext and getContext methods is a WSIFMessage interface, and this interface has named parts defining the context information. The WSIFConstants class defines constants for the part names that can be set in a context WSIFMessage interface.

The following code fragment shows how to set the user name and password for HTTP basic authentication:

 // set a basic authentication header
    WSIFMessage headers = new WSIFDefaultMessage();
    headers.setObjectPart( WSIFConstants.CONTEXT_HTTP_USER, "user name" );
    headers.setObjectPart( WSIFConstants.CONTEXT_HTTP_PSWD, "password" );
    operation.setContext( headers );

The WSIFOperation interface ignores context parts that it does not support. For example, the previous code is ignored by the WSIF Java provider.

The WSIFConstants class includes the following constants that can be used for context part names:

The HTTP header values are expected to be of type String, and the SOAP header value is expected to be of type java.util.List, which should contain entries of type org.w3c.dom.Element.
Invoke a WSDL-based web service through the WSIF API


Related


WSIFOperation - Asynchronous interactions reference
WSIFOperation - Synchronous and asynchronous timeouts reference
WSIFOperation interface

+

Search Tips   |   Advanced Search