communication
Class HSV3Response

java.lang.Object
  extended by org.apache.http.message.AbstractHttpMessage
      extended by org.apache.http.message.BasicHttpResponse
          extended by communication.HSV3Response
All Implemented Interfaces:
HTTPSoapV3Container, org.apache.http.HttpMessage, org.apache.http.HttpResponse

public class HSV3Response
extends org.apache.http.message.BasicHttpResponse
implements HTTPSoapV3Container

Holds an instance of an HTTP response 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 response by being presented a HL7V3Message or by being given a raw HTTPResponse. All SOAP messages are created/parsed using the SOAP 1.2 Protocol. All HTTP messages are encoded using the HTTP 1_1 protocol and are generated with an OK HTTP Status.

Author:
Michael Ogata

Field Summary
protected  javax.xml.soap.MessageFactory mf
           
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
HSV3Response()
          Creates an empty response.
HSV3Response(org.apache.http.message.BasicHttpResponse r)
          Extracts the HL7V3Message from a BassicHttpResponse whose entity is SOAP enclosed HL7V3Message.
HSV3Response(gov.nist.healthcare.core.message.v3.HL7V3Message m)
          Creates a response with the specified HL7V3Message as its payload
 
Method Summary
 String getStringRepresentation()
          Builds the string representation of this HTTP Response.
 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.BasicHttpResponse
getEntity, getLocale, getProtocolVersion, getReason, getStatusLine, setEntity, setLocale, setReasonPhrase, setStatusCode, setStatusLine, setStatusLine, setStatusLine
 
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.HttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
 

Field Detail

v3payload

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

mf

protected final javax.xml.soap.MessageFactory mf

smessage

protected javax.xml.soap.SOAPMessage smessage
Constructor Detail

HSV3Response

public HSV3Response()
             throws javax.xml.soap.SOAPException
Creates an empty response. Internal members are initialized to null

Throws:
javax.xml.soap.SOAPException - in the event the Message factory could not be created or the SOAPMessage could not be created

HSV3Response

public HSV3Response(gov.nist.healthcare.core.message.v3.HL7V3Message m)
             throws javax.xml.soap.SOAPException,
                    SAXException,
                    IOException,
                    ParserConfigurationException
Creates a response with the specified HL7V3Message as its payload

Parameters:
m - the HL7V3Messasge that is to be the payload of this response
Throws:
javax.xml.soap.SOAPException - in the event the Message factory could not be created or the SOAPMessage could not be created
SAXException
IOException
ParserConfigurationException

HSV3Response

public HSV3Response(org.apache.http.message.BasicHttpResponse r)
             throws IOException,
                    org.apache.http.HttpException,
                    javax.xml.soap.SOAPException,
                    org.apache.xmlbeans.XmlException,
                    gov.nist.healthcare.core.MalformedMessageException
Extracts the HL7V3Message from a BassicHttpResponse whose entity is SOAP enclosed HL7V3Message. This method consumes this object's entity content.

Parameters:
r - contains the response message.
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,
                                      ParserConfigurationException
Builds the string representation of this HTTP Response. 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
ParserConfigurationException

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