示例#1
0
 /**
  * @param  Doctrine\Common\Collections\Collection                   $collection
  * @throws AntiMattr\Sears\Exception\Connection\ConnectionException
  * @throws AntiMattr\Sears\Exception\Http\BadRequestException
  * @throws AntiMattr\Sears\Exception\IntegrationException
  */
 public function updateShipments(Collection $collection)
 {
     $handler = $this->requestHandlerFactory->createRequestHandler('updateShipments');
     $resource = sprintf('/SellerPortal/api/oms/asn/v5?email=%s&password=%s', 'xxxxxx', 'yyyyyy');
     $request = $this->messageFactory->createRequest('PUT', $resource, 'http://www.example.com');
     $integrationException = null;
     try {
         $handler->bindCollection($request, $collection);
     } catch (IntegrationException $e) {
         $integrationException = $e;
     }
     $requestString = $request->__toString();
     $this->log($requestString);
     $response = $this->messageFactory->createResponse();
     $response->addHeader('1.0 200 OK');
     if (!empty($this->headers)) {
         $response->addHeaders($this->headers);
     }
     if ('' != $this->content) {
         $response->setContent($this->content);
     }
     $responseString = $response->__toString();
     $this->log($responseString);
     $this->reset();
     if ($integrationException) {
         throw $integrationException;
     }
 }
示例#2
0
 /**
  * @param  Doctrine\Common\Collections\Collection                   $collection
  * @throws AntiMattr\Sears\Exception\Connection\ConnectionException
  * @throws AntiMattr\Sears\Exception\Http\BadRequestException
  * @throws AntiMattr\Sears\Exception\IntegrationException
  */
 public function updateShipments(Collection $collection)
 {
     $handler = $this->requestHandlerFactory->createRequestHandler('updateShipments');
     $resource = sprintf('/SellerPortal/api/oms/asn/v5?email=%s&password=%s', $this->email, $this->password);
     $request = $this->messageFactory->createRequest('PUT', $resource, $this->host);
     $integrationException = null;
     try {
         $handler->bindCollection($request, $collection);
     } catch (IntegrationException $e) {
         $integrationException = $e;
     }
     $this->updateHeaders($request);
     $requestString = $request->__toString();
     $this->log($requestString);
     $response = $this->messageFactory->createResponse();
     try {
         $this->buzz->send($request, $response);
     } catch (ClientException $e) {
         $subject = $e->getMessage();
         throw new ConnectionException($subject);
     }
     $responseString = $response->__toString();
     $this->log($responseString);
     if ($integrationException) {
         throw $integrationException;
     }
 }