communication
Class HSV3Request

java.lang.Object
  extended by org.apache.http.message.AbstractHttpMessage
      extended by org.apache.http.message.BasicHttpRequest
          extended by org.apache.http.message.BasicHttpEntityEnclosingRequest
              extended by communication.HSV3Request
All Implemented Interfaces:
HTTPSoapV3Container, org.apache.http.HttpEntityEnclosingRequest, org.apache.http.HttpMessage, org.apache.http.HttpRequest

public class HSV3Request
extends org.apache.http.message.BasicHttpEntityEnclosingRequest
implements HTTPSoapV3Container, org.apache.http.HttpRequest, org.apache.http.HttpEntityEnclosingRequest, org.apache.http.HttpMessage

Holds an instance of an HTTP request which contains an SOAP Envelope as its HTTP Entity. This Envelope contains an HL7V3Message. A HTTP Response is comprised of three parts, the HTTPResponse itself, a SoapMessage, and a HL7V3Response payload. This class can create a request in one of two ways. When sending a request another server this class can build the outgoing message by being provided the HL7V3Message. When receiving a request from a client this class can parse an incoming HTTPRequest. All SOAP messages are created/parsed using the SOAP 1.2 Protocol. All HTTP messages are encoded using the HTTP 1_1 protocol.

Author:
Michael Ogata

Field Summary
protected static javax.xml.soap.MessageFactory mf
           
protected  javax.xml.soap.SOAPHeader sheader
           
protected  javax.xml.soap.SOAPMessage smessage
           
protected  gov.nist.healthcare.core.message.v3.HL7V3Message v3payload
           
 
Fields inherited from class org.apache.http.message.AbstractHttpMessage
headergroup, params
 
Constructor Summary
HSV3Request(gov.nist.healthcare.core.message.v3.HL7V3Message m, String endpoint)
          Creates a HSV3Request with the provided HL7V3Message as its payload.
HSV3Request(org.apache.http.HttpEntityEnclosingRequest r)
          Builds an HSV3Request from an entity closing HTTP request.
 
Method Summary
 String getStringRepresentation()
          Builds the string representation of this HTTP Request.
 gov.nist.healthcare.core.message.v3.HL7V3Message getV3payload()
          Returns the current content of this containers HL7V3Message
 boolean isWSAValid()
          Checks the soap header for this message to determine if it adheres to the following standards: Web Services Addressing 1.0 - Core, ITI TF-2x Appendix V This function is not complete and as of now only checks for cardinality constraints as indicated by the standards and for the required presence of various mustUnderstand attributes.
 void setWSAHeaderValues(String to, String from, String replyto, String action)
          Sets the values of the required WSA header elements
 
Methods inherited from class org.apache.http.message.BasicHttpEntityEnclosingRequest
expectContinue, getEntity, setEntity
 
Methods inherited from class org.apache.http.message.BasicHttpRequest
getProtocolVersion, getRequestLine
 
Methods inherited from class org.apache.http.message.AbstractHttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.http.HttpEntityEnclosingRequest
expectContinue, getEntity, setEntity
 
Methods inherited from interface org.apache.http.HttpRequest
getRequestLine
 
Methods inherited from interface org.apache.http.HttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, getProtocolVersion, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
 

Field Detail

v3payload

protected gov.nist.healthcare.core.message.v3.HL7V3Message v3payload

mf

protected static javax.xml.soap.MessageFactory mf

smessage

protected javax.xml.soap.SOAPMessage smessage

sheader

protected javax.xml.soap.SOAPHeader sheader
Constructor Detail

HSV3Request

public HSV3Request(gov.nist.healthcare.core.message.v3.HL7V3Message m,
                   String endpoint)
            throws javax.xml.soap.SOAPException,
                   IOException,
                   SAXException,
                   ParserConfigurationException
Creates a HSV3Request with the provided HL7V3Message as its payload. This constructor is typically used for building outgoing requests.

Parameters:
m -
endpoint -
Throws:
javax.xml.soap.SOAPException - if it is unable to create a new message from the message factory or if it is unable to correctly manipulate the SOAP Header for this message
IOException - if any IO error occurs
SAXException - if the XML factory cannot parse the HL7V3Message
ParserConfigurationException

HSV3Request

public HSV3Request(org.apache.http.HttpEntityEnclosingRequest r)
            throws IOException,
                   org.apache.http.HttpException,
                   javax.xml.soap.SOAPException,
                   org.apache.xmlbeans.XmlException,
                   gov.nist.healthcare.core.MalformedMessageException
Builds an HSV3Request from an entity closing HTTP request. This constructor is typically used for parsing incoming requests.

Parameters:
r -
Throws:
IOException
org.apache.http.HttpException
javax.xml.soap.SOAPException
org.apache.xmlbeans.XmlException
gov.nist.healthcare.core.MalformedMessageException
Method Detail

getStringRepresentation

public String getStringRepresentation()
                               throws javax.xml.soap.SOAPException,
                                      IOException,
                                      SAXException
Builds the string representation of this HTTP Request. This function builds this string from two sources. It uses the stored member headers to construct the correct HTTP header information. It then constructs the HTTP Entity from the stored SOAP Message.

Specified by:
getStringRepresentation in interface HTTPSoapV3Container
Returns:
A string containing the entire content of this message. This includes the HTTP headers and SOAP Envelope contents
Throws:
javax.xml.soap.SOAPException - this container was unable to process the contents of its SOAPMessage
IOException
SAXException

getV3payload

public gov.nist.healthcare.core.message.v3.HL7V3Message getV3payload()
Description copied from interface: HTTPSoapV3Container
Returns the current content of this containers HL7V3Message

Specified by:
getV3payload in interface HTTPSoapV3Container
Returns:
the current content of this containers HL7V3Message

isWSAValid

public boolean isWSAValid()
                   throws DOMException,
                          javax.xml.soap.SOAPException,
                          WSAException
Checks the soap header for this message to determine if it adheres to the following standards: Web Services Addressing 1.0 - Core, ITI TF-2x Appendix V This function is not complete and as of now only checks for cardinality constraints as indicated by the standards and for the required presence of various mustUnderstand attributes.

Specified by:
isWSAValid in interface HTTPSoapV3Container
Returns:
Throws:
DOMException - if the header is not well formed XML
javax.xml.soap.SOAPException - if the header cannot be retrieved
WSAException - when a violation of the cardinality rules is detected

setWSAHeaderValues

public void setWSAHeaderValues(String to,
                               String from,
                               String replyto,
                               String action)
                        throws javax.xml.soap.SOAPException
Sets the values of the required WSA header elements

Parameters:
to -
from -
action -
Throws:
javax.xml.soap.SOAPException