首页 » Web前端 » phpnosoapaction技巧_postmanSOAP 请求

phpnosoapaction技巧_postmanSOAP 请求

访客 2024-11-21 0

扫一扫用手机浏览

文章目录 [+]

以下步骤显示了如何在 Postman 中发出 SOAP 要求。

输入您的 SOAP 端点

在 Postman 中打开一个新的要求选项卡,并在地址字段中输入您的 SOAP 端点 URL。

phpnosoapaction技巧_postmanSOAP 请求

从要求方法下拉列表中选择POST 。

phpnosoapaction技巧_postmanSOAP 请求
(图片来自网络侵删)

例如,利用以下端点 URL

https://www.dataaccess.com/webservicesserver/NumberConversion.wso

此 SOAP 端点将数值变动为其文本等效项,例如将值“500”变动为“五百”。

添加正文数据

在Body选项卡中,选择raw并从下拉列表中选择XML 。

在文本输入区域中输入您的 XML。

如果要测试上一节中利用的数字转换 SOAP API,请在文本输入区域输入以下 XML:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/"><ubiNum>500</ubiNum></NumberToWords></soap:Body></soap:Envelope>

您的要求正文必须包含端点哀求的 SOAP Envelope、Header和Body标签,以及任何命名空间。
数据须要包含操作的名称,以及您须要发布到做事的任何值。

设置您的要求标头

当您选择 XML 正文类型时,Postman 会自动添加application/xml. 但根据您的做事供应商,您可能须要text/xml一些 SOAP 要求。
检讨您的 SOAP 做事以确定哪个标头是得当的。
如果您须要text/xml标头,则须要覆盖 Postman 添加的默认设置。

如果您跟随数字转换 SOAP API 示例,您须要将内容类型标头变动为text/xml.

打开要求标头。
如果自动天生的标题被隐蔽,请选择关照以显示它们。
取消选择Content-Type邮递员自动添加的标题。
Content-Type在Key字段和Valuetext/xml字段中添加一个新行。
SOAPAction在Key字段和Value"#MethodName"字段中为标题添加新行 。
(引号是必需的。
)如果没有此标头,做事将返回 500。

发送您的要求

选择发送以调用 SOAP 做事。
如果您的呼叫成功,您将在 Postman 的下方选项卡中看到相应。

非常一: no SOAPAction header!

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode><faultstring>no SOAPAction header!</faultstring><detail><ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">iZ3ppe8zx62ky3Z</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>

办理:

在Header里添加:

SOAPAction application/soap+xml;charset=utf-8

非常二:net.sf.json.JSONException: A JSONArray text must start with '[' at character 0 of

办理:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xml.apache.org/axis/"><soapenv:Body><uploadAlarmMessage><cid>[ {'idxx': 'xxxx','alarmxxx':'xxxx','time':'2012-10-22 10:58:06'}]</cid></uploadAlarmMessage></soapenv:Body></soapenv:Envelope>

标签:

相关文章

当前时光函数php技巧_PHP date 函数

PHP date( 函数PHP date( 函数可把韶光戳格式化为可读性更好的日期和韶光。韶光戳是一个字符序列,表示一定的事宜...

Web前端 2024-12-19 阅读0 评论0