繁体   English   中英

php肥皂与xml格式的问题

[英]php soap issue with xml format

我有这个XML:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <SessionIdHeader xmlns="http://www.inwise.com/webservices/v2">
      <SessionId>f554159f785d4793ab097470c7c76b2c</SessionId>
      <EndSession>false</EndSession>
    </SessionIdHeader>
  </soap:Header>
  <soap:Body>
    <Send xmlns="http://www.inwise.com/webservices/v2">
      <source xsi:type="MobileMessageSendingSource">
        <Message>
          <AccountId xsi:nil="true" />
          <Body>נסיון</Body>
          <Bounces xsi:nil="true" />
          <Charset>unicode</Charset>
          <CreateDate xsi:nil="true" />
          <EndDate xsi:nil="true" />
          <LastSent xsi:nil="true" />
          <Name>test for bt</Name>
          <NonSent xsi:nil="true" />
          <Opens xsi:nil="true" />
          <RecipientType xsi:nil="true" />
          <Sender>8858</Sender>
          <Sent xsi:nil="true" />
          <Status xsi:nil="true" />
          <TableConnectionId xsi:nil="true" />
          <Unsubscribes xsi:nil="true" />
          <UpdateDate xsi:nil="true" />
          <Validity>1440</Validity>
        </Message>
      </source>
      <target xsi:type="NewRecipientSendingTarget">
        <Recipient>
          <Id>0</Id>
          <MobileNumber>972506471313</MobileNumber>
        </Recipient>
      </target>
    </Send>
  </soap:Body>
</soap:Envelope>

这就是我发送的:

 $paramsSend = array('Message' => 
            array('Body'=>'This is a test message',
                'Name'=>'FromBlind',
                'Sender'=>'7777',
                'Charset' => 'unicode',
                'Validity'=>'1440'
                ),
        array('Recipient' => 
                array(
                    'MobileNumber'=>'7849386874'
                    )
                )
            );
    $x['SessionId'] = $SessionId;
    $x['EndSession'] = 'true';
    $header = new SoapHeader('http://www.inwise.com/webservices/v2', 
                        'SessionIdHeader',
                       $x);
    $c->__setSoapHeaders($header);
$res= $c->__soapCall($module, array($params));

但是他们告诉我,我要发送的XML与他们的XML不一样,我不知道该怎么办,似乎一切都很好。

有什么建议吗?

您的代码不会像上面发布的那样创建xml。 因此,正确的是来自请求的内容格式不正确。

实际上,您发布的XML是调用“发送”操作的SOAP消息,在其中您提供Message和收件人参数,但是如上所述,它不尊重您发布的SOAP消息的格式。 例如,您缺少收件人字段...

尝试构建您的paramsSend像这样发送:

 $paramsSend = array('source' => 
                         array('Message' =>
                                array('Body' => "body value",
                                       'Name' => "name value")
                               ),
               'target' => 
                         array('Recipient' =>
                                 array('Id' => "id value",
                                        'MobileNumber' => "mob numb value")
                               )
                );

记住为消息添加其他丢失的标签(发件人,有效性等)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM