1.3.10.5 Call External Web Service
The Call External Web Service processor calls any REST web services that can be reached over standard HTTP/HTTPS connections from the EDQ server, using the processor configuration information, input data, and payload structure (that you provide) and parses the results to the output attributes of this processor. You can use it as a standalone processor, or in conjunction with other processors. For example - Calling Oracle SaaS applications REST web services to get, insert or update data.
The following table describes the configuration options for Call External Web Service processor :
Configuration | Description |
---|---|
Input Attributes |
Input attributes can be String, Number, String Array, or Number Array. You can use these attribute values in the request payload, and/or substitute them in to the web service URL, or HTTP headers (from the Advanced tab). Note: You must specify at least one input attribute to work with the processor. |
Output Attributes |
There are two types of output attributes. They are:
|
Options |
The following options are available in the Options tab:
|
Request |
The Request tab constitutes the request payload. Its values greatly vary based on the configuration that you perform on the Options tab. It has the following components:
|
Response |
The Response tab helps you to create output attributes from the web service response. It will read the desired value from the response payload as per the configuration while creating the attributes. It constitutes the following three attributes. They are:
To create an attribute, click the Add icon present at the left bottom corner of the Response tab. Add Attribute dialog appears, allowing you to type-in the Attribute Name, select the Type (String, String Array, Number or Number Array), enter the Payload Variable name, and select the Level (Record or Message).
Note: The Level option is enabled/displayed only when you set
Here are examples of level and payload selection attribute types.
Note: This option is enabled/displayed only when you set:
For Example -
|
Advanced |
The Advanced tab allows you to configure the following options:
|
Some of the advanced features of Call External Web Service processor are:
-
Array Support -
- Input Attribute -
- This processor supports Number array and String array.
- Selected input array can be used in request payload as
{"arr" : ${array}},
, where array is the name of selected input attribute.
- Output Attribute - You can create output attribute of type string array and number array from the response tab.
For example -
{"arr" : ${array}}, {"arr" : ["a", "c\"d", null]}, {"arr" : [1,2,null, 3]}
. - Input Attribute -
- Adding HTTP Header Information - You can define multiple HTTP headers. Selected Input attribute can be used to substitute the HTTP header value, in the format
${InputAttribute}
. Refer to the Advanced tab section for more details. - Adding Multiple Output Attributes - You can create multiple outputs to read the value from response payload. Refer to Response tab section for more details.
-
Multirecord Handling - Multiple records can be send in a single request to the web service. This feature can be used only with the web service that supports multiple records in a request.
There are two main use cases supported for this feature. They are:
- Multirecord web services where the whole payload is a structure containing multiple records.
JSON Message Structure of Request tab should be left empty to handle this use case. Therefore the requested payload will be an array of records.
- Multirecord structures and additional attributes in the outer JSON structure.
You need to use a special template $records$ in JSON Message Structure in request tab to handle this use case.
For Example -JSON Message Structure : { "company":"Oracle", "data_type":"product_info", "records":$records$ } JSON Record Structure : { "product_id":${id}, "product_name":"${name}" }
The final request payload for the input data {(id=11,name=product1), (id=21,name=product2)} would be,{ "company":"Oracle", "data_type":"product_info", "records": [{"id":11,"name":"product1"},{"id":21,"name":"product2"}] }
Note:
Id and name used in JSON record structure are the selected input attributes of the processor.Multirecord Specific Settings :
- Option - Method Post , Multirecord Request/Response =Yes, Batch count ( Minimum value is 50 )
- Request - JSON Message Structure and JSON Record Structure
- Response -
- Create output as per the web service response payload structure ( See the above Response section for more details)
- Record Path - Path of records in response payload. It can be left blank if the response payload is an array of records.
Note:
Supports N:N request, where Response Payload must contain N records, for N records sent in Request Payload .
- Multirecord web services where the whole payload is a structure containing multiple records.
- Parameter Substitution in the URL - Selected input attributes can be used to substitute the parameter value in a web service URL.
For Example -
http:webservice.com?Product_id=${ID}
, where ID is a selected input attribute.
Null Handling in Request Payloads
- If the attribute reference is not enclosed in quotes (for a number, boolean or array value), then the attribute is replaced with the JSON value null. For example -
{ "num" : ${numval} }
becomes{ "num" : null }
after substitution if, the attributenumval
is null. - If the attribute reference is the only content in a quoted value, then the quotes are removed and the replacement is the JSON value null. For example -
{ "str" : "${strval}" }
becomes{ "str" : null }
after substitution if, the attributestrval
is null. - If the attribute reference is not the only content in a quoted value, then the attribute replacement is the empty string. For example -
{ "str" : "abc${strval}def" }
becomes{ "str" : "abcdef" }
after substitution if, the attributestrval
is null.
Examples
- In this example, Call External Web Service is used to fetch the company details of a campus. Campus name will be send as part of the web service URL and the response from the web service will constitute the company details operating from that specific campus.
The configured options are:
Configuration Options Values Attribute
Selected Input - Name - Campus Name
- Type - String
Options
- Method - GET
- URL -
http://webservice.com/companyinfo?name=${Campus Name }
- Multirecord Request/Response - Disabled
Request
JSON Payload Structure - Disabled Response
Response Payload Structure - { "Company": "Company Name", "Countryā€¯: "Country Code", "Departments":[{"id":DepartmentId,"Name":"DepartmentName"} ...] }
Output Attributes
-
Name = Company Name
Type = String
Payload Variable = Company
-
Name = Country Code
Type = String
Payload Variable = Country
-
Name = Department List
Type = String Array
Payload Variable = Departments.Name
-
Name = Department ID List
Type = Number Array
Payload Variable = Departments.Id
Web service Request / Response with input:
Input Attribute URL Response Payload Campus Name = Campus1
http://webservice.com/companyinfo?name=Campus1
{ "Company": "Oracle", "Country": "IN", "Departments":[{"id":101,"Name":"Department_1"},{"id":102,"Name":"Department_2"}, {"id":103,"Name":"Department_3"}] }
Summary View:
Campus Name HTTP Response Code HTTP Response Message Web Service Error Message Company Name Country Code Department List Department ID List Campus1
200
OK
<Nil>
Oracle
IN
{Department_1}{Department_2} {Department_3}
{101}{102}{103}
- In this example, Call External Web Service is used to get the details of cities in a state.
The configured options are:
Configuration Options Values Attribute Selected Input:
-
Name = Country
Type = String
-
Name = State
Type = String
-
Name = Reference ID
Type = Number
Options - Method - POST
- URL -
http://webservice.com/cityinfo
- Multirecord Request/Response - No
Request JSON Payload Structure { "CountryName" : "${Country}", "StateName" : "${State}", "RefId" : "${ReferenceId}" }
Response Response Payload Structure - { "CountryName" : "Name", "CountryCode" : "Code", "StateName" : "State Name", "StateData" : {"id":id,"CityDetails":{"Count":count,CityList:["City1","City2", . . . . . ]}} }
Output Attributes - Name = City Count
Type = Number
Payload Variable =
StateData.CityDetails.Count
- Name = City Name
Type = String Array
Payload Variable =
StateData.CityDetails.CityList
Web service Request / Response with input:
Input Attribute URL Response Payload Country = Country_1 State = ST1 ReferenceID = 121
{ "CountryName" : "Country_1", "StateName" : "ST1", "RefId" : 121 }
{ "CountryName" : "Country_1", "CountryCode" : "CC", "StateName" : "ST1", "StateData" : {"id":221,"CityDetails":{"Count":21,CityList:["City1","City2","City3","City4"]}} }
Summary View:
Country State Reference ID HTTP Response Code HTTP Response Message Web Service Error Message City Count City Name Country1 State1 11 200 OK <Nil> 21 {City1}{City2}{City3}{City4} -
- In this example, Call External Web Service is used to get the list of customers using a product. This configuration allows you to send and receive multiple records in a single web service call. If N records are sent in a single request, then a valid response from the web service will also contain N records .
The configured options are:
Configuration Options Values Attribute Selected Input:
-
Name = Product Name
Type = String
-
Name = Code
Type = Number
Options - Method - POST
- URL -
http://webservice.com/multirecords
- Multirecord Request/Response - Yes
- Batch Record - 50
Request - JSON Message Structure -
{ "Request Name" : "Product_Cus_List", "RefId" : 101, "Records" : $records$ }
- JSON Payload Structure -
{ "ProductName" : "${ProductName}", "Product Code" : ${ code } }
Response - Response Payload Structure -
{ "Company" : "Company Name", "MetaData" : "Product Customer List", "Records" : [ {"ProductName" : "P1","Cus_List":["Cus1", "Cus2"]} . . . . . ] }
- Record Path - Records
Attribute Options -
Name = Company
Type = String
Payload Variable = Company
Level = Message
-
Name = Metadata
Type = String
Payload Variable = Metadata
Level = Message
-
Name = Product
Type = String
Payload Variable = productName
Level = Record
-
Name = Customers
Type = String Array
Payload Variable = Cus_List
Level = Record
Web service Request / Response (5:5):
Input Attribute Request Payload Response Payload - Product Name = Prod1 Code = 41
- Product Name = Prod2 Code = 512
- Product Name = Prod3 Code = 986
- Product Name = Prod4 Code = 994
- Product Name = Prod5 Code = 208
{ "Request Name" : "Product_Cus_List", "RefId" : 101, "Records" : [ { "ProductName " : "Prod1", "Product Code":41}, { "ProductName " : "Prod2", "Product Code":512}, { "ProductName " : "Prod3", "Product Code":986}, { "ProductName " : "Prod4", "Product Code":994}, { "ProductName " : "Prod5", "Product Code":208} ] }
{ "Company": "Comp1", "MetaData" : "Product Customer List", "Records" : [ {"ProductName" : "Prod1","Cus_List":["P1_Cus1", "P1_Cus2", "P1_Cus3"]} , {"ProductName" : "Prod2","Cus_List":["P2_Cus1", "P2_Cus2"]}, {"ProductName" : "Prod3","Cus_List":["P3_Cus1", "P3_Cus2", "P3_Cus3"]}, {"ProductName" : "Prod4","Cus_List":["P4_Cus1", "P4_Cus2", "P4_Cus3"]}, {"ProductName" : "Prod5","Cus_List":["P5_Cus1", "P5_Cus2", "P5_Cus3", "P5_Cus4"]} ] }
Summary View:
Product Name Code HTTP Response Code HTTP Response Message Web Service Error Message Company Name Metadata Product Customers Prod1 41 200 OK <Nil> Comp1 Product Customer List Prod1 {P1_Cus1}{P1_Cus2}{P1_Cus3}
Prod2 512 200 OK <Nil> Comp1 Product Customer List Prod2 {P2_Cus1}{P2_Cus2}
Prod3 986 200 OK <Nil> Comp1 Product Customer List Prod3 {P3_Cus1}{P3_Cus2}{P3_Cus3}
Prod4 994 200 OK <Nil> Comp1 Product Customer List Prod4 {P4_Cus1}{P4_Cus2}{P4_Cus3}
Prod5 208 200 OK <Nil> Comp1 Product Customer List Prod5 {P5_Cus1}{P5_Cus2}{P5_Cus3}{P5_Cus4}
-