【发布时间】:2021-03-29 02:01:48
【问题描述】:
我有一个 XML 请求,但我不知道如何通过该soap 请求发送消息。我的 XML 请求文件结构如下所示。
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://schemas.test.com/xsd/kannel/handler/v1/" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header>
<testsms:authData xmlns:testsms="http://testsms.com/">
<testsms:user>username</testsms:user>
<testsms:key>password</testsms:key>
</testsms:authData>
</soapenv:Header>
<soapenv:Body>
<v1:SMSRequest>
<v1:requestData>
<v1:outSms>message content</v1:outSms>
<v1:recepient>81720233436</v1:recepient>
<v1:depCode>dept code</v1:depCode>
<v1:smscId/>
<v1:billable/>
</v1:requestData>
</v1:SMSRequest>
</soapenv:Body>
</soapenv:Envelope>
我需要通过这个肥皂请求发送消息。谁能帮我?可以使用 PHP(Laravel) 或 NodeJS。我有一个请求网址。
【问题讨论】:
-
尝试将内容类型标头设置为 text/xml 并将此 XML 作为字符串发送到正文中。
-
@OscarVicentePerez 我需要在 PHP 或 NodeJS 中使用这个请求,就像我们使用 rest api 一样。
-
是的,只需发送 xml 而不是 json 并更改内容类型标头。这只是一个类似于 REST 的 HTTP 请求。
标签: javascript php node.js laravel soap