Sunday, April 12, 2015

How to send a SOAP Header in BPEL

Hi Friends ,

Many times, we access a SOAP web service which has been secured by username and password.

We need to send these credentials in header part of the web service.

Lets do it....

1) Creating a XSD from the header payload.

Suppose my Header payload is like :

<?xml version="1.0" encoding="windows-1252" ?>
<Credential>
        <username>abc</username>
        <pwd>abc123</pwd>
</Credential>


Click on file and type xml and choose xml schema from xml as shown in below image.


2) Create a variable and select Type as xsd created from header payload as shown in below image.



3) Double click on Invoke activity which invokes the secured web service or you want to send a header in that service and click on header tab.



4) Check in Source  bpelx:inputHeaderVariable Created correctly.

<invoke name="Invoke_NotificationService"
            inputVariable="Invoke_NotificationService_commonNotificationDetails_InputVariable"
            partnerLink="Service1" portType="ns1:CommonNotification"
            operation="commonNotificationDetails" bpelx:invokeAsDetail="no"
            bpelx:inputHeaderVariable="Header"/>

Because some time it create wrongly as below

<invoke name="Invoke_NotificationService"
            inputVariable="Invoke_NotificationService_commonNotificationDetails_InputVariable"
            partnerLink="Service1" portType="ns1:CommonNotification"
            operation="commonNotificationDetails" bpelx:invokeAsDetail="no"
            bpelx:HeaderVariable="Header"/>

Thats it. Done.

No comments:

Post a Comment