Action: Input

By

November 26, 2008

 

 
 

 

Choose a format in which to download the results of the query.  The Action: Input type provides the ability to pull information from External sources, via a standard URL driven web request. This can be used for fetching data from external sites, triggering specific external actions, or most commonly, interaction with Web Services.
•    URL -Specifies the URI/URL source of the web request.
•    Authentication Type – Specify whether a specific, or general authentication is required to communicate with your external source.
•    Query String- Specifies any information passed within the formatted querystring request on the URL.
•    Data - specifies any information passed within the formatted data request on the URL.
•    Content Type - Content type is required when interacting with web services.  
•    Method (GET/POST/SOAP) - Specifies how the interaction with the Input request will operate.
•    Soap Action – Depending on the SOAP method, communication with an  external SOAP resource may require that the SOAP action be specified.  This setting is provided in the content of your Soap Header – and can be identified through the WSDL interface for the particular system.
•    Soap Result Tag – When SOAP is employed, the content of the envelope is contained in a specific tag in the resulting XML Review the SOAP result from WSDL. The Result tag is easily identified as the tag which contains XML data that has been encoded. Setting the SOAP Result Tag specifies which tag contains this content, and is automatically digested as the Result XML value.
•    Response Format (TEXT/XML) - Specifies whether the returning content will be XML or TEXT. Text values will be assigned directly to the provided variable. XML content will use the additional XML Path (XPATH Expression) text value, formatting the incoming data to obtain just the most required information.
•    Variable Type - The type of the variable assignment.
•    Name - The name of the variable within the Variable Type.
•    XML Path -  The XPATH expression utilized to get the specified XML Tag value to be stored within the Variable.

Common Input Scenarios


There are two common approaches to working with Input calls, one, the XML Service which is demonstrated in the Example for the Yahoo Geo Coding. This would involve no SOAP interaction, and therefore more linear.  The second type of input uses the Web Service approach via SOAP. Provide below are samples of each configuration.

XML Based Web Service


In the following scenario, taken from the GEO Coding Web Service later in this documentation, we are integrating with the Yahoo Maps Geocode service which returns XML structured results for the physical Latitude and Longitude. To do this, add an Action:Input action. The following variables will need to be assigned for the Yahoo service to work appropriately.

URL – this will be assigned to the documented API Maps Service call provided by Yahoo:
http://api.local.yahoo.com/MapsService/V1/geocode

Content Type – as stated within the documentation, the Content Type parameter can at times be tricky to set correctly, many times depending on the exact formulation of the service to which you are cooresponding. However, this sample is a perfect solution for persons who are communicating directly with standard web service interfaces. For most situations, including this one use:

    application/x-www-form-urlencoded    


Query String – depending on the target communication, as well as the Method, you may or may not need to use the query string, but rather, the Data region of the Input action. For the Yahoo API, the Request Query String is straight forward and easy to use. The first thing you will need before using the form, is a correct App Id, which you can create via the provided Yahoo link above. The additional parameters are strung directly within

the parameter, so they are easy to see, and configure:


appid=[frmAppId,Form]&zip=[frmZip,Form]&street=[frmStreet,Form]&city=[frmCity,Form]&state=[frmState,Form]

Method – the provision requires the GET method, for the standard URL request.

POST METHOD NOTE : When using the POST method you must assign the content type to     application/x-www-form-urlencoded  and place the form variables into the Query String input.



Response Format – the resulting response from Yahoo, atleast at the time of this documentation, is XML formatted, and looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:maps"
xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd">
  <Result precision="address">
    <Latitude>37.416384</Latitude>
    <Longitude>-122.024853</Longitude>
    <Address>701 FIRST AVE</Address>
    <City>SUNNYVALE</City>
    <State>CA</State>
    <Zip>94089-1019</Zip>
    <Country>US</Country>
  </Result>
</ResultSet>


Variable Type – the target location where the incoming result parsing will be stored, for our demonstration, this is: <Session>

Name – this identifies either the name of the target variable, when the path is explicitly defined, or may be a variation of multiple possible values, which is the case here. Our XML Path will set the location to be on the node reading “<Result precision=address>” Since we need more than one of the parameters – in our case, we need both the Latitude and the Longitude, we will need to use some special additional formatting on the Name of the storage variable. The possible additional values are [*Child], meaning we will be assigning multiple variables, with the [*Child] tag replaced by the name of the child nodes, ie. ResultLatitude,ResultLongitude,ResultAddress et al. The other possibility, is the [*Index] tag, which means that each result will be placed with an index attached, for all child records. Our sample does not use this structure, nor does it need it, but if you had multiple Result tags within the Result Set, and wanted to keep all the returned values, that is what you would need to use also. In our case, the following is provided:
Result[*CHILD]

XML Path - Finally, the actual XML Path of the result will be used. Because the incoming result assigned a default namespace to the document, a namespace urn is required for parsing the incoming content. OWS automatically builds a Names table of all the possible namespaces, but when the default is overridden, the specified name is not possible. However, the default namespace has been given a fixed name within OWS, and is by design to allow for easy checking of XML values. To use the root namespace, when this is the case, use “default” as the namespace name. With that said, for this example:

.//default:Result

SOAP Based Web Service


Working with the more popular SOAP web service protocols is also possible with the Input action, and requires only a few modifications to the previous scenario. For this sample we created a dummy web service which simply returns the information about the incoming TabID requested.

First, access the WSDL (Discovery Page) for the target web service. For our case the WSDL was accessible via our development url of : http://dnn.bi4ce.com/Services/DemoService.asmx?op=GetInfo

This is exactly as you would access your own web service call. Once executed, review the package request for the SOAP (1.1) as defined as:

POST /Services/DemoService.asmx HTTP/1.1
Host: dnn.bi4ce.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/OWSWebService/Service1/GetInfo"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetInfo xmlns="http://tempuri.org/OWSWebService/Service1">
      <TabID>int</TabID>
      <StraightPass>string</StraightPass>
    </GetInfo>
  </soap:Body>
</soap:Envelope>


Looking in the configuration for the calling web service, all aspects of this Request SOAP data are handled:

URL
The URL of the web service itself – http://dnn.bi4ce.com/services/demoservice.asmx

Authentication Type
Our server requires no Authentication for this action, but you may require this setting for your target server, depending on the security of your data and the library.

Content Type
Executing this SOAP web service requires:  text/xml; charset=utf-8 as defined within third line of the required SOAP envelope

QueryString
No querystring is required for this webservice call, but if Querystring Parameters are required, add them here in name=value& format.

Data
The data follows the requirements of the package envelope specifically, with the parameters filled in as required by the configuration. So referring to the envelope itself the data value is:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetInfo xmlns="http://tempuri.org/OWSWebService/Service1">
      <TabID>1179</TabID>
      <StraightPass>Also a Test</StraightPass>
    </GetInfo>
  </soap:Body>
</soap:Envelope>

 

 

Method
The method selected here is SOAP because we are using that protocol for this request.

SOAP Action
Also provided in the SOAP Envelope is the required SOAP Action parameter. This should appear exactly as requested in the envelope itself. For our sample it is designated as (including quotes):

"http://tempuri.org/OWSWebService/Service1/GetInfo"

SOAP Result Tag
The GetInfoResult tag, identified by the SOAP Result Tag option provides the ability to automatically open the envelope and extract the contents of the result you require. For our sample, the Result Envelope structure provided by the WSDL request was as follows:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetInfoResponse xmlns="http://tempuri.org/OWSWebService/Service1">
      <GetInfoResult>string</GetInfoResult>
    </GetInfoResponse>
  </soap:Body>
</soap:Envelope>


As provided here, we will want to extract the contents of the GetInfoResult element which will contain the result value we desire.

Response Format
For this sample, the GetInfoResult string will contain an HTML Encoded representation of the XML serialized Tab Information, appears as the following and is specified as XML format -

<Result>
<ResultItem>
 <Tab>
<Name>TinyMCE example</Name>
<Title>TinyMCE example</Title>
<PortalID>0</PortalID>
<isSystem>False</isSystem>
</Tab>
 <Tab>
 <PassThrough>Also a Test</PassThrough>
</Tab>
 </ResultItem>
 </Result>


Name / Variable Type
The variable type identifies which variable we are assigning the value we are pulling from the result into. This is handled through the NAME and VARIABLE TYPE settings

XML Path
When reading the XML path, we are identifying the Path which contains the value, or values we are interested in. For this sample, the Result tag is what we are using, but this is dependent on your physical web service call.




 

 

Average (2 Ratings):
 
Want to help out?
 
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share