Difference between revisions of "GVExample CCardPay"

From GreenVulcano Wiki
Jump to: navigation, search
(Defining Systems, Channels and Operations)
({{GVCONSOLE}} Configuration)
 
(17 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Description==
 
==Description==
  
This service has the scope of showing how {{GVESB}} uses [[DataHandler]] for querying a DB and implements a [[Web Services]].
+
This service has the purpose of showing how {{GVESB}} uses [[DataHandler]] to query a DB and implement [[Web Services]].
  
 
CCardPay Service executes the following operations:
 
CCardPay Service executes the following operations:
# Receives a request [[Web Services|Web Service]] from client, with a credit card number to be controlled.
+
# Receives a [[Web Services|Web Service]] request from client, with a credit card number to be controlled.
# If this card is locally managed, reads the data using [[DataHandler]].  
+
# If this card is locally managed, reads the data from DB using [[DataHandler]].  
 
# If this card is managed by an external system, forwards a Web Service request to that system.
 
# If this card is managed by an external system, forwards a Web Service request to that system.
 
# Returns the response to the client
 
# Returns the response to the client
Line 16: Line 16:
 
# Implement the [[Flow|flows]].
 
# Implement the [[Flow|flows]].
  
===Defining Systems, Channels and Operations===
+
===Defining Systems, Channels, Operations and XPath===
 +
 
 +
For this exercise, you need first of all to define an XPath for querying web services. This can be made in {{VULCON}} core view, simply by right-clicking on the element '''GVHpath/XPath''' and then selecting Insert after (or Insert before) -> XPathNamespace. Then fill the ampty field as in the following table.
 +
 
 +
{|class="gvtable"
 +
! Element !! Value
 +
|-
 +
| XPathNamespace || namespace="http://www.credit.com/services"<br/>prefix="cred"
 +
|}
  
 
In order to define a System, go to {{VULCON}} core view and insert the System CREDIT. Inside of it create the Channel CHANNEL_CREDIT_WS in order to create an "internal" [[Participant]]. We also create the System CREDIT_EXTERNAL with the Channel CHANNEL_CREDIT_EXT corresponding to an "external" [[Participant]].  
 
In order to define a System, go to {{VULCON}} core view and insert the System CREDIT. Inside of it create the Channel CHANNEL_CREDIT_WS in order to create an "internal" [[Participant]]. We also create the System CREDIT_EXTERNAL with the Channel CHANNEL_CREDIT_EXT corresponding to an "external" [[Participant]].  
Line 24: Line 32:
 
From the Core view of {{L_VULCON}}, right clicking the Services element, launch the [[Wizard Call Web Service]] and, after selecting the WSDL file -in this example we use [[ExternalCreditService.wsdl]] present in folder <nowiki>${{gv.app.home}}</nowiki>/xmlconfig/wsdl-, choose the parameters to create the {{GVESB}} service.
 
From the Core view of {{L_VULCON}}, right clicking the Services element, launch the [[Wizard Call Web Service]] and, after selecting the WSDL file -in this example we use [[ExternalCreditService.wsdl]] present in folder <nowiki>${{gv.app.home}}</nowiki>/xmlconfig/wsdl-, choose the parameters to create the {{GVESB}} service.
  
A two new Services, Pay and Query, and two [[ws-call]] operations, pay and query will be created into the System CREDIT, channel CREDIT_EXTERNAL. We changed those names to CCardPay and CCardQuery for the services, PayExternal and QueryExternal for the [[ws-call]] operations respectively. Now you can modify your workflow.
+
Two new Services, Pay and Query, and two [[ws-call]] operations, pay and query, will be created into the System CREDIT, channel CREDIT_EXTERNAL. We change those names to CCardPay and CCardQuery for the services, PayExternal and QueryExternal for the [[ws-call]] operations respectively. Now is possible to modify the workflow.
  
 
From the {{L_VULCON}} Core view, element System "CREDIT" -> Channel "CHANNEL_CREDIT_WS", insert a [[dh-call]] operation and set its attributes and sub-elements as follow:
 
From the {{L_VULCON}} Core view, element System "CREDIT" -> Channel "CHANNEL_CREDIT_WS", insert a [[dh-call]] operation and set its attributes and sub-elements as follow:
Line 30: Line 38:
 
* [[dh-call]]:
 
* [[dh-call]]:
 
{|class="gvtable"
 
{|class="gvtable"
! Attribute !! Value  
+
! Element !! Value  
 +
|-
 +
| [[dh-call]] || name="DataHandler"
 +
|-
 +
| [[dh-call]]/[[DBOBuilder]] || name="CCardPay" <br/> jdbc-connection-name="ds.gv_test" <br/>
 +
|-
 +
| [[dh-call]]/[[DBOBuilder]]/[[DHVariables]]/[[DHVariables#DHVariable|DHVariable]] || name="decimal-separator" value="."
 +
|-
 +
| [[dh-call]]/[[DBOBuilder]]/[[DHVariables]]/[[DHVariables#DHVariable|DHVariable]] || name="grouping-separator" value=","
 
|-
 
|-
| name || DataHandler
+
| [[dh-call]]/[[DBOBuilder]]/[[DHVariables]]/[[DHVariables#DHVariable|DHVariable]] || name="format" value="#0.00"
 
|-
 
|-
| [[dh-call]]/DBOBuilder || name="CREDIT::CCardPay" <br/> jdbc-connection-name="ds.test_gv" <br/>  
+
| [[dh-call]]/[[DBOBuilder]]/[[DBOUpdate]] || name="CCardPay" <br/> transformation="CCardPay" <br/> type="dbo"
DHVariables:
 
: name="decimal-separator" value="."
 
: name="grouping-separator" value=","
 
: name="format" value="#0.00"
 
 
|-
 
|-
| [[dh-call]]/DBOBuilder/DBOUpdate || name="CCardPay"  <br/> transformation="CCardPay"  <br/> type="dbo" <br/>statement:
+
| [[dh-call]]/[[DBOBuilder]]/[[DBOUpdate]]/[[statement]] || id="0" <br/> type="update"
: id="0" <br/> type="update"
 
 
  update CREDIT_CARD  set CREDIT= CREDIT - ?
 
  update CREDIT_CARD  set CREDIT= CREDIT - ?
 
  where CNUMBER=?
 
  where CNUMBER=?
Line 48: Line 59:
 
|}
 
|}
  
The operation defined in the DataHandler makes use of the ''data-transformation'' module for the data transformations that allows to have data in XML format. So, you need to define the following parameters into the [[GVDataTransformation]] section:
+
The operation defined in the DataHandler makes use of the ''data-transformation'' module for the data transformations that allow to have data in XML format. So, you need to define the following parameters into the [[GVDataTransformation]] section:
 
{|class="gvtable"
 
{|class="gvtable"
 
! Element !! Attributes
 
! Element !! Attributes
Line 54: Line 65:
 
| [[GVDataTransformation#DataSourceSet|DataSourceSet]]/[[GVDataTransformation#LocalFSDataSource|LocalFSDataSource]] || formatHandled="xsl" name="XSLDataSource" <br/> repositoryHome=<nowiki>"${{gv.app.home}}/gvdte/datasource/xsl"</nowiki> <br/> type="datasource"  
 
| [[GVDataTransformation#DataSourceSet|DataSourceSet]]/[[GVDataTransformation#LocalFSDataSource|LocalFSDataSource]] || formatHandled="xsl" name="XSLDataSource" <br/> repositoryHome=<nowiki>"${{gv.app.home}}/gvdte/datasource/xsl"</nowiki> <br/> type="datasource"  
 
|-
 
|-
| [[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="CCardPay" DataSourceSet="Default"  <br/> XSLMapName="DataHandler/CREDIT/[[CCardPay.xsl]]"<br/> type="transformation"
+
| Transformations/[[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="CCardPay" DataSourceSet="Default"  <br/> XSLMapName="DataHandler/CREDIT/[[CCardPay.xsl]]"<br/> type="transformation"
 
|-
 
|-
| [[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="PayExternalInput" DataSourceSet="Default" <br/> XSLMapName=" CREDIT_EXTERNAL/[[PayExternalInput.xsl]]"  <br/> type="transformation"
+
| Transformations/[[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="PayExternalInput" DataSourceSet="Default" <br/> XSLMapName="CREDIT_EXTERNAL/[[PayExternalInput.xsl]]"  <br/> type="transformation"
 
|-
 
|-
| [[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="PayExternalOutput" DataSourceSet="Default" <br/> XSLMapName=" CREDIT_EXTERNAL/[[PayExternalOutput.xsl]]" <br/> type="transformation"
+
| Transformations/[[GVDataTransformation#XSLTransformation|XSLTransformation]] || name="PayExternalOutput" DataSourceSet="Default" <br/> XSLMapName="CREDIT_EXTERNAL/[[PayExternalOutput.xsl]]" <br/> type="transformation"
 
|}
 
|}
  
Now define a [[ws-call]] operation into [[System]] CREDIT_EXTERNAL -> [[Channel]] CHANNEL_CREDIT_EXT. Its attributes and sub-elements defined will be setted as:
+
Now define a [[ws-call]] operation into [[System]] CREDIT_EXTERNAL -> [[Channel]] CHANNEL_CREDIT_EXT. Its attributes and sub-elements defined will be set as:
 
* [[ws-call]]:
 
* [[ws-call]]:
 
{|class="gvtable"
 
{|class="gvtable"
 
! Attribute !! Value  
 
! Attribute !! Value  
 
|-
 
|-
| Name || PayExternal
+
| [[ws-call]] || name="PayExternal"
 +
|-
 +
| [[Ws-call#AxisWebServiceInvoker|ws-call/AxisWebServiceInvoker]] || operation="Pay" <br/> ref-dp="EXTERNAL::PayWSDataProvider"<br/> returnType="body-element"<br/> type="invoker"
 
|-
 
|-
| [[Ws-call#AxisWebServiceInvoker|ws-call/AxisWebServiceInvoker]] || operation="Pay" <br/> ref-dp="EXTERNAL::PayWSDataProvider"<br/> returnType="body-element"<br/> type="invoker" <br/> WSDLInfo:
+
| [[Ws-call#AxisWebServiceInvoker|ws-call/AxisWebServiceInvoker]]/WSDLInfo || type="wsdlinfo"<br/>wsdl="file://<nowiki>${{gv.app.home}}</nowiki>/xmlconfig/wsdl/[[ExternalCreditService.wsdl]]"
: type="wsdlinfo"
+
|-
: wsdl="file://<nowiki>${{gv.app.home}}</nowiki>/xmlconfig/wsdl/[[ExternalCreditService.wsdl]]"
+
| [[Ws-call#AxisWebServiceInvoker|ws-call/AxisWebServiceInvoker]]/BasicHttpAuth || user="xmlp<nowiki>{{ws.auth.user}}</nowiki>"<br/>password="xmlp<nowiki>{{ws.auth.password}}</nowiki>"
 
|}
 
|}
  
Line 80: Line 93:
 
|-
 
|-
 
| [[Axis2MessageContextDataProvider]]/Field || direction="OUT" key="message"<br/>
 
| [[Axis2MessageContextDataProvider]]/Field || direction="OUT" key="message"<br/>
Expression
+
|-
: type="ognl"
+
| [[Axis2MessageContextDataProvider]]/Field/Expression || type="ognl"
 
   envelope.body.addChild(@org.apache.axis2.util.XMLUtils
 
   envelope.body.addChild(@org.apache.axis2.util.XMLUtils
 
     @toOM(#input.object.getDocumentElement()))
 
     @toOM(#input.object.getDocumentElement()))
Line 101: Line 114:
 
| first-node || Prepare
 
| first-node || Prepare
 
|-
 
|-
| [[Conditions]]/GVBufferCondition || condition="isInternalCCard" <br/> Property:
+
| [[Conditions]]/[[GVBufferCondition]] || condition="isInternalCCard"
: name="IS_INTERNAL" operator="equal"<br/>type="gvbuffer-field"<br/>value="true"<br/>value-type="text"
+
|-
 +
| [[Conditions]]/[[GVBufferCondition]]/Property || name="IS_INTERNAL" operator="equal"<br/>type="gvbuffer-field"<br/>value="true"<br/>value-type="text"
 +
|-
 +
| [[ChangeGVBufferNode]] || dump-in-out="true" <br/>id="prepare" <br/>input="input" <br/>next-node-id="check_internal"
 +
|-
 +
| [[ChangeGVBufferNode]]/[[ChangeGVBuffer]] || clear-data="false"
 
|-
 
|-
| [[ChangeGVBufferNode]] || dump-in-out="true" <br/>id="prepare" <br/>input="input" <br/>next-node-id="check_internal" <br/>clear-data="false" <br/>PropertyDef:
+
| [[ChangeGVBufferNode]]/[[ChangeGVBuffer]]/PropertyDef || name="CNUMBER"<br/><nowiki>value="js{{gvesb::var doc=XMLUtils.parseObject_S(object.getObject(),false,true); XMLUtils.get_S(doc,'//cred:cnumber')}}"</nowiki>
: name="CNUMBER"<br/><nowiki>value="js{{gvesb::var doc=XMLUtils.parseDOM_S(new java.lang.String(object.getObject()),false,true); XMLConfig.get(doc,'//cred:cnumber')}}" </nowiki><br/>
+
|-
PropertyDef:
+
| [[ChangeGVBufferNode]]/[[ChangeGVBuffer]]/PropertyDef || name="IS_INTERNAL"<br/>value="sql{{ds.gv_test::select decode(count(*), 1, 'true', 'false') from credit_card where cnumber=ognl{{#object.getProperty('CNUMBER')}}}}"
: name="IS_INTERNAL"<br/>value="sql{{ds.test_gv::select decode(count(*), 1, 'true', 'false') from credit_card where  
 
:: cnumber=ognl{{#object.getProperty('CNUMBER')}}}}"
 
 
|-
 
|-
 
| [[GVNodeCheck]] || default-id="pay_external"<br/> id="check_internal"<br/> input="input" <br/>on-exception-id="end"  
 
| [[GVNodeCheck]] || default-id="pay_external"<br/> id="check_internal"<br/> input="input" <br/>on-exception-id="end"  
Line 115: Line 131:
 
|-
 
|-
 
| [[GVOperationNode]] || dump-in-out="false"  <br/>id="pay_internal" <br/>id-system="CREDIT" <br/>input="input" <br/>next-node-id="end" <br/>op-type="call" <br/>operation-name="DataHandler" <br/>output="output"
 
| [[GVOperationNode]] || dump-in-out="false"  <br/>id="pay_internal" <br/>id-system="CREDIT" <br/>input="input" <br/>next-node-id="end" <br/>op-type="call" <br/>operation-name="DataHandler" <br/>output="output"
 +
|-
 +
| [[GVOperationNode]]/InputServices/dh-selector-service || critical="yes"<br/>internal="yes"<br/> type="service"
 +
|-
 +
| [[GVOperationNode]]/InputServices/dh-selector-service/dh-selector-call || DH_SERVICE_NAME="CCardPay"
 
|-
 
|-
 
| [[GVOperationNode]] || dump-in-out="false"  <br/> id="pay_external"  <br/>id-system="CREDIT_EXTERNAL"  <br/> input="input"  <br/>next-node-id="end"  <br/>op-type="call"  <br/>operation-name="PayExternal"
 
| [[GVOperationNode]] || dump-in-out="false"  <br/> id="pay_external"  <br/>id-system="CREDIT_EXTERNAL"  <br/> input="input"  <br/>next-node-id="end"  <br/>op-type="call"  <br/>operation-name="PayExternal"
Line 135: Line 155:
 
=={{GVCONSOLE}} Configuration==
 
=={{GVCONSOLE}} Configuration==
  
It is time to deploy and test your new Service. To do that follows these steps:
+
It is time to deploy and test your new Service. To do that follow these steps:
  
 
[[File:GVCONSOLEDeploy.jpg|thumb|Deploy new Service]]Suppose you have saved the {{VULCON}} Configuration file as <nowiki>"${{gv.app.home}}/TEST/REPG1.zip"</nowiki>. To deploy the new Service follow this steps:
 
[[File:GVCONSOLEDeploy.jpg|thumb|Deploy new Service]]Suppose you have saved the {{VULCON}} Configuration file as <nowiki>"${{gv.app.home}}/TEST/REPG1.zip"</nowiki>. To deploy the new Service follow this steps:
 
# [[Starting|Start {{GVESB}}]]
 
# [[Starting|Start {{GVESB}}]]
 
# [[GV_Console#Access|Access to the {{GVCONSOLE}}]].  
 
# [[GV_Console#Access|Access to the {{GVCONSOLE}}]].  
# In the Deploy New Service section click Sfoglia... (Browse) and select the file where you have saved the {{L_VULCON}} configuration.
+
# In the Deploy New Service section click Browse... and select the file where you have saved the {{L_VULCON}} configuration.
 
# Click Submit.
 
# Click Submit.
  
 
The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy.
 
The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy.
# Clicking on service CCardPay a new view will be open containing the files GVCore.xml present in local and in server.
+
# Clicking on service CCardPay a new view will be open containing the file GVCore.xml present in local and in server.
 
# Click Deploy. Now you can save the document and write some notes about it.
 
# Click Deploy. Now you can save the document and write some notes about it.
 
# Save the Document. Saving you return to the [[Deploy Service]] section.
 
# Save the Document. Saving you return to the [[Deploy Service]] section.
Line 150: Line 170:
 
[[File:GVConsoleUtilityReload1.jpg|thumb|{{GVCONSOLE}} Utility section]]Now pass to the {{L_GVCONSOLE}} section [[Utility]].  
 
[[File:GVConsoleUtilityReload1.jpg|thumb|{{GVCONSOLE}} Utility section]]Now pass to the {{L_GVCONSOLE}} section [[Utility]].  
 
# Click on [[Reload_Configuration|Reload configuration]]
 
# Click on [[Reload_Configuration|Reload configuration]]
# Select GVCore.xml and GVAdapters.xml and then Reload. A new windows will be open to confirm the operation
+
# Select GVCore.xml and GVAdapters.xml and then Reload.
# Click OK.
+
# Confirm the operation.
  
 
[[File:GVConsoleTesting.jpg|thumb|{{GVCONSOLE}} Testing section]]Go to the {{L_GVCONSOLE}} section [[Testing]]. In this section you can finally test your new services:
 
[[File:GVConsoleTesting.jpg|thumb|{{GVCONSOLE}} Testing section]]Go to the {{L_GVCONSOLE}} section [[Testing]]. In this section you can finally test your new services:
# Into the Service voice select CCardPay
+
# From the Service list select CCardQuery
# Into the System voice select CREDIT_EXTERNAL
+
# From the System list select CREDIT_EXTERNAL
# Select the Payload on input containing the credit card number you want to test
+
# Select the Payload on input containing the credit card number you want to use and the amount to reduce from.
 
# Click RequestReply
 
# Click RequestReply
  
The Testing View will be expanded and it is also possible to view the GVBuffer Output panel where there are present some properties, among these the REC_READ property setted to 1, representing the number of record read from DB.  
+
The Testing View will be expanded and it is also possible to view the GVBuffer Output panel where there are present some properties, among these the REC_READ property set to 1, representing the number of record read from DB.  
  
The file TestOutput.txt will be generated in the directory <nowiki>${{gv.app.home}}</nowiki>/log as previously setted (see [[Testing]] area) containing information about owner, credit and state of the credit card number "1234123415555666" as passed in input.
+
The file TestOutput.txt will be generated in the directory <nowiki>${{gv.app.home}}</nowiki>/log as previously set (see [[Testing]] area) containing information about the credit card numbers you passed in input and the number of records founded and updated.
 
<syntaxhighlight lang="XML">
 
<syntaxhighlight lang="XML">
 
<pre>
 
<pre>
----------- TEST N. 0 2012.02.15 at 11:46:26 -----------
+
----------- TEST N. 0 2012.03.02 at 14:11:38 -----------
 
Standard Field:
 
Standard Field:
 
system  = CREDIT_EXTERNAL
 
system  = CREDIT_EXTERNAL
 
service  = CCardPay
 
service  = CCardPay
id      = 7F0001014F3B87B900021429
+
id      = 7F0001014F50AFC600014063
 
retCode  = 0
 
retCode  = 0
GVBuffer: class org.apache.xerces.dom.DocumentImpl
+
GVBuffer: NULL
<?xml version="1.0" encoding="UTF-8"?>
+
 
  <QueryResponse xmlns="http://www.credit.com/services">
 
    <name>MARIO BIANCHI</name>
 
    <cnumber>1234123415555666</cnumber>
 
    <credit>300.00000</credit>
 
    <active>true</active>
 
  </QueryResponse>
 
 
Properties:
 
Properties:
 
REC_DISCARD = 0
 
REC_DISCARD = 0
 
IS_INTERNAL = true
 
IS_INTERNAL = true
REC_TOTAL = 0
+
REC_TOTAL = 1
REC_UPDATE = 0
+
REC_UPDATE = 1
 
REC_INSERT = 0
 
REC_INSERT = 0
REC_READ = 1
+
REC_READ = 0
 
CNUMBER = 1234123415555666
 
CNUMBER = 1234123415555666
 
REC_DISCARD_CAUSE =  
 
REC_DISCARD_CAUSE =  
 
</pre>
 
</pre>
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 22:06, 2 June 2014

Description

This service has the purpose of showing how GreenVulcano® ESB uses DataHandler to query a DB and implement Web Services.

CCardPay Service executes the following operations:

  1. Receives a Web Service request from client, with a credit card number to be controlled.
  2. If this card is locally managed, reads the data from DB using DataHandler.
  3. If this card is managed by an external system, forwards a Web Service request to that system.
  4. Returns the response to the client

VulCon Configuration

To configure CCardPay service follow these steps:

  1. Define Systems, Channels and Operations
  2. Define the Services
  3. Implement the flows.

Defining Systems, Channels, Operations and XPath

For this exercise, you need first of all to define an XPath for querying web services. This can be made in VulCon core view, simply by right-clicking on the element GVHpath/XPath and then selecting Insert after (or Insert before) -> XPathNamespace. Then fill the ampty field as in the following table.

Element Value
XPathNamespace namespace="http://www.credit.com/services"
prefix="cred"

In order to define a System, go to VulCon core view and insert the System CREDIT. Inside of it create the Channel CHANNEL_CREDIT_WS in order to create an "internal" Participant. We also create the System CREDIT_EXTERNAL with the Channel CHANNEL_CREDIT_EXT corresponding to an "external" Participant.

Note that the easiest way to configure a Web service with VulCon® is using the Wizard. We start from a Web Service WSDL, that describes a withdrawal operation on a credit card.

From the Core view of VulCon®, right clicking the Services element, launch the Wizard Call Web Service and, after selecting the WSDL file -in this example we use ExternalCreditService.wsdl present in folder ${{gv.app.home}}/xmlconfig/wsdl-, choose the parameters to create the GreenVulcano® ESB service.

Two new Services, Pay and Query, and two ws-call operations, pay and query, will be created into the System CREDIT, channel CREDIT_EXTERNAL. We change those names to CCardPay and CCardQuery for the services, PayExternal and QueryExternal for the ws-call operations respectively. Now is possible to modify the workflow.

From the VulCon® Core view, element System "CREDIT" -> Channel "CHANNEL_CREDIT_WS", insert a dh-call operation and set its attributes and sub-elements as follow:

Element Value
dh-call name="DataHandler"
dh-call/DBOBuilder name="CCardPay"
jdbc-connection-name="ds.gv_test"
dh-call/DBOBuilder/DHVariables/DHVariable name="decimal-separator" value="."
dh-call/DBOBuilder/DHVariables/DHVariable name="grouping-separator" value=","
dh-call/DBOBuilder/DHVariables/DHVariable name="format" value="#0.00"
dh-call/DBOBuilder/DBOUpdate name="CCardPay"
transformation="CCardPay"
type="dbo"
dh-call/DBOBuilder/DBOUpdate/statement id="0"
type="update"
update CREDIT_CARD  set CREDIT= CREDIT - ?
where CNUMBER=?
   and ENABLED='Y'
   and CREDIT >= ?

The operation defined in the DataHandler makes use of the data-transformation module for the data transformations that allow to have data in XML format. So, you need to define the following parameters into the GVDataTransformation section:

Element Attributes
DataSourceSet/LocalFSDataSource formatHandled="xsl" name="XSLDataSource"
repositoryHome="${{gv.app.home}}/gvdte/datasource/xsl"
type="datasource"
Transformations/XSLTransformation name="CCardPay" DataSourceSet="Default"
XSLMapName="DataHandler/CREDIT/CCardPay.xsl"
type="transformation"
Transformations/XSLTransformation name="PayExternalInput" DataSourceSet="Default"
XSLMapName="CREDIT_EXTERNAL/PayExternalInput.xsl"
type="transformation"
Transformations/XSLTransformation name="PayExternalOutput" DataSourceSet="Default"
XSLMapName="CREDIT_EXTERNAL/PayExternalOutput.xsl"
type="transformation"

Now define a ws-call operation into System CREDIT_EXTERNAL -> Channel CHANNEL_CREDIT_EXT. Its attributes and sub-elements defined will be set as:

Attribute Value
ws-call name="PayExternal"
ws-call/AxisWebServiceInvoker operation="Pay"
ref-dp="EXTERNAL::PayWSDataProvider"
returnType="body-element"
type="invoker"
ws-call/AxisWebServiceInvoker/WSDLInfo type="wsdlinfo"
wsdl="file://${{gv.app.home}}/xmlconfig/wsdl/ExternalCreditService.wsdl"
ws-call/AxisWebServiceInvoker/BasicHttpAuth user="xmlp{{ws.auth.user}}"
password="xmlp{{ws.auth.password}}"

The ws-call operation already defined makes use of the Data provider module. So, you need to define the following parameters into the GVDataProviderManager section, present in the Adapter Core View of VulCon®:

Element Attributes
Axis2MessageContextDataProvider name="EXTERNAL::PayWSDataProvider"
Axis2MessageContextDataProvider/Field direction="OUT" key="message"
Axis2MessageContextDataProvider/Field/Expression type="ognl"
 envelope.body.addChild(@org.apache.axis2.util.XMLUtils
   @toOM(#input.object.getDocumentElement()))

Flow implementation

CCardPay flow

In order to define the CCardPay service Flow design it as shown in the picture:


The service receives a Web Service request from a client with a credit card number. If this card is managed locally, reads its data using DataHandler, otherwise forwards the request to an external system using Web Services.


The following table shows the parameters to be defined for each Flow node:

Attribute Value
first-node Prepare
Conditions/GVBufferCondition condition="isInternalCCard"
Conditions/GVBufferCondition/Property name="IS_INTERNAL" operator="equal"
type="gvbuffer-field"
value="true"
value-type="text"
ChangeGVBufferNode dump-in-out="true"
id="prepare"
input="input"
next-node-id="check_internal"
ChangeGVBufferNode/ChangeGVBuffer clear-data="false"
ChangeGVBufferNode/ChangeGVBuffer/PropertyDef name="CNUMBER"
value="js{{gvesb::var doc=XMLUtils.parseObject_S(object.getObject(),false,true); XMLUtils.get_S(doc,'//cred:cnumber')}}"
ChangeGVBufferNode/ChangeGVBuffer/PropertyDef name="IS_INTERNAL"
value="sql{{ds.gv_test::select decode(count(*), 1, 'true', 'false') from credit_card where cnumber=ognl{{#object.getProperty('CNUMBER')}}}}"
GVNodeCheck default-id="pay_external"
id="check_internal"
input="input"
on-exception-id="end"
GVNodeCheck/GVRouting condition="isInternalCCard"
next-node-id="pay_internal"
GVOperationNode dump-in-out="false"
id="pay_internal"
id-system="CREDIT"
input="input"
next-node-id="end"
op-type="call"
operation-name="DataHandler"
output="output"
GVOperationNode/InputServices/dh-selector-service critical="yes"
internal="yes"
type="service"
GVOperationNode/InputServices/dh-selector-service/dh-selector-call DH_SERVICE_NAME="CCardPay"
GVOperationNode dump-in-out="false"
id="pay_external"
id-system="CREDIT_EXTERNAL"
input="input"
next-node-id="end"
op-type="call"
operation-name="PayExternal"
GVOperationNode/InputServices/gvdte-service critical="yes" internal="yes"
remove-fields="yes" type="service"
GVOperationNode/InputServices/gvdte-service/map-name-param name="map-name" value="PayExternalInput"
GVOperationNode/InputServices/gvdte-service/gvdte-context-call name="PayExternalInput"
GVOperationNode/OutputServices/gvdte-service critical="yes" internal="yes"
remove-fields="yes" type="service"
GVOperationNode/OutputServices/gvdte-service/map-name-param name="map-name" value="PayExternalOutput"
GVOperationNode/OutputServices/gvdte-service/gvdte-context-call name="PayExternalOutput"
GVEndNode end-business-process="yes"
id="end"
op-type="end"
output="output"

GV Console Configuration

It is time to deploy and test your new Service. To do that follow these steps:

Deploy new Service

Suppose you have saved the VulCon Configuration file as "${{gv.app.home}}/TEST/REPG1.zip". To deploy the new Service follow this steps:

  1. Start GreenVulcano® ESB
  2. Access to the GV Console.
  3. In the Deploy New Service section click Browse... and select the file where you have saved the VulCon® configuration.
  4. Click Submit.

The section Deploy Services will be open. In this section you can select the services you want to deploy.

  1. Clicking on service CCardPay a new view will be open containing the file GVCore.xml present in local and in server.
  2. Click Deploy. Now you can save the document and write some notes about it.
  3. Save the Document. Saving you return to the Deploy Service section.
GV Console Utility section

Now pass to the GV Console® section Utility.

  1. Click on Reload configuration
  2. Select GVCore.xml and GVAdapters.xml and then Reload.
  3. Confirm the operation.
GV Console Testing section

Go to the GV Console® section Testing. In this section you can finally test your new services:

  1. From the Service list select CCardQuery
  2. From the System list select CREDIT_EXTERNAL
  3. Select the Payload on input containing the credit card number you want to use and the amount to reduce from.
  4. Click RequestReply

The Testing View will be expanded and it is also possible to view the GVBuffer Output panel where there are present some properties, among these the REC_READ property set to 1, representing the number of record read from DB.

The file TestOutput.txt will be generated in the directory ${{gv.app.home}}/log as previously set (see Testing area) containing information about the credit card numbers you passed in input and the number of records founded and updated.

<pre>
----------- TEST N. 0 2012.03.02 at 14:11:38 -----------
Standard Field:
	system   = CREDIT_EXTERNAL
	service  = CCardPay
	id       = 7F0001014F50AFC600014063
	retCode  = 0
GVBuffer: NULL

Properties:
	REC_DISCARD = 0
	IS_INTERNAL = true
	REC_TOTAL = 1
	REC_UPDATE = 1
	REC_INSERT = 0
	REC_READ = 0
	CNUMBER = 1234123415555666
	REC_DISCARD_CAUSE = 
</pre>