Home >Backend Development >PHP Tutorial >关于PHP调用.NET WebService传参问题
function CreditCardChargeAction(){ $ezidebit_client = new \SoapClient("http://ws.cardcall.com.au:8092/CreditCardCharge.svc?WSDL"); $ezidebitRequest = array("biz"=>array("BizID"=>"5","ClientIP"=>"101.178.140.96","HttpReferer"=>"https://www.hellophonecards.com.au/hpchome/recharge.aspx", "BMUserAdminID"=>"1","GMUserAdminID"=>"1","Reason"=>"TPC","CardName" => "1147725","CardNumber" => "4862700011382664","CVV"=>"111", "ExpiryYear" => "16","ExpiryMonth" => "10","Amount" => "10","Currency"=>"AUD", "SerialNo" => "CCAW0101171577","Bonus" => "0")); $soap_result = $ezidebit_client->DoCreditCardCharge($ezidebitRequest);}
这要看 WSDL 才能知道
你的 url 在公网上访问不到,你应该贴出 WSDL 文档
或
print_r($ezidebit_client->__getFunctions());
print_r($ezidebit_client->__getType());
的结果
array (size=1) 0 => string 'DoCreditCardChargeResponse DoCreditCardCharge(DoCreditCardCharge $parameters)' (length=77)string 'struct PayOnlyContract { decimal Amount; string CVV; string CardName; string CardNumber; string Currency; int ExpiryMonth; int ExpiryYear; string Notes; string OrderNumber; int UserDialogSubCategoryID;}' (length=213)string 'struct BizBaseContract { int BMUserAdminID; int BizID; string ClientIP; int GMUserAdminID; string HttpReferer; string Reason;}' (length=133)string 'struct PayPhoneCardByWebsiteContract { decimal Amount; decimal Bonus; string CVV; string CardName; string CardNumber; string Currency; int ExpiryMonth; int ExpiryYear; string SerialNo;}' (length=195)string 'struct OrderPinsContract { decimal Amount; decimal Bonus; int CardProductID; string FaceValue; string MerchUniqRef; string OrderNumber; int Qty;}' (length=153)string 'struct PayFlyerCardContract { decimal Amount; decimal Bonus; string CVV; string CardName; string CardNumber; string CardTypePrefix; string Currency; int ExpiryMonth; int ExpiryYear;}' (length=192)string 'struct PayPhoneCardByStaffContract { decimal Amount; decimal Bonus; string CVV; string CardName; string CardNumber; string Currency; int ExpiryMonth; int ExpiryYear; string SerialNo;}' (length=193)string 'struct PayUserContract { decimal Amount; string CVV; string CardName; string CardNumber; string Currency; int ExpiryMonth; int ExpiryYear; int UserID;}' (length=160)string 'struct PayAgentCCContract { decimal Amount; string CVV; string CardName; string CardNumber; int ChargeID; string Currency; int ExpiryMonth; int ExpiryYear; string Note;}' (length=179)string 'struct PayUserDialogContract { decimal Amount; string CVV; string CardName; string CardNumber; string Currency; int ExpiryMonth; int ExpiryYear; string Notes; int UserDialogID; int UserDialogSubCategoryID;}' (length=217)string 'struct ReturnValContract { string Msg; int Success;}' (length=55)string 'struct DoCreditCardCharge { BizBaseContract biz;}' (length=51)string 'struct DoCreditCardChargeResponse { ReturnValContract DoCreditCardChargeResult;}' (length=82)string 'int char' (length=8)string 'duration duration' (length=17)string 'string guid' (length=11)
DoCreditCardChargeResponse DoCreditCardCharge(DoCreditCardCharge $parameters)
DoCreditCardCharge 只有 DoCreditCardCharge 结构的参数
Array
(
[biz] => Array
(
[BizID] => 5
[ClientIP] => 101.178.140.96
[HttpReferer] => https://www.hellophonecards.com.au/hpchome/recharge.aspx
[BMUserAdminID] => 1
[GMUserAdminID] => 1
[Reason] => TPC
[CardName] => 1147725
[CardNumber] => 4862700011382664
[CVV] => 111
[ExpiryYear] => 16
[ExpiryMonth] => 10
[Amount] => 10
[Currency] => AUD
[SerialNo] => CCAW0101171577
[Bonus] => 0
)
)
你为什么会多出那些参数?并且次序也不对。须知 .Net 对参数要求是很严格的
print_r 打印的结果是不是比 var_dump 打印的清爽了许多?
$ezidebitRequest = array("biz"=>array( "BizID"=>"5","ClientIP"=>"101.178.140.96", "BMUserAdminID"=>"1","GMUserAdminID"=>"1","HttpReferer"=>"https://www.hellophonecards.com.au/hpchome/recharge.aspx","Reason"=>"TPC", "CardName" => "1147725","CardNumber" => "4862700011382664","CVV"=>"111","ExpiryYear" => "16","ExpiryMonth" => "10", "Amount" => "10","Currency"=>"AUD", "SerialNo" => "CCAW0101171577","Bonus" => "0"));
Data contract and biz ID doesn't match
数据合同和商务ID不匹配
所以,这个是,我的问题,还是.net那边的问题,如果是.net那边的,我应该让他怎么做
Data contract and biz ID doesn't match
数据合同和商务ID不匹配
Data contract and biz ID doesn't match
数据合同和商务ID不匹配