首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eway沙盒网关卷曲

Eway沙盒网关卷曲
EN

Stack Overflow用户
提问于 2012-06-19 17:33:13
回答 4查看 962关注 0票数 0

我正在开发一个与Eway连接的网站。我试着在沙盒里给客户重新开单。但是调用中的一些错误。

代码语言:javascript
复制
<?php

$url = "https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx";

$post_string = '<?xml version="1.0" encoding="utf-8"?>
                <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                  <soap:Header>
                    <eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
                      <eWAYCustomerID>9194****</eWAYCustomerID>
                      <Username>******@********d.com.sand</Username>
                      <Password>S******55</Password>
                    </eWAYHeader>
                  </soap:Header>
                  <soap:Body>
                    <CreateRebillCustomer xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
                      <customerTitle>Mr</customerTitle>
                      <customerFirstName>Achintha</customerFirstName>
                      <customerLastName>Samindika</customerLastName>
                      <customerAddress>SID Designs</customerAddress>
                      <customerSuburb>Colombo</customerSuburb>
                      <customerState>ACT<</customerState>
                      <customerCompany>SID Con</customerCompany>
                      <customerPostCode>2111</customerPostCode>
                      <customerCountry>Australia</customerCountry>
                      <customerEmail>a****@ymail.com</customerEmail>
                      <customerFax>0298989898</customerFax>
                      <customerPhone1>0298989558</customerPhone1>
                      <customerPhone2>0295489898</customerPhone2>
                      <customerRef>REF585</customerRef>
                      <customerJobDesc>Dev</customerJobDesc>
                      <customerComments>Please Ship ASASP</customerComments>
                      <customerURL>www.****.com</customerURL>
                    </CreateRebillCustomer>
                  </soap:Body>
                </soap:Envelope>';


$header  = "POST /gateway/rebill/test/manageRebill_test.asmx HTTP/1.1 \r\n";
$header .= "Host: www.eway.com.au \r\n";
$header .= "Content-Type: text/xml; charset=utf-8 \r\n";
$header .= "Content-Length: ".strlen($post_string)." \r\n";
//$header .= 'SOAPAction: "http://www.eway.com.au/gateway/rebill/manageRebill/CreateRebillCustomer"'. "\r\n";
$header .= "Connection: close \r\n\r\n"; 
$header .= $post_string;

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

$data = curl_exec($ch); 
$status = curl_getinfo($ch);

if(curl_errno($ch))
    print curl_error($ch);
else{
    curl_close($ch);

    echo '<pre>';
    print_r($data);
    print_r($status);
    echo '</pre>';
    //echo '<div align="center"><h3>Thank you.</h3></div>';
}
?>
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-06-21 02:06:24

中有一个语法错误

<customerState>ACT<</customerState>

我的原始代码是工作时,这个额外的小于删除。

工作代码。

代码语言:javascript
复制
<?php

    $url = "https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx";

    $post_string = '<?xml version="1.0" encoding="utf-8"?>
                                    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                                      <soap:Header>
                                            <eWAYHeader xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
                                              <eWAYCustomerID>9194****</eWAYCustomerID>
                                              <Username>******@********d.com.sand</Username>
                                              <Password>S******55</Password>
                                            </eWAYHeader>
                                      </soap:Header>
                                      <soap:Body>
                                            <CreateRebillCustomer xmlns="http://www.eway.com.au/gateway/rebill/manageRebill">
                                              <customerTitle>Mr</customerTitle>
                                              <customerFirstName>Achintha</customerFirstName>
                                              <customerLastName>Samindika</customerLastName>
                                              <customerAddress>SID Designs</customerAddress>
                                              <customerSuburb>Colombo</customerSuburb>
                                              <customerState>ACT</customerState>
                                              <customerCompany>SID Con</customerCompany>
                                              <customerPostCode>2111</customerPostCode>
                                              <customerCountry>Australia</customerCountry>
                                              <customerEmail>a****@ymail.com</customerEmail>
                                              <customerFax>0298989898</customerFax>
                                              <customerPhone1>0298989558</customerPhone1>
                                              <customerPhone2>0295489898</customerPhone2>
                                              <customerRef>REF585</customerRef>
                                              <customerJobDesc>Dev</customerJobDesc>
                                              <customerComments>Please Ship ASASP</customerComments>
                                              <customerURL>www.****.com</customerURL>
                                            </CreateRebillCustomer>
                                      </soap:Body>
                                    </soap:Envelope>';


    $header  = "POST /gateway/rebill/test/manageRebill_test.asmx HTTP/1.1 \r\n";
    $header .= "Host: www.eway.com.au \r\n";
    $header .= "Content-Type: text/xml; charset=utf-8 \r\n";
    $header .= "Content-Length: ".strlen($post_string)." \r\n";
    //$header .= 'SOAPAction: "http://www.eway.com.au/gateway/rebill/manageRebill/CreateRebillCustomer"'. "\r\n";
    $header .= "Connection: close \r\n\r\n";
    $header .= $post_string;

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_URL,$url);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);

    $data = curl_exec($ch);
    $status = curl_getinfo($ch);

    if(curl_errno($ch))
            print curl_error($ch);
    else{
            curl_close($ch);

            echo '<pre>';
            print_r($data);
            print_r($status);
            echo '</pre>';
            //echo '<div align="center"><h3>Thank you.</h3></div>';
    }
    ?>
票数 2
EN

Stack Overflow用户

发布于 2012-06-19 21:24:36

你能试试这个吗。修改了一些报头。

代码语言:javascript
复制
<?php
$url = 'https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx';
$post_string = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
                <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
                  <soap:Header>
                        <eWAYHeader xmlns=\"http://www.eway.com.au/gateway/rebill/manageRebill\">
                          <eWAYCustomerID>9194****</eWAYCustomerID>
                          <Username>******@********d.com.sand</Username>
                          <Password>S******55</Password>
                        </eWAYHeader>
                  </soap:Header>
                  <soap:Body>
                        <CreateRebillCustomer xmlns=\"http://www.eway.com.au/gateway/rebill/manageRebill\">
                          <customerTitle>Mr</customerTitle>
                          <customerFirstName>Achintha</customerFirstName>
                          <customerLastName>Samindika</customerLastName>
                          <customerAddress>SID Designs</customerAddress>
                          <customerSuburb>Colombo</customerSuburb>
                          <customerState>ACT<</customerState>
                          <customerCompany>SID Con</customerCompany>
                          <customerPostCode>2111</customerPostCode>
                          <customerCountry>Australia</customerCountry>
                          <customerEmail>a****@ymail.com</customerEmail>
                          <customerFax>0298989898</customerFax>
                          <customerPhone1>0298989558</customerPhone1>
                          <customerPhone2>0295489898</customerPhone2>
                          <customerRef>REF585</customerRef>
                          <customerJobDesc>Dev</customerJobDesc>
                          <customerComments>Please Ship ASASP</customerComments>
                          <customerURL>www.****.com</customerURL>
                        </CreateRebillCustomer>
                  </soap:Body>
                </soap:Envelope>";

    $headers    = array(
        "Content-Length: : " . strlen($post_string),
       'Content-Type: application/soap+xml;charset=utf-8'
   );

$ch     = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_string );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );

$data = curl_exec($ch);
$status = curl_getinfo($ch);

if(curl_errno($ch)) {
        print curl_error($ch);
}else{
        curl_close($ch);

        echo '<pre>';
        print_r($data);
        print_r($status);
        echo '</pre>';
        //echo '<div align="center"><h3>Thank you.</h3></div>';
}
?>

请替换您的占位符。希望它能起作用。

票数 0
EN

Stack Overflow用户

发布于 2012-06-20 11:25:52

请使用以下名称空间。

代码语言:javascript
复制
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="https://www.eway.com.au/gateway/managedpayment">
   <soapenv:Header>
      <man:eWAYHeader>
         <man:eWAYCustomerID></man:eWAYCustomerID>
         <man:Username></man:Username>
         <man:Password></man:Password>
      </man:eWAYHeader>
   </soapenv:Header>
   <soapenv:Body>
      <man:CreateCustomer>
         <man:Title></man:Title>
         <man:FirstName></man:FirstName>
         <man:LastName></man:LastName>
         <man:Address></man:Address>
         <man:Suburb></man:Suburb>
         <man:State></man:State>
         <man:Company></man:Company>
         <man:PostCode></man:PostCode>
         <man:Country></man:Country>
         <man:Email></man:Email>
         <man:Fax></man:Fax>
         <man:Phone></man:Phone>
         <man:Mobile></man:Mobile>
         <man:CustomerRef></man:CustomerRef>
         <man:JobDesc></man:JobDesc>
         <man:Comments></man:Comments>
         <man:URL></man:URL>
         <man:CCNumber></man:CCNumber>
         <man:CCNameOnCard></man:CCNameOnCard>
         <man:CCExpiryMonth></man:CCExpiryMonth>
         <man:CCExpiryYear></man:CCExpiryYear>
      </man:CreateCustomer>
   </soapenv:Body>
</soapenv:Envelope>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11098212

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档