Scope:

 

  • Create/Run receiver side’s SOAP/HTTP mock services 
  • Setup SAP PI for the created services
  • Basic testing scenario with LOADUI

 

       

Introduction

 

          Mock service will make your computer to pretend to be the service server and reply the requests from clients connected to you. This requires connection and firewall settings to allow the requests from local network.

 

  mock_service_1-2.png
Normal
Scenario Diagrams

 

 

     Possibilities and situations to use the mock services

1) as SAP

SOAP UI Mock service could be used as SAP Systems on the receiver end of
the scenarios. In this type of mocking, the service structure should be
exported from SAP (RFC).

 

2) as Web Service

Normally the mock service mimics the behavior of web servers’ service. The service
structure could be created from any web services within SOAP standard.

 

     For both types of mock testing, the response message can be defined either conditionally or constantly in SOAPUI.

 

  

mock_service_3-4.png

Mock Scenario
Diagrams

 

   

Mock Services Creation

 

1) Prepare request/response structure (WSDL)

          According to Introduction, before creating any mock service, there is at least one XML structure required to define the request message. There will be another structure to define the response message if it is synchronous interface. Those structures are from the system we tend to mock. The methods to achieve the structures will not be discussed in this article.

          SOAPUI supports the many WSDL/XML formats of service structure. Mostly every XML format file that can be imported to SOAPUI can also be used to create mock service.

 

mock_service_5.png

 

Check if the service structure is importable to SOAPUI

 

 

2) Create the Mock services

          After the normalrequest message is imported, right –click at the Request and click “Generate MockService.”

 

mock_service_6.png

 

Request
menu

 

          The MockService generation dialog appears. In this dialog, Path (a part of mock service URL) and Port are need. The port must be any port that is not currently used by other processes.

 

mock_service_7.png

 

mock_service_8.png

   

Generating
dialog

 

          After finishing the process, the mock service entry will appear.

 

mock_service_9.png

 

Created
mock services

   

          Double-click at the Response entry; the response structure will appear on the right side of the request/response screen. According to the testing concept, this test focuses on interfacing capability not the functionality. Therefore, the constant response entered here will be used for replying every request message. 

mock_service_10.png

 

          The other specific parameters, such as the delay time before sending response, of the service could be set at the right bottom of screen after click on the Response entry.


mock_service_11.png

 

3) Run the services

          After all configurations, double-click at the mock service entry the service control dialog will appear. Click the green start button to run the service.

 

 

mock_service_12.png

 

mock_service_13.png

 

Running service

 

 

4) Test the services

          Double-click on the sub-entry of the service, another service dialog will appear. Click “Opens a Request for MockOperation” to test the service.

 

mock_service_14.png

          The request/response dialog will appear. Please note that the request URL consists of your computer name that might not be able to access by other objects in the network. However, for this step, just click the submit button to see the result.

 

mock_service_15.png

           If the response message, which you have defined in the step before, is displayed correctly, your new mock service is successfully created.

 

mock_service_16.png

 

            At this time, if you double-click at the Response entry, you will see the request message that you just sent in the left panel.

 

mock_service_17.png 

          In order to enable your service to other computers in the network, you have to specify your IP address in the service URL instead of your computer’s name.

 

mock_service_18.png

 

          Edit the current URL to test the service again.

mock_service_19.png

          Check if the service is working correctly through new URL.

 

mock_service_20.png

 

          The instructions above are commonly used for both synchronous and asynchronous interfaces. SOAPUI knows the type of structures since they are imported.

 

mock_service_21.png

          The difference between synchronous and asynchronous is the response message. The asynchronous message might require only just SOAP envelope for the response.

 

mock_service_22.png

   

SAP PI Settings

 

          After the service is running, the steps above show the direct connection to service. In this section, we will connect to the service by using SAP PI as the middleware. The request messages will be sent from mock sender (your computer) to SAP PI. Then SAP PI will deliver those messages to mock receiver (your computer) and wait for the response to reply back to the sender (if it is the synchronous interface).

          This example uses the SOAP sender/receiver channels to behave like SOAP -> SAP PI -> SAP ECC synchronous interface.

  mock_service_3.png

 

1) Prepare the communication channels

          Since the createdservice is acting as SAP ECC’s BAPI, normally we use RFC communication channel or SAP Proxy to interact with SAP, but it easier to change the communication channel type to SOAP in order to connect to the mock service. So a SOAP receiver is to be created.

          Please note that the Target URL of the SOAP Receiver is pointed to newly created service. That means SAP PI will transfer every transaction that enter this interface to your computer.

 

mock_service_24.png

          Update the Receiver Agreement to use the created SOAP receiver.

 

mock_service_25.png

          Check if the communication channels, both sender and receiver, are updated and running.

 

2) Test and check the result

          You can use normal SOAP sender and structure to send the message to SAP PI and see if the response message is as same as the prepared.

 

mock_service_26.png

 

          The message is sent through SAP PI to the created service.

 

mock_service_27.png

 

Basic LOADUI

 

          There are many ways to simulate load transactions for SAP PI. A convenient method is using LOADUI which receive SOAPUI project file and test case. Following steps will show how to create constant load transactions from mock sender to SAP PI.

 

1) Create SOAPUI test suite and test case

          After editing the request message content and authentication of a request message in SOAPUI. Right-click at the Request entry and click “Add to TestCase”.

 

mock_service_28.png

          If there is no created test suite, SOAPUI will ask to create new one. After the test suite and test case are created, right-click at the root of the structure. Click “Save Project As” to save the XML file of SOAP UI Project.

 

mock_service_29.png

 

mock_service_30.png

   

Create the SOAPUI project XML file

 

2) Import SOAPUI Project to LOADUI

          Create new project in LOADUI and import the project XML file to the soapUI runner component.

 

mock_service_31.png

 

3) Necessary components for testing

Drag other necessary components such as generator and statistics panel to the stage and connect them together. Then run the program and check the result.

 

 

  http://www.use.com/images/s_2/d379a6ff3d4f8c6083c0_2.jpg

Actions