NuSoap operation not present in WSDL

movihus picture movihus · Dec 5, 2012 · Viewed 8.4k times · Source

I must use a webservice made ​​with Oracle, I tested all the examples I found of NuSoap but none work, the error I get is:

operation GetMsisdnPortabilityInfoRequest not present in WSDL

GetMsisdnPortabilityInfoRequest is the name of the action I must call, the request must look like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.tigo.com/GetMsisdnPortabilityInfoRequest/V1" xmlns:v11="http://www.tigo.com/Core/Common/Header/Request/V1" xmlns:v12="http://www.tigo.com/ParameterType/V1">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:GetMsisdnPortabilityInfoRequest>
         <v11:RequestHeader>
            <v11:Consumer code="WEBTIGO" name="WEBTIGO">
            </v11:Consumer>
            <v11:Transport code="WS" name="WS">
               <v11:communicationType>SYN</v11:communicationType>
            </v11:Transport>
            <v11:Service code="1" name="1">
            </v11:Service>
            <v11:Message messageId="1" messageIdCorrelation="1" conversationId="1">
            </v11:Message>
            <v11:Country name="PY" isoCode="600"/>
         </v11:RequestHeader>
         <v1:requestBody>
            <v1:msisdn>0961123456</v1:msisdn>
         </v1:requestBody>
      </v1:GetMsisdnPortabilityInfoRequest>
   </soapenv:Body>
</soapenv:Envelope>

The only parameter I must send is msindn, my code looks like this:

require_once('lib/nusoap.php');

$url = "http://10.16.210.128/sbresource?PROXY/Portability/Gateway/PS/PS_GetMsisdnPortabilityInfo";  
$headers_raw = '<v11:RequestHeader>
        <v11:Consumer code="WEBTIGO" name="WEBTIGO">
        </v11:Consumer>
        <v11:Transport code="WS" name="WS">
           <v11:communicationType>SYN</v11:communicationType>
        </v11:Transport>
        <v11:Service code="1" name="1">
        </v11:Service>
        <v11:Message messageId="1" messageIdCorrelation="1" conversationId="1">
        </v11:Message>
        <v11:Country name="PY" isoCode="600"/>
     </v11:RequestHeader>';

$body_raw_xml = '<v1:msisdn>0961123456</v1:msisdn>';

$client = new nusoap_client($url, true);


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

$result = $client->call('GetMsisdnPortabilityInfoRequest', $body_raw_xml, '', '',  $headers_raw, null);

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>' . $client->request . '</pre>';
echo '<h2>Response</h2><pre>' . $client->response . '</pre>';
echo '<h2>Debug</h2><pre>' . $client->getDebug() . '</pre>';

The complete WSDL is in https://gist.github.com/f55472fe9181856b30de (The webservice is on a local network, not accessible outside, I have changed the original domains for "example" and "example2" to protect the innocent servers)

I have tried also this way, but always says operation GetMsisdnPortabilityInfoRequest not present in WSDL

$params = array('v1:msisdn' => $number);

$result = $client->call('V1:GetMsisdnPortabilityInfoRequest', $params, '', '', $headers_raw);

What I doing wrong? I would like to know how I must send the request.

Thanks in advance!

Edit

The correct action name was "process" and the final code looks like this:

$raw_xml = '<v1:GetMsisdnPortabilityInfoRequest>
       <v11:RequestHeader>
          <v11:Consumer code="WEBTIGO" name="WEBTIGO">
          </v11:Consumer>
          <v11:Transport code="WS" name="WS">
             <v11:communicationType>SYN</v11:communicationType>
          </v11:Transport>
          <v11:Service code="1" name="1">
          </v11:Service>
          <v11:Message messageId="1" messageIdCorrelation="1" conversationId="1">
          </v11:Message>
          <v11:Country name="PY" isoCode="600"/>
       </v11:RequestHeader>
       <v1:requestBody>
          <v1:msisdn>' . $full_number . '</v1:msisdn>
       </v1:requestBody>
    </v1:GetMsisdnPortabilityInfoRequest>';    

// cliente del soap
$client = new nusoap_client($url, true);  

$err = $client->getError();
if ($err) {
  echo json_encode(array('status' => $err));
  exit();
}            

// realizamos la consulta al webservice, nombre método consultado = process
$result = $client->call('process', $raw_xml);  

Answer

Walter Jr. picture Walter Jr. · Dec 11, 2012

Try calling only GetMsisdnPortabilityInfo and not GetMsisdnPortabilityInfoRequest or GetMsisdnPortabilityInfoResponse