In this post I will describe how we can use the Service Callout OSB component.
I will show you how easy it is to mount the REQUEST and RESPONSE of our service and demonstrate how we can use our RESPONSE to various calling services or using various components Service Callout
In a previous post we show how we can expose a service in BPEL OSB, for that click here to see the post, our goal now will be the same in the case expose a service but now we will use the Service Callout component, so let’s start !!!
Then create a Proxy Service called ServiceCalloutProxy
Select the tab General are our WSDL, as follows:
Then click on the Message Flow tab and drag the component Pipeline Pair so that it is as follows:
Now below the Request Pipeline drag the component Stage
Within the stage1 drag the component Service Callout
Right-click on your Service Callout and below Properties click Browse and look for the service SelectDbAdapterBPELBusiness.biz
Click OK after choosing the service SelectDbAdapterBPELBusiness.biz
- In Invoking choose option process
- In Request Variable place SelectRequest
- In Response Variable place SelectResponse
Under Request Action drag the Assign component and again in Properties (Properties of this Assign) put our variable in Variable selectRequest
Then click Expression select Request up to then put our Request payload of our service to be called in the case of SelectDbAdapterBPELBusiness.biz
For this is very simple, you just need to log into your sbconsole and call the Business SelectDbAdapterBPELBusiness
Then click the icon that looks like a “cockroach” as up to then copy the payload
Copied the payload up just now paste only within our Assign as follows:
However, see that between the <idClient> is the value 100 which is pre-set by OSB own, and we need this value is the past for us, then simply just expand in the body that will be the right side in the tab Variable Structures and drag to the left, see below:
Now replace the value 100 by this body, adding keys and also the xquery date so we can get the value that will be passed on idCliente, see below as it was.
Click OK and get the following:
Good, now we add a Stage for Response Pipeline and within this Stage drag the Replace component as follows:
Click the Replace tab and below Properties place as follows:
- XPath: . (point)
- In Variable: body
- Replace node contents: (Check this option)
Now click <Expression>
The right side in Variable Structures click $body – obterDadosClienteResponse and then nomeCliente and drag to the left side as follows:
Now let’s set up our Payload that will be our Response Service
Delete the variable $body and see below how the tags are:
See step by step how simple it is:
It was as follows:
Delete the variable and the bar: $body/
Put the ser:obterDadosClienteResponse get in tags, remembering that I’m opening and closing tags
- <obterDadosClienteResponse> </obterDadosClienteResponse>
Put the nomeCliente between tags <obterDadosClienteResponse>
Now fill the other missing tags that are profissaoCliente, salarioCliente and numeroDeptCliente and will be as follows:
Click OK to close the box up for me to explain where will the information to our payload, see above that only set up the structure of our response, we must now fill with the information that will come from our business SelectDbAdapterBPELBusiness
Remember the Service Callout that it filled our Request and Response variable? in case, selectRequest and selectResponse
Well, the answer of our business SelectDbAdapterBPELBusiness is all recorded in our variable selectResponse
OK, here just wanted to explain where will the response of our payload.
Going back on our Replace and click again next to Expression:
Now fill our payload so that it is as follows:
See above the OSB grifou some names, that because he did not recognize the namespace sel:
So that you understand the sel namespace:sel will be the same as our request payload we got up, remember?
See above in the payload the namespace sel: is http://xmlns.oracle.com/UansBlogApplication/SelecDBAdapter/SelecDBAdapterBPELProcess without the double quotes:
Then go back to our replace and click the tab Namespace Definition and click Add
In the box that opens on Prefix: enter your e URI in placehttp://xmlns.oracle.com/UansBlogApplication/SelecDBAdapter/SelecDBAdapterBPELProcess
Click OK and see that we will not have problems:
Now for you to understand, as I said in our variable $selectResponse will come the answer of our business or our service we call, see an example of my call of business SelectDbAdapterBPELBusiness
See also why we are doing our Variable Replace the Body because our processResponse is within the Body
And after our variable $selectRespon sethe service will bring us <Nome>, <Profissao> and so on, so we fill in our replace $selectResponse/sel:Nome e etc..
However see that I am using the sel namespace: sel: and above in our service it does not back with this prefix sel: … This is a detail of my WSDL elementFormDefault and attributeFormDefault attribute but which I will explain in a later post, for now I want you just watch this detail because if you are calling a different service see if you have to spend your namespace prefix or not, make a test with both to see if there is a result.
Now that you got it how it works and why some things in his Response, Post your changes to do our tests:
Go to your SbConsole and now call our service ServiceCalloutProxy
Here I spend <idCliente> 7 that is my ID
Click Execute, and see below the response of our service:
Here it is interesting you understand that the variable we use in Response can be used whenever you want to mount a response to our service, regardless of how many services or Service Callout we use, there is always a Response variable.
Doubts ? Leave your comment
Hugs and see you next