2011-05-17 230 views
3

我試圖從eway(澳大利亞)實施反覆出現的web服務。我怎麼都無法讓它工作。eWay支付網關

我不斷得到messeage

「元素命名空間‘http://www.eway.com.au/gateway/rebill/manageRebill’rebillCustomerCreate具有不完整的內容可能元素的列表預計:‘CustomerRef’。」

這是WSDL:https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx?wsdl

我是新來的SOAP。試圖在PHP中實現它。任何人都可以請指出我做錯了什麼?

這是我的PHP代碼:

<?php 
$URL = "https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx?wsdl"; 
$option = array("trace"=>true); 
$client = new SOAPClient($URL, $option); 
$functions = $client->__getFunctions(); 
$headeroptions =array('eWAYCustomerID'=>"87654321",'Username'=>"[email protected]","Password"=>"test"); 
$header = new SOAPHeader('http://www.eway.com.au/gateway/rebill/manageRebill', 'eWAYHeader',$headeroptions); 

$bodyoptions = array(
    "customerTitle" => "Mr", 
    "customerFirstName" => "firstname", 
    "customerLastName" => "lastname", 
    "customerAddress" => "address", 
    "customerSuburb" => "someniceplace", 
    "customerState" => "somenicestate", 
    "customerCompany" => "somecompany", 
    "customerPostCode" => "411026", 
    "customerCountry" => "australia", 
    "customerEmail" => "[email protected]", 
    "customerFax" => "123456", 
    "customerPhone1" => "123456", 
    "customerPhone2" => "123456", 
    "customerRef" => "abc123", 
    "customerJobDesc" => "Developer", 
    "customerComments" => "Make it work", 
    "customerURL" => "www.nicesite.com" 
); 

try{ 
    $response = $client->__soapCall("CreateRebillCustomer", $bodyoptions,NULL,$header,$outputHeader); 
    echo $client->__getLastRequest(); 
    //$response = $client->CreateRebillCustomer($bodyoptions); 
    var_dump($response); 
} catch(SOAPFault $e){ 
    print $e; 
} 
?> 
+0

會不會是所有的c需要像CustomerJobDesc一樣大寫,CustomerRef ect – 2011-05-17 09:26:06

+0

在WSDL中看起來並不像這樣。 – Constantine 2011-05-17 09:28:53

回答

0

我建議你使用由EWAY提供的庫和示例。

轉到this頁面。轉到「源代碼」選項卡。該,下載PHP源代碼。也有指導。

+0

使用他們的文件工作...它會存儲所有重要的信息,如計費週期和計費金額。我想更新或使用任何其他方法,您將不得不使用他們的Web服務,我似乎無法解決問題。 – Constantine 2011-05-17 11:33:28

0

2年後,我剛剛遇到了同樣的問題!

可能是有用的人:

$bodyoptions = array(
    "CreateRebillCustomer" => array(
    "customerTitle" => "Mr", 
    ... 
) 
); 
4

我試圖創建EWAY重複計費和客戶, 希望這將有助於其他人新:)

<?php 
    $URL = "https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx?wsdl"; 
    $option = array("trace"=>true); 
    $client = new SOAPClient($URL, $option); 
    $functions = $client->__getFunctions(); 
    $headeroptions =array('eWAYCustomerID'=>"87654321",'Username'=>"[email protected]","Password"=>"test123"); 
    $header = new SOAPHeader('http://www.eway.com.au/gateway/rebill/manageRebill', 'eWAYHeader',$headeroptions); 

    $bodyoptions = array(
        "CreateRebillCustomer" => array(
         "customerTitle" => "Mr",     
          "customerFirstName"=>"Muhammad", 
          "customerLastName"=>"Shahzad", 
          "customerAddress"=>"cust ome rAddress", 
          "customerSuburb"=>"customer Suburb", 
          "customerState"=>"ACT", 
          "customerCompany"=>"customer Company", 
          "customerPostCode"=>"2345", 
          "customerCountry"=>">Australia", 
          "customerEmail"=>"[email protected]", 
          "customerFax"=>"0298989898", 
          "customerPhone1"=>"0297979797", 
          "customerPhone2"=>"0297979797", 
          "customerRef"=>"Ref123", 
          "customerJobDesc"=>"customerJobDesc", 
          "customerComments"=>"customerComments",      
          "customerURL" => "http://www.acme.com.au" 
         ) 
        ); 

     try{ 
      $response = $client->__soapCall("CreateRebillCustomer", $bodyoptions,NULL,$header,$outputHeader); 
      //echo $client->__getLastRequest(); 
      //$response = $client->CreateRebillCustomer($bodyoptions); 
      //echo "<pre>";echo "<br/>"; 
      // print_r($response);   
       echo $result   = $response->CreateRebillCustomerResult->Result;echo "<br/>"; 
       echo $customerId  = $response->CreateRebillCustomerResult->RebillCustomerID;echo "<br/>"; 
       echo "<br/>"; 
      if($result=='Success' AND $customerId){ 
       echo 'Member Created at eWay Successfully!...<br/>'; 
       echo 'Creating Recurring Billing Cycle on eWay,Please wait......<br/>'; 
       //$UpdateRebillCustomer = CreateRebillEvent($customerId); 
       //print_r($UpdateRebillCustomer); 

      } 
      else{ 
       echo $ErrorSeverity = $response->CreateRebillCustomerResult->ErrorSeverity;echo "<br/>"; 
       echo $ErrorDetails = $response->CreateRebillCustomerResult->ErrorDetails;echo "<br/>"; 
      } 
     } 
     catch(SOAPFault $e){ 
      print $e; 
     } 

     if($customerId){ 


        $bodyoptions2 = array(
        "CreateRebillEvent " => array(
          "RebillCustomerID" => $customerId,     
          "RebillInvRef" => "Ref123", 
          "RebillInvDes"=>"description", 
          "RebillCCName"=>"Mr Andy Person", 
          "RebillCCNumber"=>"4444333322221111", 
          "RebillCCExpMonth"=>"12", 
          "RebillCCExpYear"=>"15", 
          "RebillInitAmt"=>"100", 
          "RebillInitDate"=>date('d/m/Y'), 
          "RebillRecurAmt"=>"200", 
          "RebillStartDate"=>date('d/m/Y'), 
          "RebillInterval"=>"31", 
          "RebillIntervalType"=>"1", 
          "RebillEndDate"=>"31/12/2013",      
         ) 
        ); 
      try{  
       $response = $client->__soapCall("CreateRebillEvent", $bodyoptions2,NULL,$header,$outputHeader); 
       //echo $client->__getLastRequest();   
       //print_r($response); 
       echo "<br/>"; 
        echo $result2  = $response->CreateRebillEventResult->Result;echo "<br/>"; 
        echo $RebillCustomerID = $response->CreateRebillEventResult->RebillCustomerID;echo "<br/>"; 
       if($result2=='Success'){ 
        echo 'Recurring Cycle Created Successfully at eWay!...<br/>'; 
        echo 'Member Id is ===>'.$RebillCustomerID; 
        //$UpdateRebillCustomer = CreateRebillEvent($customerId); 
        //print_r($UpdateRebillCustomer);       
       } 
       else{ 
        echo $ErrorSeverity = $response->CreateRebillEventResult->ErrorSeverity;echo "<br/>"; 
        echo $ErrorDetails = $response->CreateRebillEventResult->ErrorDetails;echo "<br/>"; 
       } 

      } 
     catch(SOAPFault $e){ 
      print $e; 
     } 

     } 

     ?> 
+0

這只是救了我的命!謝謝 ... – Adrian 2016-10-20 15:20:10