Exemple #1
0
 /**
  * @param  Port                           $port
  * @throws UnsuppoportedProtocolException
  * @return IBinding
  */
 protected function getBinding(Port $port)
 {
     foreach ($this->supportedBindings as $ns => $callback) {
         if ($port->getDomElement()->query(".//*[namespace-uri()='{$ns}']")->length) {
             return call_user_func($callback, $port, $this->getOptions($ns));
         }
     }
     throw new UnsuppoportedProtocolException("Nessun protocolo compatibile per la porta '{{$port->getNs()}}#{$port->getName()}'");
 }
Exemple #2
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);
 }
Exemple #3
0
 /**
  * @return string
  */
 public function send($xml, Port $port, BindingOperation $bindingOperation)
 {
     $soapAction = $bindingOperation->getDomElement()->evaluate("string(soap:operation/@soapAction)", array("soap" => SoapClient::NS));
     if (!$soapAction) {
         $soapActionRequired = $bindingOperation->getDomElement()->evaluate("string(soap:operation/@soapActionRequired)", array("soap" => SoapClient::NS));
         if ($soapActionRequired == "true") {
             throw new TransportException("SoapAction required for operation '" . $bindingOperation->getName() . "'", 100);
         }
     }
     $url = $port->getDomElement()->evaluate("string(soap:address/@location)", array("soap" => SoapClient::NS));
     $request = new EntityEnclosingRequest("POST", $url);
     $request->setBody($xml, 'application/soap+xml; charset=utf-8;  action="' . $soapAction . '"');
     if ($this->debugUri) {
         $request->setUrl($this->debugUri);
     }
     $response = $this->client->send($request);
     if (!$response->isSuccessful()) {
         throw new TransportException($response->getReasonPhrase(), $response->getStatusCode());
     }
     return $response->getBody(true);
 }
Exemple #4
0
 public function __call($method, $params)
 {
     $bindingOperation = $this->binding->findOperation($this->port->getBinding(), $method, $params);
     return $this->binding->send($bindingOperation, $params, $this->headers);
 }