WebObjects/Web Services/Testing Services with Terminal

You can test your services using the telnet feature in Terminal. You'll need to know your service address and basic calls.

Open Terminal and type telnet and your server address and port:

telnet 216.139.xxx.xxx 80

Then quickly paste the following text with your service specifics in place of these generic names:

 POST /Apps/WebObjects/appName.woa/ws/ServiceName HTTP/1.0
 Host: 216.139.xxx.xxx
 Content-Type: text/html; charset=utf-8
 Content-Length: 547
 SOAPAction: "OperationName"
 <?xml version="1.0" encoding="UTF-8" ?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <SOAP-ENV:Body>
     <ns0:OperationName xmlns:ns0="http://DefaultNamespace" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
       <inParameter1 xsi:type="xsd:string">49464</inParameter1>
       <inParameter2 xsi:type="xsd:int">10</inParameter2>
     </ns0:OperationName>
   </SOAP-ENV:Body>
 </SOAP-ENV:Envelope>

Of course this is just an example but you can get the idea that with the soap wrapper and proper naming you can user terminal for a soap request. The result will appear in the terminal window as well (showing you if your service works and what it returns).

Last modified on 17 July 2009, at 20:24