Testing Web Services with soapUI

soapUI is a fantastic tool for testing web services. This article goes through how to use it to test a component interface based web service.

Creating the web service

The first step is to create the message catalog web service. For that part, refer to the article on component interface based web services. Once you have the web service up and running, here's how to test it.

Getting soapUI running

Download soapUI free. I prefer to download the portable zip file for windows and just extract the program into the appropriate location. Once installed, run soapUI by executing soapUI.bat (on Windows) which is located in the bin directory.

Create a new project

In soapUI, choose File > New Project (CTRL + N). Specify the project name (CI_MESSAGE_CATALOG), then enter the URL to the WSDL for your web service. Note that the create requests check box will be automatically selected - leave that set.

soapUI-new-project.png

Once loaded, you should see all of the CI methods and a sample SOAP request generated for each one:

soapUI-project-methods.png

Testing the Get method

Double-click on the generated request for the get method: CQI_MESSAGE_CATALOG_G and that should open a new request window with a SOAP envelope that looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:m10="http://xmlns.oracle.com/Enterprise/Tools/schemas/M1047840.V1">
   <soapenv:Header/>
   <soapenv:Body>
      <m10:Get__CompIntfc__MESSAGE_CATALOG>
         <m10:MESSAGE_SET_NBR>?</m10:MESSAGE_SET_NBR>
      </m10:Get__CompIntfc__MESSAGE_CATALOG>
   </soapenv:Body>
</soapenv:Envelope>

In the generated XML you should see a question mark (?) between the MESSAGE_SET_NBR tags. This indicates that you need to supply a value (message set number) to initiate the get request.

Note that this is exactly the same information you need to supply if you open the message catalog component on the search page:

message-catalog-search.png

Change the question mark ? to an appropriate message set number, e.g. 2 (PeopleCode messages) and press the green arrow on the toolbar to iniitate the request.

If successful, you should get a response SOAP envelope with a list of all messages under this message set. Note you can't filter down to a specific message number (just like you can't from the search page in the message catalog component).

If you get another error check your end point (the URL in the toolbar) and ensure the web service is running. Also make sure the URL is correct (e.g. does it need to have the node in the URL?). If the URL is incorrect, press the drop down arrow and select edit current to modify the end point URL.

Testing the Create method

The create method is used to create a new message catalog entry. To create a message catalog entry you need to:

  • Specify the message set number (99999) and press Add
  • Specify the description/short description (Test Entry)

Then add one or more entries with the following information:

  • Message number (default => 1)
  • Message severity (message, translate => M)
  • Message text (Test Entry)

Here's the soap envelope XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:m23="http://xmlns.oracle.com/Enterprise/Tools/schemas/M237456.V1">
   <soapenv:Header/>
   <soapenv:Body>
      <m23:Create__CompIntfc__MESSAGE_CATALOG>
         <m23:MESSAGE_SET_NBR>99999</m23:MESSAGE_SET_NBR>
         <!--Optional:-->
         <m23:DESCRSHORT>Test Entry</m23:DESCRSHORT>
         <!--Optional:-->
         <m23:DESCR>Test Entry</m23:DESCR>
         <!--Zero or more repetitions:-->
         <m23:PSMSGCATDEFN>
            <m23:MESSAGE_NBR>1</m23:MESSAGE_NBR>
            <m23:MESSAGE_TEXT>Test Entry</m23:MESSAGE_TEXT>
            <m23:MSG_SEVERITY>M</m23:MSG_SEVERITY>
         </m23:PSMSGCATDEFN>
      </m23:Create__CompIntfc__MESSAGE_CATALOG>
   </soapenv:Body>
</soapenv:Envelope>

For the observant, you may think that 99999 is too high a message set number. And in fact it is. Through soapUI using the parameters above you should get the following response from integration broker:

Message set number must not exceed 32,767. (102,2)

Try the create again, but this time replace the message set number, 99999 with the allowable value of 32767. If successful the soap envelope returned will be the message number and the message set number. Visit the message catalog in the application to confirm that your entry has in fact been created:

PeopleTools > Utilities > Administration > Message Catalog

new-message-catalog-entry.png

Updating the component interface web service

You might be wondering why you can't set the explanation text. The reason is that when the message catalog component interface was created with the default settings, it did not bring across the explanation text (DESCRLONG) field into the PSMSGCATDEFN property. You can add this manually by dragging it across from the
component so your component interface looks like this:

add-explanation-text-to-ci.png

If you update of the component interface, you also need update the web service using the CI-based services wizard to regenerate the methods that were affected.

Navigate to: PeopleTools > Integration Broker > Web Services > CI-Based Services

Search for and select the message catalog component interface (MESSAGE_CATALOG) and press the Review Status button. On the next page, it should show you that some of the methods have been updated and do not match, so a new version needs to be created:

update-ci-based-services.png

Select all and press the Display Select Actions button, and on the next page press the Perform Selected Actions button to create new versions of each method.

You will also need to provide the new version of the service through the wizard at:

PeopleTools > Integration Broker > Web Services > Provide Web Service

When complete, you will have two versions of the web service. The latest version can be distinguished by the last part of the URL and should be CI_MESSAGE_CATALOG.2.wsdl - note the 2 which is the new version number.

Now go back to your soapUI, and right click on the binding CI_MESSAGE_CATALOG_Binding and select Update definition, or highlight the binding and press F5. Update the definition URL so that you are pointing to version 2 of your WSDL (CI_MESSAGE_CATALOG.2.wsdl). Also on the update definition screen, make sure you select recreate requests and recreate optional (first three checkboxes).

soapUI-update-definition.png

Note I had some problems initially with this, so it may be easier to just start a new project.

Testing the update method

Next, open the update CI_MESSAGE_CATALOG_UD request 1 and specify the message catalog entry we want to update:

  • Message Set Nbr = 32767

You need to use the update data method (UD) in this example because you are updating child data and not key fields. If you use the update method (UP) you will get an error stating that a Row already exists with the specified keys. (PSMSGCATDEFN)}.

Specify the update values accordingly:

  • Message Nbr = 1
  • Explanation Text (descrlong) = Test entry explanation text

Remove the question marks ? from all the fields you don't want to touch otherwise they will be updated with question marks.

Here's the soap envelope XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:m57="http://xmlns.oracle.com/Enterprise/Tools/schemas/M578035.V1">
   <soapenv:Header/>
   <soapenv:Body>
      <m57:Updatedata__CompIntfc__MESSAGE_CATALOG>
         <m57:MESSAGE_SET_NBR>32767</m57:MESSAGE_SET_NBR>
         <!--Optional:-->
         <m57:DESCRSHORT></m57:DESCRSHORT>
         <!--Optional:-->
         <m57:DESCR></m57:DESCR>
         <!--Zero or more repetitions:-->
         <m57:PSMSGCATDEFN>
            <m57:MESSAGE_NBR>1</m57:MESSAGE_NBR>
            <m57:MESSAGE_TEXT></m57:MESSAGE_TEXT>
            <m57:MSG_SEVERITY></m57:MSG_SEVERITY>
            <!--Optional:-->
            <m57:DESCRLONG>Test entry explanation text.</m57:DESCRLONG>
         </m57:PSMSGCATDEFN>
      </m57:Updatedata__CompIntfc__MESSAGE_CATALOG>
   </soapenv:Body>
</soapenv:Envelope>

If successful you will get a response soap envelope with a notification of value of 1.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <m57:Updatedata__CompIntfc__MESSAGE_CATALOGResponse 
       xmlns:m57="http://xmlns.oracle.com/Enterprise/Tools/schemas/M558117.V1">
         <m57:notification>1</m57:notification>
         <m57:detail/>
      </m57:Updatedata__CompIntfc__MESSAGE_CATALOGResponse>
   </soapenv:Body>
</soapenv:Envelope>

Go into the message catalog and confirm that the explanation text has been updated as expected.

Hopefully this gives you a bit of an understanding of how to test a component interface based web service.

Comments

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License