Пример #1
0
 /**
  * Builds the XOP document part of the request body string.
  *
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  *
  * @return string The XOP document part of request body.
  */
 private function buildXopDocument(\DTS\eBaySDK\Types\BaseType $request)
 {
     return sprintf('%s%s%s%s%s', '--MIME_boundary' . self::CRLF, 'Content-Type: application/xop+xml;charset=UTF-8;type="text/xml"' . self::CRLF, 'Content-Transfer-Encoding: 8bit' . self::CRLF, 'Content-ID: <*****@*****.**>' . self::CRLF . self::CRLF, $request->toRequestXml() . self::CRLF);
 }
Пример #2
0
 /**
  * Sends an API request.
  *
  * @param string $name The name of the operation.
  * @param \DTS\eBaySDK\Types\BaseType $request Request object containing the request information.
  * @param string The name of the PHP class that will be created from the XML response.
  *
  * @return mixed A response object created from the XML respose.
  */
 protected function callOperation($name, \DTS\eBaySDK\Types\BaseType $request, $responseClass)
 {
     $debug = $this->config('debug');
     $url = $this->getUrl();
     $body = $request->toRequestXml();
     $headers = $this->getEbayHeaders($name);
     $headers['Content-Type'] = 'text/xml';
     $headers['Content-Length'] = strlen($body);
     if ($debug) {
         $this->logRequest($url, $name, $headers, $body);
     }
     $response = $this->httpClient->post($url, $headers, $body);
     if ($debug) {
         $this->logResponse($response);
     }
     $xmlParser = new XmlParser($responseClass);
     return $xmlParser->parse($response);
 }