开发者

Soap SOAP_COMPRESSION_GZIP verfication if it works

Using php5 and I'm making soap requests to a webservice based on a wsdl that doesn't use the Header element.

Everything, I've been asked now to use gzip compression on my soap requests.

So my client now looks like this:

$client = new SoapClient('xxxxx.wsdl', 
                         array('compression'=> 
                                     SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 
                           开发者_开发问答     'trace' => 1, )
                          ); 

I've googled a bit and I found sites saying I should also add the gzip compression level (add | 9) after SOAP_COMPRESSION_GZIP, but when I do that I get a soap fault back

"Content is not allowed in prolog"

So I dropped the pipe 9)

Question: Ss I´m no expert in soap, with above notation I don't get any errors on the outbound xml request nor on the return request. How do I know if my gzip compression is working and if so is being acknowledged on the other side?


You can check SoapClient::__getLastRequestHeaders and check the content-encoding and content-length headers. If the Request is compressed the Content-Length value should be smaller than the payload size

If the web service is not on HTTPS you can also run a packet sniffer like WireShark and capture the request and see exactly what was transfered.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜