FileDocCategorySizeDatePackage
Message.javaAPI DocExample9588Tue May 29 16:57:16 BST 2007com.sun.xml.ws.tx.common

Message

public class Message extends Object
WS-TX view of a Message.
author
jf39279

Fields Summary
private static final TxLogger
logger
private final com.sun.xml.ws.api.message.Message
coreMessage
The JAX-WS Message wrapped by this instance.
private final com.sun.xml.ws.api.message.HeaderList
hdrList
private com.sun.xml.ws.api.SOAPVersion
SOAP_VERSION
private com.sun.xml.ws.api.addressing.AddressingVersion
ADDRESSING_VERSION
private com.sun.xml.ws.api.message.Header
ccHdr
private static final int
NOT_FOUND
private int
ccHdrIndex
private com.sun.xml.ws.tx.coordinator.CoordinationContextInterface
cc
Constructors Summary
public Message(com.sun.xml.ws.api.message.Message message, com.sun.xml.ws.api.WSBinding wsBinding)
Public ctor takes wrapped JAX-WS message as its argument.

param
message core message


                      
        
                      
        this.coreMessage = message;
        this.hdrList = (message == null ? null : message.getHeaders());
        SOAP_VERSION = (wsBinding == null ? null : wsBinding.getSOAPVersion());
        ADDRESSING_VERSION = (wsBinding == null ? null : wsBinding.getAddressingVersion());
    
public Message(com.sun.xml.ws.api.message.Message message)
Public ctor takes wrapped JAX-WS message as its argument.

param
message core message

         this(message, null);
    
Methods Summary
public java.lang.StringgetAction()

return
the ws-addressing Action for this message

        String result = null;
        if (hdrList != null && ADDRESSING_VERSION != null && SOAP_VERSION != null) {
            result = hdrList.getAction(ADDRESSING_VERSION, SOAP_VERSION);
        }
        return result;
    
public com.sun.xml.ws.api.message.HeadergetCoordCtxHeader()
Get the CoordinationContext Header Element from the underlying JAX-WS message's HeaderList. Only understand the header iff CoordinationContext is for coordinationType.

return
the coordination context in this message

        if (ccHdr == null) {
            if (hdrList != null) {
                ccHdr = hdrList.get(WSCOOR_SOAP_NSURI, COORDINATION_CONTEXT, false);

                /*
                * Note: include when supporting OASIS WS-TX
                * don't check for it since it will be a must understand soap header,
                * must understand header processing should flag it is not processed.
               if (ccHdr == null) {
                   hdrList.get(Constants.WSAT_OASIS_NSURI, COORDINATION_CONTEXT, true);
                   ....
               }
                */

            }
        }
        return ccHdr;
    
public com.sun.xml.ws.api.message.HeadergetCoordCtxHeader(java.lang.String namespace, java.lang.String localName)
Get the CoordinationContext Header Element from the underlying JAX-WS message's HeaderList. Only understand the header iff CoordinationContext is for coordinationType.

param
namespace namespace
param
localName local name
return
index of coordination context in header list or null if not found

        if (ccHdr == null && coreMessage != null) {
            ccHdrIndex = NOT_FOUND;
            final int len = hdrList.size();
            for (int i = 0; i < len; i++) {
                final Header h = hdrList.get(i);
                if (h.getLocalPart().equals(localName) && h.getNamespaceURI().equals(namespace)) {
                    ccHdrIndex = i;
                    ccHdr = h;
                    break;
                }
            }
        }
        return ccHdr;
    
public com.sun.xml.ws.tx.coordinator.CoordinationContextInterfacegetCoordinationContext(javax.xml.bind.Unmarshaller unmarshaller)

param
unmarshaller jaxb unmarshaller
return
the coordination context

        if (cc == null) {
            final Header ccHdr = getCoordCtxHeader(WSCOOR_SOAP_NSURI, COORDINATION_CONTEXT);
            if (ccHdr != null) {
                try {
                    cc = CoordinationContextBase.createCoordinationContext(ccHdr.readAsJAXB(unmarshaller));
                } catch (JAXBException e) {
                    logger.warning("getCoordinationContext", LocalizationMessages.CANNOT_UNMARSHAL_CONTEXT_2000(e.getLocalizedMessage()));
                    throw e;
                }
            }
        }
        return cc;
    
public com.sun.xml.ws.api.addressing.WSEndpointReferencegetFaultTo()

return
the ws-addressing FaultTo for this message

        WSEndpointReference result = null;
        if (hdrList != null && ADDRESSING_VERSION != null && SOAP_VERSION != null) {
            result = hdrList.getFaultTo(ADDRESSING_VERSION, SOAP_VERSION);
        }
        return result;
    
public java.lang.StringgetMessageID()

return
the ws-addressing MessageId for this message

        String result = null;
        if (hdrList != null && ADDRESSING_VERSION != null && SOAP_VERSION != null) {
            result = hdrList.getMessageID(ADDRESSING_VERSION, SOAP_VERSION);
        }
        return result;
    
public com.sun.xml.ws.api.model.wsdl.WSDLBoundOperationgetOperation(com.sun.xml.ws.api.model.wsdl.WSDLPort port)
Get the wsdl bound operation for the specified port

param
port port
return
the wsdl operation or null if not found

        return coreMessage.getOperation(port);
    
public com.sun.xml.ws.api.addressing.WSEndpointReferencegetReplyTo()

return
the ws-addressing ReplyTo for this message

        WSEndpointReference result = null;
        if (hdrList != null&& ADDRESSING_VERSION != null && SOAP_VERSION != null) {
            result = hdrList.getReplyTo(ADDRESSING_VERSION, SOAP_VERSION);
        }
        return result;
    
public java.lang.StringgetTo()

return
the ws-addressing To for this message

        String result = null;
        if (hdrList != null && ADDRESSING_VERSION != null && SOAP_VERSION != null) {
            result = hdrList.getTo(ADDRESSING_VERSION, SOAP_VERSION);
        }
        return result;
    
public voidsetCoordCtxUnderstood()
Denote that CoordinationContext SOAP Header was processed and considered understood.

        if (ccHdr != null && ccHdrIndex != NOT_FOUND) {
            coreMessage.getHeaders().understood(ccHdrIndex);
        }