php soap问题与xml格式

时间:2012-03-26 14:16:44

标签: php soap

我有这个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不一样, 我不知道该怎么办,好像一切都好......

任何建议?

1 个答案:

答案 0 :(得分:0)

您的代码不会像上面发布的那样创建一个xml。所以从请求中得到的结果不正确。

实际上,您发布的XML是调用操作Send的SOAP消息,您可以在其中提供消息和收件人参数,但是如上所述,不尊重您发布的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")
                               )
                );

请记住为Message(发件人,有效等)添加其他缺少的标签