Forms: HTTP Collector
...
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
...
Form: HTTP Collector Details
The HTTP Collector form contains a number of tabs:
...
...
...
...
...
Please see Response Examples for how the returned data can be used and evaluated in the corresponding stream attribute expressions.
...
...
...
...
Field | Description |
---|---|
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 Expression | An expression to generate the data that will be sent by the exporter to the datasource. For Example <?xml version ="1.0"?> <!DOCTYPE CORPORATE DASHBOARD "corpDash.dtd"> <results user="%USERNAME%" password="%PASSWORD%"> <monthlyTotals region={'"' + Region + '"'} division={'"' + Division + '"'}> <totalBilled>{'"' + TotalBilled + '"'}<\totalBilled> <totalCollected>{'"' + TotalCollected + '"'}<\totalCollected> <monthlyTotals> <\results> |
...
Field | Description |
---|---|
Response Type | The type of the expected response : XML/HTTP/String |
XPath | The XPath expression used to resolve or filter the data that comes back in XML or HTML format. Note that Xpath namespaces syntax can only be used for XML response types. |
The following fields are configured on the Description tab:
Field | Description |
---|---|
Description | A freeform description of the HTTP collector. |
Reponse Examples
...
Given the following XML and HTML data that is being pointed to by either HTTP datasources or XML/HTML File collectors respectively.
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Note that the namspace prefix used here 'h' must be configured in the HTTP XML Namspaces form
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
<html> <body nodename="Html Body"> <table> <tbody> <tr> <td initials="AD">Ali Dawson</td> <td initials="GP">Gary Parden</td> </tr> </tbody> </table> </body> </html>
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Default XML namespaces
...
The following example illustrates how a default namespace defined in an XML response is handled.
<?xml version="1.0" encoding="UTF-8"?> <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"> <soapenv:Body> <queryResponse> <result xsi:type="QueryResult"> <done>true</done> <queryLocator xsi:nil="true"/> <record xsi:type="cv:sObject"> <cv:type>Account</cv:type> <cv:Name>Company1</cv:Name> <cv:CreatedDate>2013-10-31T11:26:21.000Z</cv:CreatedDate> </record> <record xsi:type="cv:sObject"> <cv:type>Account</cv:type> <cv:Name>Company2</cv:Name> <cv:CreatedDate>2013-10-31T11:26:21.000Z</cv: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
Form Icons
The form provides the standard form icons