3

我必须使用Oracle制作的Web服务,我测试了我找到的所有NuSoap示例,但都没有工作,我得到的错误是:

WSDL 中不存在 GetMsisdnPortabilityInfoRequest 操作

GetMsisdnPortabilityInfoRequest 是我必须调用的操作的名称,请求必须如下所示:

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

我必须发送的唯一参数是 msindn,我的代码如下所示:

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

完整的 WSDL 在https://gist.github.com/f55472fe9181856b30de (网络服务在本地网络上,外部无法访问,我已经更改了“example”和“example2”的原始域以保护无辜的服务器)

我也尝试过这种方式,但总是说操作 GetMsisdnPortabilityInfoRequest 不存在于 WSDL

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

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

我做错了什么?我想知道我必须如何发送请求。

提前致谢!

编辑

正确的操作名称是“process”,最终代码如下所示:

$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);  
4

1 回答 1

1

尝试仅调用GetMsisdnPortabilityInfo而不是GetMsisdnPortabilityInfo请求GetMsisdnPortabilityInfo响应

于 2012-12-11T14:57:49.590 回答