WebObjects/Web Services/測試 Terminal 服務
外觀
您可使用 Terminal 中的 telnet 功能測試您的服務。您需要知道服務地址和基本呼叫。
開啟 Terminal 並鍵入 telnet、伺服器地址和埠
telnet 216.139.xxx.xxx 80
然後快速貼上以下文字,其中服務特定資訊應替換這些通用名稱
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>
當然這只是一個示例,但您可以意識到使用 soap 包裝和正確的命名,您可以使用 Terminal 進行 soap 請求。結果也將出現在終端視窗中(向您顯示您的服務是否有效以及所返回的內容)。