User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:adminmanual:businessmappings:webservicecall [2020/02/11 19:49]
joebordes [wsconfig]
en:adminmanual:businessmappings:webservicecall [2020/02/21 00:04] (current)
joebordes [An example of two tasks passing context]
Line 25: Line 25:
   * wsuser and wspass in case the service uses these   * wsuser and wspass in case the service uses these
   * wsheader contain keyname and keyvalue pairs with information that must be sent in the header of the call   * wsheader contain keyname and keyvalue pairs with information that must be sent in the header of the call
 +    * a special header is "​Authorization",​ this keyname accepts a special syntax in it's keyvalue: **getContext(variable_name)**. this expression will search for the variable_name in the workflow context and use that instead of the hard coded value which can be set here also.
   * <​wstype>​REST or SOAP</​wstype>​   * <​wstype>​REST or SOAP</​wstype>​
   * <​inputtype>​XML/​URL/​JSON/​URLRESTFUL</​inputtype>​   * <​inputtype>​XML/​URL/​JSON/​URLRESTFUL</​inputtype>​
Line 62: Line 63:
 ====== Examples ====== ====== Examples ======
  
-An example of Map for SOAP Call:+=====An example of Map for SOAP Call:=====
  
 <code XML> <code XML>
Line 130: Line 131:
 </​code>​ </​code>​
  
-An example of Map for REST Call:+=====An example of Map for REST Call:=====
  
 <code XML> <code XML>
Line 185: Line 186:
  
 Note how the $coddivisa variable in the URL <​code><​wsurl>​http://​localhost/​facturascripts/​api/​3/​divisas/​$coddivisa</​wsurl></​code>​ will be substituted by the actual value that we have in coreBOS as defined in the fields section. In this case, the value of the tickersymbol field in the Account will be read and $coddivisa will be substituted with that value. Note how the $coddivisa variable in the URL <​code><​wsurl>​http://​localhost/​facturascripts/​api/​3/​divisas/​$coddivisa</​wsurl></​code>​ will be substituted by the actual value that we have in coreBOS as defined in the fields section. In this case, the value of the tickersymbol field in the Account will be read and $coddivisa will be substituted with that value.
 +
 +=====An example of two tasks passing context=====
 +
 +This first map executes an authentication call and loads the authorization token into the workflow context and the second task uses that value to make an operation call.
 +
 +<code xml>
 +<map>
 +<​originmodule>​
 +<​originname>​Accounts</​originname>​
 +</​originmodule>​
 +
 +<​wsconfig>​
 +<​wsurl><​![CDATA[http://​localhost/​corebostsolucio/​webservice.php?​operation=testcontext&​id=2355]]></​wsurl>​
 +<​wshttpmethod>​GET</​wshttpmethod>​
 +<​methodname>​wslogin</​methodname>​
 +<​wsresponsetime></​wsresponsetime>​
 +<​wsuser></​wsuser>​
 +<​wspass></​wspass>​
 +<​wsheader>​
 +<​header>​
 +<​keyname>​Content-type</​keyname>​
 +<​keyvalue>​application/​json</​keyvalue>​
 +</​header>​
 +<​header>​
 +<​keyname>​Authorization</​keyname>​
 +<​keyvalue>​9192929383834</​keyvalue>​
 +</​header>​
 +</​wsheader>​
 +<​wstype>​REST</​wstype>​
 +<​inputtype>​JSON</​inputtype>​
 +<​outputtype>​JSON</​outputtype>​
 +</​wsconfig>​
 +
 +<​fields>​
 +</​fields>​
 +
 +<​Response>​
 +<​field>​
 +<​fieldname>​result</​fieldname>​
 +<​destination>​
 +<​context>​token</​context>​
 +</​destination>​
 +</​field>​
 +</​Response>​
 +</​map>​
 +</​code>​
 +
 +<code xml>
 +<map>
 +<​originmodule>​
 +<​originname>​Accounts</​originname>​
 +</​originmodule>​
 +
 +<​wsconfig>​
 +<​wsurl>​http://​localhost/​corebostsolucio/​webservice.php?​operation=testcontext2</​wsurl>​
 +<​wshttpmethod>​POST</​wshttpmethod>​
 +<​methodname>​wspost</​methodname>​
 +<​wsresponsetime></​wsresponsetime>​
 +<​wsuser></​wsuser>​
 +<​wspass></​wspass>​
 +<​wsheader>​
 +<​header>​
 +<​keyname>​Content-type</​keyname>​
 +<​keyvalue>​application/​json</​keyvalue>​
 +</​header>​
 +<​header>​
 +<​keyname>​Authorization</​keyname>​
 +<​keyvalue>​getContext(token)</​keyvalue>​
 +</​header>​
 +</​wsheader>​
 +<​wstype>​REST</​wstype>​
 +<​inputtype>​JSON</​inputtype>​
 +<​outputtype>​JSON</​outputtype>​
 +</​wsconfig>​
 +
 +<​fields>​
 +<​field>​
 +<​fieldname>​token</​fieldname>​
 +<​Orgfields>​
 +<​Orgfield>​
 +<​OrgfieldName>​accountname</​OrgfieldName>​
 +<​OrgfieldID></​OrgfieldID>​
 +</​Orgfield>​
 +<​delimiter></​delimiter>​
 +</​Orgfields>​
 +</​field>​
 +</​fields>​
 +
 +<​Response>​
 +<​field>​
 +<​fieldname>​description</​fieldname>​
 +<​destination>​
 +<​field>​accountname</​field>​
 +</​destination>​
 +</​field>​
 +</​Response>​
 +</​map>​
 +</​code>​