Testing a SOAP API

Testing the imported SOAP API by using SOAPUI

You can test the SOAP API by starting the API from SOAPUI. SOAPUI is just one example of a third-party SOAP test client.

The following section describes the steps to test the NumberConverter SOAP API, which is imported by using a file. In this example, with the imported SOAP API, you can convert a number to the word format.

To test the SOAP API by using SOAPUI

  1. In the SOAPUI, select SOAP in the menu bar.

  2. In the new SOAP Project, add the following fields:

    • Project Name = Your_Project_Name

    • Initial WSDL field = Value in the Documentation > Artifacts fields in API Gateway

    • Select the Created Requests field

    • Click OK

  3. Select Projects > Your_Project_Name > NumberConversionSOAPBinding > NumberToWords > Request1

  4. Add a number 25 in the placeholder marked by ?

  5. In the Authorization tab, select the type as Basic and provide the login credentials of the API Gateway instance.

  6. Click Run.

  7. The SOAP API is started successfully and returns the status code as 200. The number is displayed in words in the response body.

Testing the imported SOAP API by using curl

You can test the SOAP API by starting the gateway endpoint in the curl. SOAP messages must be specified completely as curl is a tool for transferring data from or to a server by using any of the following protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, or TFTP. The following section decries the steps to test the NumberConverter SOAP API, which is imported by using a file. In this example, with the imported SOAP API, you can convert a number to the word format.

To test the SOAP API by using curl

  1. Start the command prompt.

  2. Add the following request body in a file as curl is a tool to transfer data from or to a server without SOAP support. Therefore, messages must be specified completely.

  3. Save the file as c:\Test\curl-test.xml.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.dataaccess.com/webservicesserver/">
    <soapenv:Header/>
    <soapenv:Body>
       <web:NumberToWords>
          <web:ubiNum>25</web:ubiNum>
       </web:NumberToWords>
    </soapenv:Body>
    </soapenv:Envelope>
    Note: You can copy the XML content in the soapenv:Body from the either of the following - API Gateway > Operations > NumberToWords > SOAP11 > Input Message OR API Gateway > Operations > NumberToWords > SOAP12 > Input Message.
  4. In the command prompt, run the following command.

    curl -v -H "Content-Type: text/xml; charset=utf-8" -d @ c:\Test\curl-test.xml -X POST http://hostname:5555/ws/NumberConverter/1.0
  5. The SOAP API is started successfully and returns the status code as 200. The number that is converted into words is displayed in the response body.