AVAYA web service returns error "Expected element"

558 views Asked by At

I have an application that must consume AVAYA ACE webservice and they will not help me.

I have the webservice running and I can consume it using SOAP UI, but when I want to consume with PHP it gets errors.

I have this in my SOAPUI that works fine:

<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>

I have this in my php file to consume:

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

$client = new nusoap_client("https://user:pass@ip: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>';
?>

And here is the error:

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

                )

        )

)
1

There are 1 answers

0
user2436275 On

I've solved my problem.

Here is one solution. I've created a xml code in nusoap client. I use then the send() method.

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

If anybody needs help with the xml can comment here and I'll try to send the code. I can't paste the code because it is full of url and I get errors....

Bye