Пример #1
0
 /**
  * @return string
  */
 public function send($xml, Port $port, BindingOperation $bindingOperation)
 {
     $url = $port->getDomElement()->evaluate("string(soap:address/@location)", array("soap" => SoapClient::NS));
     $soapAction = $bindingOperation->getDomElement()->evaluate("string(soap:operation/@soapAction)", array("soap" => SoapClient::NS));
     $request = new EntityEnclosingRequest("POST", $url);
     $request->setBody($xml, "text/xml; charset=utf-8");
     $request->addHeader("SOAPAction", '"' . $soapAction . '"');
     if ($this->debugUri) {
         $request->setUrl($this->debugUri);
     }
     try {
         $response = $this->client->send($request);
     } catch (BadResponseException $e) {
         $response = $e->getResponse();
     }
     if (!$response->isSuccessful() && strpos($response->getContentType(), '/xml') === false) {
         throw new TransportException($response->getReasonPhrase(), $response->getStatusCode());
     }
     return $response->getBody(true);
 }