2013-08-30 37 views
0

我有一個應用程序必須使用AVAYA ACE webservice,它們不會幫助我。AVAYA Web服務返回錯誤「預期的元素」

我有web服務正在運行,我可以使用SOAP UI來使用它,但是當我想使用PHP時,它會得到錯誤。

我有這個在我的SOAPUI工作正常:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://www.csapi.org/schema/parlayx/third_party_call/v2_3/local"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <loc:makeCall> 
     <loc:callingParty>tel:1781</loc:callingParty> 
     <loc:calledParty>tel:901134625154789</loc:calledParty> 
     </loc:makeCall> 
    </soapenv:Body> 
</soapenv:Envelope> 

我有這個在我的PHP文件中消耗:

<!doctype html> 
<?php 
require_once '../config/clases/nusoap_avaya/lib/nusoap.php'; 

$client = new nusoap_client("https://user:[email protected]:9443/RaptorWeb/services/ThirdPartyCall", false); 


$err = $client->getError(); 
if ($err) { 
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; 
    echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; 
    exit(); 
} 



$params =array(
     "callingParty" => "tel:1781", 
     "calledParty" => "tel:901134625154789" 
     ); 


$result = $client->call('makeCall',$params,'http://www.csapi.org/schema/parlayx/third_party_call/v2_3/local'); 

if ($client->fault) { 
    echo '<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>'; print_r($result); echo '</pre>'; 
} else { 
    $err = $client->getError(); 
    if ($err) { 
     echo '<h2>Error</h2><pre>' . $err . '</pre>'; 
    } else { 
     echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; 
    } 
} 
echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>'; 
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>'; 
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>'; 
?> 

這裏是錯誤:

Array 
(
    [faultcode] => soapenv:Server 
    [faultstring] => AgileCE service exception 
    [detail] => Array 
     (
      [ServiceException] => Array 
       (
        [messageId] => SVC0002 
        [text] => Expected element '[email protected]://www.csapi.org/schema/parlayx/third_party_call/v2_3/local' instead of 'callingParty' here in element [email protected]p://www.csapi.org/schema/parlayx/third_party_call/v2_3/local 
Expected element '[email protected]://www.csapi.org/schema/parlayx/third_party_call/v2_3/local' instead of 'calledParty' here in element [email protected]://www.csapi.org/schema/parlayx/third_party_call/v2_3/local 
Expected element '[email protected]://www.csapi.org/schema/parlayx/third_party_call/v2_3/local' before the end of the content in element [email protected]://www.csapi.org/schema/parlayx/third_party_call/v2_3/local 

       ) 

     ) 

) 

回答

0

我解決了我的問題。

這是一個解決方案。我在nusoap客戶端中創建了一個xml代碼。然後我使用send()方法。

$result=$client->send($msg, $endpoint); 

如果有人需要關於xml的幫助,可以在這裏發表評論,我會嘗試發送代碼。我無法粘貼代碼,因爲它充滿了網址,我收到了錯誤....

再見