$client = new SoapClient("http://soap.m4u.com.au/?wsdl", array("trace" => 1));
$params = array(
"authentication" => array(
"userId" => "user",
"password" => "pass"
),
"requestBody" => array(
"messages" => array(
"message" => array(
"recipients" => array( "recipient" => array("1" => "9799996899") ),
"content" => "Message Content"
)
)
)
);
$response = $client->__soapCall("sendMessages", array($params));
但我收到以下错误
Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] The request is either not well-formed or is not valid against the relevant schema.
我需要如下的请求格式。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://xml.m4u.com.au/2009">
<soapenv:Header/>
<soapenv:Body>
<ns:sendMessages>
<ns:authentication>
<ns:userId>Username</ns:userId>
<ns:password>Password</ns:password>
</ns:authentication>
<ns:requestBody>
<ns:messages>
<ns:message format="SMS" sequenceNumber="1">
<ns:recipients>
<ns:recipient uid="1">61400000001</ns:recipient>
<ns:recipient uid="2">61400000002</ns:recipient>
</ns:recipients>
<ns:content>Message Content</ns:content>
</ns:message>
</ns:messages>
</ns:requestBody>
</ns:sendMessages>
</soapenv:Body>
</soapenv:Envelope>
我怎么能做到这一点,请帮忙。