Testing the imported SOAP API by using curl

About this task

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.

Procedure

  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 soapstone: Body from either of the following - webMethods API Gateway > Operations > NumberToWords > SOAP11 > Input Message OR webMethods 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.