|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object TransportUtil
public class TransportUtil
Various XKMS transport medium utility functions.
Method Summary | |
---|---|
static void |
appendHTTPResponseHeader(StringBuffer buffer)
Appends HTTP response header to message. |
static String |
discardHTTPResponseHeader(String response)
Discards HTTP response header from String. |
static String |
prependHTTPRequestHeader(String message,
URI uri)
Prepends HTTP request header to message. |
static String |
prependHTTPResponseHeader(String message)
Prepends HTTP response header to message. |
static XMessageAbstractType |
responseStringToMessage(String response,
XKMSContext context)
Converts a response String into a Message and removes the SOAP header, if present. |
static Element |
unwrapSOAP(Element messageElement,
TransportModeEncapsulator transportation)
Checks for SOAP enveloped XKMS Message and returns root element of contained message. |
static String |
wrapMessage(String message,
TransportMethod transportationMethod)
Wraps message in envelope according to a transportation method. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Element unwrapSOAP(Element messageElement, TransportModeEncapsulator transportation) throws InvalidRequestException
null
)
transportation
- the transportation method will be stored to this variable,
if provided (= not null
).messageElement
- root message element. If there is only one message in DOM this is
Document.getDocumentElement().
null
if this was not a SOAP enveloped request. If null
is
returned the transportation
will not be changed.
InvalidRequestException
- if the message seems to be enveloped in SOAP at first but a
contradiction to this assumption is found later on. E.g. the
first element is a correct SOAP "Envelope" but no SOAP-body is
present. The transportation
will not be changed in
this case.public static String wrapMessage(String message, TransportMethod transportationMethod)
SOAP 1.1 wrapping:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
....
</env:Body>
</env:Envelope>
SOAP 1.2 wrapping:
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
....
</env:Body>
</env:Envelope>
message
- message to wrap
public static String prependHTTPResponseHeader(String message)
Prepends:
HTTP/1.0 200 OK Connection: Close Content-Type: text/xml; charset=UTF-8 Content-Length: .... \nto message.
message
- message to prepend header to
UnsupportedEncodingException
- if the calculation of the output length fails due to an
unsupported character encoding in transformation to bytes.
(however, should NEVER happen...).public static void appendHTTPResponseHeader(StringBuffer buffer)
public static String prependHTTPRequestHeader(String message, URI uri)
Prepends:
POST /path HTTP/1.0 Content-Type: text/xml; charset=UTF-8 Host: host.name Connection: Close Cache-Control: no-cache Content-Length: ... \nto message.
message
- message to prepend header touri
- destination to connect to
public static String discardHTTPResponseHeader(String response) throws XKMSException
response
- a response String from the server, inclusive HTTP header
XKMSException
- if the header-body separation is not found. If HTTP response
was not '200 OK'. If message has no XML declaration and also
no or wrong HTTP 'Content-Type' header.public static XMessageAbstractType responseStringToMessage(String response, XKMSContext context) throws XKMSException
Call this method only if you don't know the wrapping status of
the message. If there is no SOAP wrapping, directly call
XKMSContext.StringToMessage
instead, which is more efficient.
response
- a response String
XKMSException
- if something goes wrong
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |