public class

UsernameTokenProfile

extends Object
implements SOAPHandler<T extends SOAPMessageContext>
java.lang.Object
   ↳ org.mule.modules.avalara.util.UsernameTokenProfile

Class Overview

Simple implementation of request signing using username-token profile

Summary

Fields
private static String SOAPENVNamespace Namespace for the SOAP Envelope.
private static String SOAPENVPrefix The prefix that will be used for the SOAP Envelope namespace.
private static String WSSENamespace Namespace for the WS-Security SOAP header elements.
private static String WSSEPasswordText The WS-Security URI that specifies that the password will be transmitted as plain text.
private static String WSSEPrefix The prefix that will be used for the WS-Security namespace.
private String password The password that will be sent in the WS-Security header on the SOAP request message.
private String username The user name that will be sent in the WS-Security header on the SOAP request message.
Public Constructors
UsernameTokenProfile(String username, String password)
Creates a UsernameTokenProfile handler and initialises the member variables.
Public Methods
void close(MessageContext messageContext)
Set<QName> getHeaders()
Returns null as this handler doesn't process any Headers, it just adds one.
boolean handleFault(SOAPMessageContext smc)
Returns true, no action is taken for faults messages.
boolean handleMessage(SOAPMessageContext smc)
Adds WS-Security header to request messages.
static void sign(BindingProvider bindingProvider, String username, String password)
This method created an instance of the UsernameTokenProfile class and adds it as a handler to the bindingProvider supplied.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.xml.ws.handler.Handler
From interface javax.xml.ws.handler.soap.SOAPHandler

Fields

private static String SOAPENVNamespace

Namespace for the SOAP Envelope.

private static String SOAPENVPrefix

The prefix that will be used for the SOAP Envelope namespace.

private static String WSSENamespace

Namespace for the WS-Security SOAP header elements.

private static String WSSEPasswordText

The WS-Security URI that specifies that the password will be transmitted as plain text.

private static String WSSEPrefix

The prefix that will be used for the WS-Security namespace.

private String password

The password that will be sent in the WS-Security header on the SOAP request message.

private String username

The user name that will be sent in the WS-Security header on the SOAP request message. This is of the form systemid@tenant.

Public Constructors

public UsernameTokenProfile (String username, String password)

Creates a UsernameTokenProfile handler and initialises the member variables. In most cases, the sign static method should be used instead.

Parameters
username The id and tenant name for the user. This is of the form systemid@tenant.
password The password for the system user.

Public Methods

public void close (MessageContext messageContext)

Parameters
messageContext

public Set<QName> getHeaders ()

Returns null as this handler doesn't process any Headers, it just adds one.

public boolean handleFault (SOAPMessageContext smc)

Returns true, no action is taken for faults messages.

Parameters
smc

public boolean handleMessage (SOAPMessageContext smc)

Adds WS-Security header to request messages.

Parameters
smc

public static void sign (BindingProvider bindingProvider, String username, String password)

This method created an instance of the UsernameTokenProfile class and adds it as a handler to the bindingProvider supplied.

Parameters
bindingProvider The client stub to which the handler will be added. The most convenient way to obtain the required bindingProvvider is to call one of the getPort methods on the Service class for the Web service and then cast the returned object to a BindingProvider.
username The id and tenant name for the user. This is of the form systemid@tenant.
password The password for the system user.