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 BusinessEvents is acting as the server or the client. 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.String getEnvelope(SimpleEvent inSoapEvent)Given a request SOAPEvent, this function returns the SOAP envelope in the request event payload, for example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.tibco.com/schemas/SoapOverHttp/Schema/Schema.xsd" >
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:
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 BusinessEvents is acting as an intermediary node and the request created using the SOAP functions will be sent on to another server.)
String[] getSOAPHeaderAttribute(SimpleEvent inSoapEvent, int index, String attribute)String[] getAllSOAPBodyParts(SimpleEvent inSoapEvent)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.
String[] body_part= getSOAPBodyParts
(soapeventin,"root",http://www.tibco.com/schemas/SoapOverHttp/Schema/Schema.xsd)
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/">
getNumberOfAttachments(SimpleEvent inSOAPEvent)getAttachmentContentType(SimpleEvent inSOAPEvent, int Index)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.The content is returned in byte form, so after you get the content, you must then use other functions to make the content human-readable.The following functions enable you to work with the standard SOAP Fault XML nodes from the payload of a SOAP event:You can add header parts, body parts, fault parts and attachments to the outgoing SOAP message (whether it is a response or a request).addSOAPHeaderAttribute(SimpleEvent outSOAPEvent, int index, String attribute, String value)addFaultPart(SimpleEvent outSOAPEvent, String faultCode, String faultMessage, String faultActor, String faultDetailString)addAttachment(SimpleEvent outSOAPEvent, String contentID, String content, String contentType, String contentEncoding)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.For example, to add a body part containing information for a response you would include all the required details including any namespace information:
SOAP.addSOAPBodyPart(outSOAPEvent,"<ns0:BookStore xmlns:ns0=\"http://www.abc.com/xsd/books\"><ns0:Book><ns0:Author>J.K.Rowling</ns0:Author></ns0:Book></ns0:BookStore>");
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:
Copyright © TIBCO Software Inc. All Rights Reserved.