Package org.somda.sdc.dpws.soap
Class SoapUtil
java.lang.Object
org.somda.sdc.dpws.soap.SoapUtil
SOAP utility functions.
-
Method Summary
Modifier and TypeMethodDescriptionCreates an empty SOAP message.createMessage(String wsaAction) Creates a SOAP message with a specific action and empty body.createMessage(String wsaAction, Object firstBodyElement) Creates a SOAP message with a specific action and first body element.createMessage(String wsaAction, String wsaTo) Creates a SOAP message with a specific action and to element.createMessage(String wsaAction, String wsaTo, Object firstBodyElement) Creates a SOAP message with a specific action, to and first body element.createMessage(String wsaAction, String wsaTo, Object firstBodyElement, org.somda.sdc.dpws.soap.wsaddressing.model.ReferenceParametersType referenceParameters) Creates a SOAP message with a specific action, to, the first body element as well as reference parameters.createMessage(org.somda.sdc.dpws.soap.model.Envelope envelope) Creates a SOAP message with the given envelope.Creates a URI with a random UUID.createUriFromUuid(UUID uuid) Creates a URI representation of a UUID.createUuidFromUri(String uri) Converts from a URI to a UUID.determineRequestDistinguishedName(RequestResponseObject requestResponseObject) Determines the caller's distinguished name based on the given request-response object.<T> Optional<T>getBody(SoapMessage src, Class<T> destType) Tries to retrieve SOAP body element fromSoapMessage.<T> voidsetBody(T element, SoapMessage dest) Stores element in destined SOAP body.voidsetWsaAction(SoapMessage response, String action) Takes a response message and sets the WS-Addressing action header.
-
Method Details
-
setBody
Stores element in destined SOAP body.- Type Parameters:
T- the type of element inelement.- Parameters:
element- element to store indest.dest- SOAP message to storeelementin.
-
getBody
Tries to retrieve SOAP body element fromSoapMessage.- Type Parameters:
T- the type to convert to.- Parameters:
src- the source message.destType- type of first element in body.- Returns:
- an instance of T, or Optional.empty() if conversion fails.
-
createUriFromUuid
Creates a URI representation of a UUID.- Parameters:
uuid- the UUID to convert.- Returns:
- a UUID URN.
-
createUuidFromUri
Converts from a URI to a UUID.- Parameters:
uri- the URI to convert.- Returns:
- the converted UUID.
- Throws:
RuntimeException- in case of misformatted URIs.
-
determineRequestDistinguishedName
@Nullable public String determineRequestDistinguishedName(RequestResponseObject requestResponseObject) Determines the caller's distinguished name based on the given request-response object.The string is using the format defined in RFC 2253.
- Parameters:
requestResponseObject- the request-response object containing the communication context.- Returns:
- the caller's distinguished name, or null if no X509 certificate is found in the transport info.
-
createRandomUuidUri
Creates a URI with a random UUID.- Returns:
- the UUID URN.
-
setWsaAction
Takes a response message and sets the WS-Addressing action header.- Parameters:
response- the SOAP response message.action- the action to put to the response message.
-
createMessage
Creates an empty SOAP message.- Returns:
- a new SOAP message.
-
createMessage
Creates a SOAP message with the given envelope.- Parameters:
envelope- the envelope to put to the SOAP message.- Returns:
- a new SOAP message.
-
createMessage
Creates a SOAP message with a specific action and empty body.- Parameters:
wsaAction- the action header to set.- Returns:
- a new SOAP message.
-
createMessage
Creates a SOAP message with a specific action and first body element.- Parameters:
wsaAction- the action header to set.firstBodyElement- the first child of the body element.- Returns:
- a new SOAP message.
-
createMessage
Creates a SOAP message with a specific action and to element.- Parameters:
wsaAction- the action header to set.wsaTo- the to header to set.- Returns:
- a new SOAP message.
-
createMessage
Creates a SOAP message with a specific action, to and first body element.- Parameters:
wsaAction- the action header to set.wsaTo- the to header to set.firstBodyElement- the first child of the body element.- Returns:
- a new SOAP message.
-
createMessage
public SoapMessage createMessage(String wsaAction, String wsaTo, @Nullable Object firstBodyElement, @Nullable org.somda.sdc.dpws.soap.wsaddressing.model.ReferenceParametersType referenceParameters) Creates a SOAP message with a specific action, to, the first body element as well as reference parameters.- Parameters:
wsaAction- the action header to set.wsaTo- the to header to set.firstBodyElement- the first child of the body element.referenceParameters- reference parameters to attach to the message.- Returns:
- a new SOAP message.
-