SoapUI: Walkthrough 2

SOAP & SOAPUI

Headers

Two-Way

POST http://localhost:8090/axis2/services/GuestManagementService.GuestManagementServiceHttpSoap11Endpoint/ HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: "urn:addGuest"

Content-Length: 451

Host: localhost:8090

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Type: text/xml;charset=UTF-8

Transfer-Encoding: chunked

Date: Sat, 01 Jun 2013 02:42:18 GMT

POST http://localhost:8090/axis2/services/GuestManagementService.GuestManagementServiceHttpSoap11Endpoint/ HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: "urn:getGuestDetails"

Content-Length: 337

Host: localhost:8090

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Type: text/xml;charset=UTF-8

Transfer-Encoding: chunked

Date: Sat, 01 Jun 2013 02:36:36 GMT

 

One-Way

POST http://localhost:8090/axis2/services/GuestManagementService.GuestManagementServiceHttpSoap11Endpoint/ HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: text/xml;charset=UTF-8

SOAPAction: "urn:deleteGuest"

Content-Length: 329

Host: localhost:8090

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

HTTP/1.1 202 Accepted

Server: Apache-Coyote/1.1

Content-Type: text/xml;charset=UTF-8

Transfer-Encoding: chunked

Date: Sat, 01 Jun 2013 02:37:19 GMT




 

Create Bindings and Requests from WSDL file

 

Add WSDL



 

Test Components

 

 

TestSuite

Toolbar

 

Run | Stop/Cancel Test | Run in Sequence | Run in Parrallel | Create LoadUI

 

New Test Case | New Web Test Case

 

 

 

Description

 

Properties

 

Setup Script

 

TearDown Script

 

TestSuite Properties

 

Custom Properties


 

TestCase

Test Case Editor

 

 

Description

 

Properties

 

Setup Script

 

TearDown Script

 

Test Case Log

 


 

 

 

Test Steps

Request

 



 

Response

 

 

Property Transfer

 

Test Suite Properties

Add resID, no value (this gets assigned on first run of test case with Property Transfer)

 

Reservation Property Transfer

ReservationIDTransfer

Source: getReservationDetails , Property: Response

Target: reservationServicer TestSuite , Property: resID

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://exception.reservation.sample.com/xsd';
declare namespace ns2='http://sample.com/reservation/res';
declare namespace ns3='http://sample.com/reservation/res/types';
//ns3:getReservationDetailsResponse/ns3:return/ns3:reservationID

 

Use resID in removeReservation request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://sample.com/reservation/res/types">
  <soapenv:Header/>
  <soapenv:Body>
     <typ:removeReservation>
        <!--Optional:-->
        <typ:reservationID>${#TestSuite#resID}</typ:reservationID>
     </typ:removeReservation>
  </soapenv:Body>
</soapenv:Envelope>

 

MockService

 

 














 

MockResponses

 



 




 


 

Responses



 

 

 

 





 

Creating and using Mock Services

1) Create Project

2) Import initial WSDL file, then import additional WSDL files

3) Create test cases (requests)

4) Create mock services (responses)

5) Start mock service(s)

 

Point TestCases to use Mock Service url

Open TestSuite requests, update ‘endpoint’ to mock service url

From - To

http://<hostname>:8090/axis2/services/GuestManagementService.GuestManagementServiceHttpSoap11Endpoint/

http://<hostname>:8088/mockGuestManagementServiceSoap11Binding

 

 

Editing Mock Service Responses

1) Open Mock Service response editor

2) update the ?’s with needed values

3) Create several responses and control response with Groovy script

 

Open the editor for  getGuestDetails

 

Interface settings

 

Response settings

Dispatch provides for some control of intelligent or varying reponses and the default response.

Tags