2012-03-26 166 views
0

我有這樣的XML:PHP肥皂問題

<?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, 我不知道該怎麼辦了,好像一切正​​常....

任何意見的?

+0

'$ paramsSend = array('和'$ c - > __ soapCall($ module,array($ params));'爲什麼不同的數組名稱? – Electronick 2012-03-26 14:23:58

回答

0

你的代碼不會像上面發佈的那樣創建一個xml。所以正確的格式不是正確的格式。

實際上,您發佈的XML是調用操作的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") 
           ) 
       ); 

記住要添加其他缺少的標籤信息(發件人,有效性等)

+0

是的,我知道,現在我得到:「source不能爲null」不知道如何發送源... – Hanan 2012-03-26 16:00:07

+0

那麼當你建立消息插入數組「消息」之前數組消息。這種方式消息是數組源的一個元素,你不會得到錯誤要麼。還要注意你必須建立一個合適的數組層次結構來匹配你發佈的xml的target-> recipinet部分 – 2012-03-26 16:09:39

+0

我嘗試了3次和3次我得到了同樣的錯誤,我想這是因爲'xsi :type =「MobileMessageSendingSource」'我需要設置它.. – Hanan 2012-03-26 16:15:35