This section explains how to use the SOAP functions to parse information from incoming requests, and to construct outgoing messages (responses and requests) in your rules and rule functions.
This manual does not explain how to work with the SOAP protocol. For example, you should understand how the
Actor and
MustUnderstand attributes in SOAP headers are used to process the message as it passes from its originator, through intermediary applications, to its ultimate destination.
An incoming SOAP message can be a request, or a response, depending on whether TIBCO BusinessEvents is acting as the server or the client. TIBCO BusinessEvents can also act as an intermediate node along the path of a SOAP message to its ultimate destination. This section explains how to parse (get) information out of the incoming event payload, which contains the SOAP message.
<sch:Second>2</sch:Second>
If the actor parameter has a null value then all the immediate children of the Header element are retrieved:
Otherwise, the header specified by the actor attribute is retrieved. For example, given this Headers element in a SOAP event payload:
<t:user xmlns:t="http://schemas/xml.com" soapenv:mustUnderstand="true"
soapenv:actor="http://localhost:9090/Service">jon</t:user>
<t:user_surname xmlns:t="http://schemas/xml.com"
soapenv:mustUnderstand="true"
soapenv:actor="http://localhost:9090">smith</t:user_surname>
To remove the specified header part or parts, set the final parameter to true. (The SOAP specification states that if a header is processed it should be removed. You would remove a header if TIBCO BusinessEvents is acting as an intermediary node and the request created using the SOAP functions will be sent on to another server.)
<t:user xmlns:t="http://schemas/xml.com" soapenv:mustUnderstand="true"
soapenv:actor="http://localhost:9090/Service">jon</t:user>
The getAllSOAPBodyParts() function simply returns all SOAP body parts.
The getSOAPBodyParts() function allows you to specify which parts are of interest. Given a body part name and a namespace for a specified SOAPEvent, it returns a String array of matching SOAP body parts in serialized form. Name and namespace parameters can’t be null.
And this soapeventin event payload:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.tibco.com/schemas/SoapOverHttp/Schema/Schema.xsd" xmlns:temp="http://temp/">
<sch:Second>2</sch:Second>
<sch:child1>3</sch:child1>
<sch:child2>4</sch:child2>
</soapenv:Body> </soapenv:Envelope>
<ns0:Second>2</ns0:Second>
The content ID is the attachment identifier. You can select which attachment to work with using its index position. First get the count of the attachments using getNumberOfAttachments(). Then using the index, you can get the content ID and content type, as well as the attachment content itself.
addFaultPart(SimpleEvent outSOAPEvent, String
faultCode, String
faultMessage, String
faultActor, String
faultDetailString)
TIBCO BusinessEvents adds each type of fragment to the appropriate part of the event payload—header, body, or fault. The fragments must be well-formed XML. You can also add attachments.
The specified body part is added to the correct place in the outline structure of the SOAP message, which is provided by the SOAPEvent. The resulting payload would look similar to the following:
<ns0:BookStore xmlns:ns0="HTTP://www.abc.com/xsd/books">
<ns0:Author>J.K.Rowling</ns0:Author></ns0:BookStore>"