PHP SoapClient get gzip wsdl

Asked
Active3 hr before
Viewed126 times

9 Answers

90%

This may be a problem with the server. I tried setting request header Accept-Encoding using WGET and the server ignored it. But still, wget should be able to decipher gzipped files. – nolanpro Oct 12 '10 at 0:38 , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,My SoapClient cant open a gzipped wsdl file directly. Feel free to take a look at the WSDL your self, I think its public (https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl),Making statements based on opinion; back them up with references or personal experience.

I tried a bunch of settings like

$client = new SoapClient("https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl", array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));
load more v
88%

The Zend_Soap_Client class simplifies SOAP client development for PHP programmers. , The Zend_Soap_Client constructor takes two parameters: , Under the WSDL mode, the Zend_Soap_Client component uses a WSDL document to define transport layer options. , After we've created a Zend_Soap_Client object we are ready to perform SOAP requests.

'compression' - compression options; it's a combination of SOAP_COMPRESSION_ACCEPT, SOAP_COMPRESSION_GZIP and SOAP_COMPRESSION_DEFLATE options which may be used like this:

// Accept response compression
$client = new SoapClient("some.wsdl",
   array('compression' => SOAP_COMPRESSION_ACCEPT));
...

// Compress requests using gzip with compression level 5
$client = new SoapClient("some.wsdl",
   array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5));
...

// Compress requests using deflate compression
$client = new SoapClient("some.wsdl",
   array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_DEFLATE));
load more v
72%

Ce n'est pas la réponse que vous recherchez? Parcourir les autres questions marquées php soap wsdl gzip or posez votre propre question. ,Mon SoapClient ne peut pas ouvrir un fichier wsdl compressé directement. N'hésitez pas à jeter un œil au WSDL vous-même, je pense qu'il est public (https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl)

J'ai essayé un tas de paramètres comme

$client = new SoapClient("https://www.ad-juster.com/api_sandbox/api/dre-api.wsdl", array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));
load more v
65%

I have tried compressing it in GZIP by sending it the charset, but at the moment of executing it, it gives me this error. , The code in php for this consumption is the following: , For that reason it does not detect the encoding. , I have this problem when trying to consume a web service wsdl:

Encoding must go within quotes:

  'encoding' => utf - 8,
load more v
75%

[2006-02-04 12:03 UTC] adam at trachtenberg dot com
Description:
   -- -- -- -- -- --
SOAPClient compression seems broken.I see two problems.

First, the code places the Accept - Encoding and Content - Encoding HTTP headers before the POST / path HTTP / 1.1 line, which is invalid HTTP.This causes 400 errors.

I fixed this by moving the logic
for this section further down in the
function.See this patch
for more details:

   http: //www.trachtenberg.com/patches/soap_compression_patch.txt 

   It works
for me, but I did not verify this is a perfect fix.

Second, it seems impossible(or just not as documented) to trigger compression of out - going requests.I don 't understand how "level" can evaluate to > 0 given the SOAP_COMPRESSION_* constants.

Do you need to also pass a gzip compression level(0 - 9) as part of the compression bit field ? This is not part of the online documentation, which says you can do this:

      $client = new SoapClient("some.wsdl",
         array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP));

   This evaluates to 0x20.Inside php_http.c in the make_http_soap_request
function, it then does:

   if (zend_hash_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression"), (void ** ) & tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) {
      int level = Z_LVAL_PP(tmp) & 0x0f;

      ...

      if (level > 0) {

         0x20 & 0x0f evaluates to 0, so you never execute the last branch, and no compression is used.

         Furthermore, since level seems to be passed into the compression functions as the gzip level, I don 't know how that relates to the bit field.

         I tries to verify this using the unit tests, but there are none
         for SOAPClient and compression.
load more v
40%

SoapClient::__getLastResponseHeaders — Returns the SOAP headers from the last response,SoapClient::__setLocation — Sets the location of the Web service to use,SoapClient::__getLastRequestHeaders — Returns the SOAP headers from the last request, The SoapClient class provides a client for » SOAP 1.1, » SOAP 1.2 servers. It can be used in WSDL or non-WSDL mode.

load more v
22%

By default, the SOAP request is accepted un-compressed and the result of the request is returned un-compressed.,Release version Table of Contents Now Platform App Engine ,We were unable to find "Coaching" in Jakarta. Would you like to search instead?,More Sites Now Community Developer Site Knowledge Base Product Information ServiceNow.com Training Customer Success Center ServiceNow Support Videos

Content - Encoding: gzip
load more v
60%

SoapUI determines this column value automatically when you add a file to the Attachments tab. If needed, you can enter any other value later.,When you are adding a file to the Attachments tab, SoapUI asks you if you want to cache the file or not:,To update the file in this cache, select it in the Attachments tab and click  on the toolbar:,By default, matches the attachment file name. You can change this id in this column, if needed.

You can specify property expansions in this column.

The file name can be absolute or relative. In the latter case, the file path is relative to the ResourceRoot property of your project.

ResourceRoot
load more v
48%

Is there a way to compress the request via the proxy call (wsdl)?,Is there a way the compression can be done through the app.config?,Is there something I am missing in order to properly compress the HttpWebRequest?,I think I was able to solve the compression error message by adding the following to the HttpWebRequest method:

Method to create the HttpWebRequest:

private static HttpWebRequest CreateWebRequest(SoapAction action) {
   string url = GetUrlAddress(action);

   HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);

   request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
   request.Headers.Add("SOAPAction", action.ToString());
   request.ContentType = "application/xop+xml";
   request.Accept = "text/xml";
   request.Method = "POST";

   request.ClientCertificates.Add( /* Retrieve X509Certificate Object*/ );

   return request;
}

Code to Send Request:

using(Stream stream = request.GetRequestStream()) {
   soapXml.Save(stream);
}

Code to retrieve the Response:
This is how I am retrieving the error message that is occurring

try {
   using(HttpWebResponse response = (HttpWebResponse) request.GetResponse()) {
      using(StreamReader reader = new StreamReader(response, Encoding.Default)) {
         File.AppendAllText(filePath, response.Headers.ToString());
         File.AppendAllText(filePath, reader.ReadToEnd());
      }
   }
} catch (WebException ex) {
   using(var stream = ex.Response.GetResponseStream()) {
      using(var reader = new StreamReader(stream)) {
         Console.WriteLine(reader.ReadToEnd());
      }
   }
}
load more v

Other "undefined-undefined" queries related to "PHP SoapClient get gzip wsdl"