API Gateway 10.15 | Getting Started with API Gateway | Create your first SOAP API | Testing a SOAP API using curl
 
Testing a SOAP API using curl
You can test the SOAP API by invoking 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 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.
Let's test the NumberConverter SOAP API, which was imported 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 using curl
1. Start the commad 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.
typescript
<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>
You can copy the XML content in the soapenv:Body from 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:
typescript
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
test soap api using curl
The SOAP API is invoked successfully and returns the status code as 200. The number converted into words is displayed in the response body. You can now expose the API to the consumers.
For details about the further actions you can perform on the API, see All about APIs in the API Gateway User's Guide.