2013-01-23 44 views
1

你好,請告訴我怎麼去reposnse從PHP調用webservice的給定WSDL

我有一個WSDL,我想通過它 調用awebservice雖然使用的soapUI我可以得到reposnse但不throgh PHP

我也給那些需要進行

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body> 
    <q2:OneOffDeductionRequestMsg 
    xmlns:q0="http://www.huawei.com/bme/accountmgr" 
    xmlns:q1="http://www.huaweiommon" 
    xmlns:q2="http://www.accountmgrmsg"> 
    <RequestHeader> 
    <q1:CommandId>OneOffDeduction</q1:CommandId> 

    <q1:Version>1</q1:Version> 
    <q1:TransactionId/> 
    <q1:SequenceId>1</q1:SequenceId> 

<q1:RequestType>Event</q1:RequestType> 
    <q1:SessionEntity> 
    <q1:Name>NET</q1:Name> 
    <q1:Password>084912FA9733C4A0115D</q1:Password> 
<q1:RemoteAddress>10.176.122.2</q1:RemoteAddress> 
</q1:SessionEntity> 
<q1:SerialNo>192741328589162212</q1:SerialNo> 
</RequestHeader> 
<OneOffDeductionRequest> 
<q0:SubscriberNo>XXXXXX73</q0:SubscriberNo> 
<q0:OperationID>4059999</q0:OperationID> 
<q0:AdditionalInfo>VNET</q0:AdditionalInfo> 
<q0:DeductAmt>100</q0:DeductAmt> 
<q0:MinMeasureId>101</q0:MinMeasureId> 
</OneOffDeductionRequest> 
</q2:OneOffDeductionRequestMsg> 
</soapenv:Body></soapenv:Envelope> 

這裏的XML請求是利用它的PHP代碼:

<?php 

    $RequestHeader = array( 
      'CommandId' => 'OneOffDeduction', 
    'Version' => '1', 
    'TransactionId' => '34234', 
    'SequenceId' => '1', 
    'RequestType' => 'EVENT',  
    'SerialNo' => '1527013286284589162212'); 


    $SessionEntity =array(
    'Name'  => 'V', 
      'Password' => 'v', 
     'RemoteAddress' =>'10.0.0.0'); 


$wsdl ="http://eAccountMgrService?wsdl"; 
$client = new SoapClient($wsdl); 

    $param =array('SubscriberNo'=>'54321', 
'OperationID' =>'4059999', 
'AdditionalInfo'=>'VAS2NET', 
'DeductAmt'=>'10', 
'MinMeasurId'=>'101'); 

var_dump($client); 

    $Result = $client->__call('OneoffDeduction',array( 
      'CommandId' => 'OneOffDeduction', 
    'Version' => '1', 
    'TransactionId' => '34234', 
    'SequenceId' => '1', 
    'RequestType' => 'ET',  
    'SerialNo' => '1527', 
    'sessionEntity' =>array(
    'Name'  => 'V', 
      'Password' => 'v', 
     'RemoteAddress' =>'10.0.0.0'))); 
    var_dump($Result); 

    echo $client->__getLastRequest(); 

$Response = $client->__call('OneoffDeduction',array('SubscriberNo'=>'54321', 
'OperationID' =>'4059999', 
' AdditionalInfo'=>'VAET', 
'DeductAmt'=>'10', 
'MinMeasurId'=>'101')); 

    echo $client->__getLastRequest(); 
    ?> 
+0

是否有此API的文檔或代碼示例? –

+0

客戶端代碼如下 – arjun

回答

0

直到你的代碼乾乾淨淨地組織起來,調試這個問題並不容易/可能。由於你定義了你永遠不會使用的變量,很可能你已經對實際發送到API的變量感到困惑 - 例如, $params似乎從未以任何形式發送

建議您refer to the soapClient docs以確保您傳遞正確的列表。