basit php gerekli paypal için örnek SoapClient

0 Cevap php

Ben sürüm numarası ile hiçbir şey ama Paypal boş bir arama yapmak için PHP'nin SoapClient sınıfını kullanarak basit bir örnek alabilir miyiz? Ben doğru WSDL url ve sunucu url var, bu yüzden bu konuda yardıma ihtiyacım var ne yok. Bu benim ne var:

public function SOAPcall($function, $args=array()) {
    $args['Version'] = '63.0';
    $args = new SoapVar($args, SOAP_ENC_ARRAY, $function.'_Request');
    $args = array(new SoapVar($args, SOAP_ENC_ARRAY, $function.'_Req', 'urn:ebay:api:PayPalAPI'));
    $results = $this->soapClient->__soapCall($function, $args, array('location' => $this->activeKeys['certificate']), $this->soapOptions);
}

Bunu ben her şeyi gösteren değilim tamam umuyoruz. Aşağıda görebileceğiniz gibi istek gövdesi, tamamen yanlış çıkıyor:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:ebay:api:PayPalAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:ebay:apis:eBLBaseComponents">
      <SOAP-ENV:Header>
            <ns1:RequesterCredentials>
                  <ns2:Credentials>
                        <ns2:Username>xxx</ns2:Username>
                        <ns2:Password>xxx</ns2:Password>
                        <ns2:Signature>xxx</ns2:Signature>
                  </ns2:Credentials>
            </ns1:RequesterCredentials>
      </SOAP-ENV:Header>
      <SOAP-ENV:Body>
            <ns1:GetBalanceReq xsi:type="ns1:GetBalance_Req">
                  <xsd:string>63.0</xsd:string>
            </ns1:GetBalanceReq>
      </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Bu gibi görünmelidir:

<?xml version=”1.0” encoding=”UTF-8”?>
<SOAP-ENV:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:SOAP-ENC=”http://schemas.xmlsoap.org/soap/encoding/”
xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/”
><SOAP-ENV:Header>
<RequesterCredentials xmlns=”urn:ebay:api:PayPalAPI”>
<Credentials xmlns=”urn:ebay:apis:eBLBaseComponents”>
<Username>api_username</Username>
<Password>api_password</Password>
<Signature/>
<Subject/>
</Credentials>
</RequesterCredentials>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<specific_api_name_Req xmlns=”urn:ebay:api:PayPalAPI”>
<specific_api_name_Request>
<Version xmlns=urn:ebay:apis:eBLBaseComponents”>service_version
</Version>
<required_or_optional_fields xsi:type=”some_type_here”> data
</required_or_optional_fields>
</specific_api_name_Request>
</specific_api_name_Req>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Tabii ki, Paypal bir "Sürüm desteklenmiyor" hata atar.

0 Cevap