Tags

, , , , , , , , , , , ,

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

Imagem Blog UansCarvalho

Select the tab General are our WSDL, as follows:

Imagem Blog UansCarvalho

Then click on the Message Flow tab and drag the component Pipeline Pair so that it is as follows:

Imagem Blog UansCarvalho

Now below the Request Pipeline drag the component Stage

Imagem Blog UansCarvalho

Within the stage1 drag the component Service Callout

Imagem Blog UansCarvalho

Right-click on your  Service Callout and below Properties click Browse and look for the service SelectDbAdapterBPELBusiness.biz

Imagem Blog UansCarvalho

Click OK after choosing the service SelectDbAdapterBPELBusiness.biz

  • In Invoking choose option process
  • In Request Variable place SelectRequest
  • In Response Variable place SelectResponse

Imagem Blog UansCarvalho

Under Request Action drag the Assign component and again in Properties (Properties of this Assign) put our variable in Variable selectRequest

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

Then click the icon that looks like a cockroach” as up to then copy the payload

Imagem Blog UansCarvalho

Copied the payload up just now paste only within our Assign as follows:

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

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.

Imagem Blog UansCarvalho

Click OK and get the following:

Imagem Blog UansCarvalho

Good, now we add a Stage for Response Pipeline and within this Stage drag the Replace component as follows:

Imagem Blog UansCarvalho

Click the Replace tab and below Properties place as follows:

  • XPath: . (point)
  • In Variable: body
  • Replace node contents: (Check this option)

Imagem Blog UansCarvalho

Now click <Expression>

The right side in Variable Structures click $body obterDadosClienteResponse and then nomeCliente and drag to the left side as follows:

Imagem Blog UansCarvalho

Now let’s set up our Payload that will be our Response Service

Delete the variable $body and see below how the tags are:

Imagem Blog UansCarvalho

See step by step how simple it is:

It was as follows:

  • $body/ser:obterDadosClienteResponse/nomeCliente

Delete the variable and the bar: $body/

  • ser:obterDadosClienteResponse/nomeCliente

Put the ser:obterDadosClienteResponse get in tags, remembering that I’m opening and closing tags

  • <obterDadosClienteResponse> </obterDadosClienteResponse>

Put the nomeCliente between tags <obterDadosClienteResponse>

  • <ser:obterDadosClienteResponse>
        <nomeCliente> </nomeCliente>
    </ser:obterDadosClienteResponse>

Now fill the other missing tags that are profissaoCliente, salarioCliente and numeroDeptCliente and will be as follows:

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

Now fill our payload so that it is as follows:

Imagem Blog UansCarvalho

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?

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

Go to your SbConsole and now call our service ServiceCalloutProxy

Imagem Blog UansCarvalho

Here I spend <idCliente> 7 that is my ID

Imagem Blog UansCarvalho

Click Execute, and see below the response of our service:

Imagem Blog UansCarvalho

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

/:-D