xml格式的php-soap问题


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是调用Send操作的SOAP消息,您在其中提供message和receiver参数,但正如所说,它不尊重您发布的SOAP消息的格式。例如,您缺少收件人字段。。。

试着建立你的参数像这样发送:

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

请记住为Message(Sender,validity等)添加其他缺失的标签