Saturday, 30 April 2016

Web Service Testing (using Client security certificate .pfx format) by using SOAP UI Tool





Please follow below steps for working with web service

Test Web Service URL = http://www.webservicex.com/currencyconvertor.asmx?WSDL
Test Client Security certificate (.pfx) = c:\test-certificate.pfx
Test Client Security certificate Password = 1234




1) create SOAP Project

- File -> New SOAP Project -> Enter Project Name -> Click ok

2) Add WSDL Link

Right Click on project -> Add Wsdl -> Enter Web Service URL -> Click ok

Ex : http://www.webservicex.com/currencyconvertor.asmx?WSDL



3) Import client Security certificate 


i) Add Certificate in Kestores

Double Click on Project -> WS-Security Configurations tab-> Keystores tab -> Click + (Add New keysore to this config) -> Select file (c:\test-certificate.pfx) -> enter password (1234) -> click ok -> The Status automatically changed to "OK" (If NOT issue in certificate).


ii) Outgoing WS-Security Configurations

- Click + (Add New Outgoing WSS Configuration) -> Enter Any name for outgoing WSS Configuration (Ex: Test_OUtgoing)-> Click "ok"

- Click + (Add new WSS Entry) -> Select Type of Entry to Add is "Signature".

- double click on "Signature" for configuration (Add below value)

Keystore = Select certificate from drop down (c:\test-certificate.pfx)
Alias = Select Alis from drop down
Password = 1234  (Test Client Security certificate Password)
Key Identifier Type = "Binary Security Token"
Signature Algorithm =
Signature canonicalization =
Digest Algorithm =
Use Single Certificate = check the checkbox


iii) incoming WS-Security Configurations

- Click + (Add New Incoming WSS Configuration) -> Enter Any name for Incoming WSS Configuration (Ex: Test_Incoming) -> Click "ok"

- Select Decrypt Keysore and Signature keystore from drop down



iv) Save all the changes



4) Add New Authorization


- Double click on "Request1" under the project
- Click "Auth" (Authentication and Security related settings) in below Request1
- Select Authorization as "Add New Authorization.."
- Select Authorization Type as "Basic"
- Select outgoing WSS = Test_OUtgoing (Which we create Outgoing WS-Security Configurations)
- Select Incoming WSS = Test_Incoming (Which we create incoming WS-Security Configurations)



5) SOAP Request

Double click on Request1 under the project and enter below mentioned code

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:ConversionRate>
         <web:FromCurrency>AFA</web:FromCurrency>
         <web:ToCurrency>DZD</web:ToCurrency>
      </web:ConversionRate>
   </soapenv:Body>
</soapenv:Envelope>


And click Run (Trigger) the SOAP Request


6) SOAP Response

We are getting the below responce once we triggered the


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <ConversionRateResponse xmlns="http://www.webserviceX.NET/">
         <ConversionRateResult>-1</ConversionRateResult>
      </ConversionRateResponse>
   </soap:Body>
</soap:Envelope>

No comments:

Post a Comment