Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

FieldDescription
DetailsThe main details required for HTTP Collector configuration.
Send MessageDefine details of the HTTP request sent to the HTTP Datasource to get the data required.
HTTP HeadersFor an HTTP request, define name value pairs to include as part of the HTTP header. (e.g. content-type)
ResponseDefine the data response type/format that will be returned:
  • HTML: response type allows an XPath Expression to be specified in order to retrieve just specified sections of the data into XML structures.
  • XML: response type allows an XPath Expression to be specified in order to retrieve just specified sections of the data into XML structures. XML response types also support XML namespaces. The Xml Namspaces tab will be available when this response type is chosen.
  • String: response type will return the full data as a string value.

Please see Response Examples for how the returned data can be used and evaluated in the corresponding stream attribute expressions.

XML NamespacesThe namespaces defined in an XML response. The names given to these namespaces must match those used in any Xpath expressions used to extract data from an XML response. See examples below.
DescriptionA free text field for you to enter a description of the HTTP Collector.

...

FieldDescription
URL Expression

The URL to be used, without the leading http:// prefix. The URL may contain embedded expressions within { }. If this field is blank, the url field on the httpDatasourceInstance is used directly.

For Example, this expression adds to the base url provided by the HTTP Datasource Instance :

{_url}/sub1/sub2?param1=3

Statement ExpressionAn expression to generate the data that will be sent by the exporter to the datasource. For Example

&lt<?xml version ="1.0"?&gt &lt> <!DOCTYPE CORPORATE DASHBOARD "corpDash.dtd"&gt &ltresults > <results user="%USERNAME%" password="%PASSWORD%"&gt &ltmonthlyTotals > <monthlyTotals region={'"' + Region + '"'} division={'"' + Division + '"'}&gt &lttotalBilled&gt> <totalBilled>{'"' + TotalBilled + '"'}&lt\totalBilled&gt &lttotalCollected&gt<\totalBilled> <totalCollected>{'"' + TotalCollected + '"'}&lt\totalCollected&gt &ltmonthlyTotals&gt &lt\results&gt <\totalCollected> <monthlyTotals> <\results>

 

 

Anchor
response
response
The following fields are configured on the Response tab:

...

FieldDescription
DescriptionA freeform description of the HTTP collector.

Reponse Examples

Anchor
responseExamples
responseExamples

 

Given the following XML and HTML data that is being pointed to by either HTTP datasources or XML/HTML File collectors respectively.

XML Data &lt <?xml version ="1.0"?&gt &ltroot > <root xmlns:h="http://www.w3.org/TR/html4/"&gt &ltmain > <main page="CV Main Page" &gt &lth> <h:title h:name="CV Title"&gtCV >CV Title Text &lth:datarow&gt &lth<h:datarow> <h:data h:initials="AD"&gtAli Dawson&lt>Ali Dawson</h:data&gt &lthdata> <h:data h:initials="GP"&gtGary Parden&lt>Gary Parden</h:data&gt &ltdata> </h:datarow&gt &ltdatarow> </h:title&gt &lttitle title> <title name="Non namespace Title"&gtNon >Non namespace Title Text&lt/title&gt &lt/main&gt &lt/root&gt
HTML Data &lthtml&gt &ltbody Text</title> </main> </root>
HTML Data <html> <body nodename="Html Body"&gt &lttable&gt &lttbody&gt &lttr&gt &lttd > <table> <tbody> <tr> <td initials="AD"&gtAli Dawson&lt/td&gt &lttd >Ali Dawson</td> <td initials="GP"&gtGary Parden&lt/td&gt &lt/tr&gt &lt/tbody&gt &lt/table&gt &lt/body&gt &lt/html&gt >Gary Parden</td> </tr> </tbody> </table> </body> </html>

The following table shows the different types of responses that can be returned from an HTTP Collector and how these can be used in the corresponding stream attribute expressions. A HTTP Collector response type of XML/HTML will mimic the responses from XML/HTML Collectors respectively.

Response TypeXPath ExpressionExplanation
Stringn/aA String response should be referenced in the stream attribute expressions as in.value Note that in.value will contain the complete string data referenced above.
XML/root/main/h:title

Note that the namspace prefix used here 'h' must be configured in the HTTP XML Namspaces form

This XPath expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. i.e

&ltroot <root xmlns:h="http://www.w3.org/TR/html4/"&gt &ltmain > <main page="CV Main Page" &gt &lth> <h:title h:name="CV Title"&gtCV >CV Title Text &lth:datarow&gt &lth<h:datarow> <h:data h:initials="AD"&gtAli Dawson&lt>Ali Dawson</h:data&gt &lthdata> <h:data h:initials="GP"&gtGary Parden&lt>Gary Parden</h:data&gt &ltdata> </h:datarow&gt &ltdatarow> </h:title&gt &lt/main&gt &lt/root&gt title> </main> </root>

The following examples show how to reference the returned xpaths html/xml data structure in stream attribute expressions:-
  • Xpath element text value: in.value -&gt > returns 'CV Title Text'
  • Xpath element attibutes: in.h$name -&gt > returns 'CV Title'
  • Xpath parent attributes: in.^.page -&gt > returns 'CV Main Page'
  • Xpath child attributes: listToString(in.h$datarow.h$data.h$initials) -&gt > returns 'AD,GP'
  • Xpath child attribute text values: listToString(in.h$datarow.h$data.value) -&gt > returns 'Ali Dawson,Gary Parden'

Note the use of a $ instead of our usual : namespace notation.

Note the use of a ^ to traverse to the immediate parent element.

Note the use of the listToString function to handle multiple matching child elements/attributes.

HTML/html/body/table

Note that namspaces are not supported in the Xpath expression for HTML response types

This XPath expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. i.e

&lthtml&gt &ltbody <html> <body nodename="Html Body"&gt &lttable&gt &lttbody&gt &lttr&gt &lttd > <table> <tbody> <tr> <td initials="AD"&gtAli Dawson&lt/td&gt &lttd >Ali Dawson</td> <td initials="GP"&gtGary Parden&lt/td&gt &lt/tr&gt &lt/tbody&gt &lt/table&gt &lt/body&gt &lt/html&gt >Gary Parden</td> </tr> </tbody> </table> </body> </html>

The following examples show how to reference the returned xpaths html/xml data structure in stream attribute expressions:-
  • Xpath parent attributes: in.^.nodename -&gt > returns 'Html Body'
  • Xpath child attributes: listToString(in.tbody.tr.td.initials) -&gt > returns 'AD,GP'
  • Xpath child attribute text values: listToString(in.tbody.tr.td.value) -&gt > returns 'Ali Dawson,Gary Parden'

Note the use of a ^ to traverse to the immediate parent element.

Note the use of the listToString function to handle multiple matching child elements/attributes.

Note the use of the optional html &lttbody&gt <tbody> tags. If these are not in your html data, then phixflow will insert them to conform with the HTML standards. Therefore when using absolute XPath expressions, note that the tbody tags need to be included even if they are not present in the incoming HTML data.
i.e /html/title/table/tr should be replaced with /html/title/table/tbody/tr. Alternativley you can use //tr
The same applies when referencing parent/child nodes within the stream attribute expressions.

 

Default XML namespaces

Anchor
responseExamplesDefaultNamespace
responseExamplesDefaultNamespace

 

The following example illustrates how a default namespace defined in an XML response is handled.

&lt<?xml version="1.0" encoding="UTF-8"?&gt &ltsoapenv> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:xmlns:company-com:message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cv="urn:phixflow.message.com"&gt &ltsoapenv:Body&gt &ltqueryResponse&gt &ltresult > <soapenv:Body> <queryResponse> <result xsi:type="QueryResult"&gt &ltdone&gttrue&lt/done&gt &ltqueryLocator > <done>true</done> <queryLocator xsi:nil="true"/&gt &ltrecord > <record xsi:type="cv:sObject"&gt &ltcv:type&gtAccount&lt> <cv:type>Account</cv:type&gt &ltcv:Name&gtCompany1&lttype> <cv:Name>Company1</cv:Name&gt &ltcv:CreatedDate&gt2013Name> <cv:CreatedDate>2013-10-31T11:26:21.000Z&lt000Z</cv:CreatedDate&gt &lt/record&gt &ltrecord CreatedDate> </record> <record xsi:type="cv:sObject"&gt &ltcv:type&gtAccount&lt> <cv:type>Account</cv:type&gt &ltcv:Name&gtCompany2&lttype> <cv:Name>Company2</cv:Name&gt &ltcv:CreatedDate&gt2013Name> <cv:CreatedDate>2013-10-31T11:26:21.000Z&lt000Z</cv:CreatedDate&gt &lt/record&gt &ltsize&gt2&lt/size&gt &lt/result&gt &lt/queryResponse&gt &lt/soapenv:Body&gt &lt/soapenv:Envelope&gt CreatedDate> </record> <size>2</size> </result> </queryResponse> </soapenv:Body> </soapenv:Envelope>

Since this document uses a default namespace ("urn:xmlns:company-com:message"), to refer to any element in an XPath expression that does not explicitly use a namespace you must use the default namespace. So to extract all record elements, you must first define a namespace in the collector for the default namespace. Suppose that you do and give this the name def. Then the XPath (defined in the XPath field on the Response tab) to extract all record elements will be //def:record

In a Stream that reads from this collector, any other namespaces defined in the document are used as normal. For example, to write the value from the element Name within each record element to a Stream attribute, you would use the attribute expression in.sf$Name

...