Sunday, November 9, 2014

Executing BAM weservice from SOAP UI

In This blog I am going to show how to execute a BAM webservice using SOAP UI.

To do this you need following
1. Up and Running BAM server: To verify that launch http://<server>:<port>/OracleBAMWS/WebServices/DataObjectOperationsByName. If you are asked to provide a username/password it means service is running.
2. Username/password: Second thing you need is a username/password. By default all BAM services are secured using http basic authentication. You need a username/password to execute them.

Here are the steps to do it
1. Launch SOAP UI
2. Create a SOAP UI project:


   You will be asked for username/password twice. (One for accessing wsdl and other for associated xsd.)

   Project should look like
3. Run a service operation: Right click on service operation (say Get) and select 'New Request'

Next screen shows request xml text on one side and a blank page on next side for response.
There are few question marks in request. We need to replace them with appropriate parameter.

We can use document to get  more information about service operations and their respective parameters.

As per document for Get service

keysCSV (xsd:string): Comma separated column IDs that must be used as keys
Sales Number, Sales Area
xmlPayload (xsd:string): The payload specifies what to get from the data object. For the DataObjectOperationsByName web service the data object name is specified in the payload, for example:

<DataObject Name="Employees" Path="/Samples"> 
            <Column Name="Salesperson" Value="Greg Masters"/> 
Key here is that xmlPayload has xml syntax and we need to pass it as a parameter. To do that we need to escape it. We can use any xml escaping site. I used to escape above xmlPayload. Escaped xml text I got is
&lt;DataObject Name=&quot;Employees&quot; Path=&quot;/Samples&quot;&gt;      &lt;Contents&gt;          &lt;Row&gt;             &lt;Column Name=&quot;Salesperson&quot; Value=&quot;Greg Masters&quot;/&gt;          &lt;/Row&gt;     &lt;/Contents&gt; &lt;/DataObject&gt; 

Now put keysCSV and xmlPayload in SOAP UI.

 Last thing that we need to do is to provide username/password.
      Select 'Auth' tab below request section and create a Besic authorization. Provide username/password

 Thats it.

No comments: