简体   繁体   中英

How to get http request headers used by SoapClient?

I want to check my http headers that are sent via a SoapClient .

Yet it only offers quick functions to fetch the Soap headers:

/**
 * Returns the SOAP headers from the last request
 * @link http://php.net/manual/en/soapclient.getlastrequestheaders.php
 * @return string The last SOAP request headers.
 * @since 5.0.1
 */
public function __getLastRequestHeaders () {}

I am not interested in those.

How can I find out what http headers have been used for the request on the HTTP level?

Xdebug loses context at the _call and the client doesn't seem able to to fetch that information by itself.

How to proceed?

I ended up using Wireshark. I configured my SoapClient to just post against my local IP, for me that was 10.49.57.28.

I captured the any interface.

First I had to enable the protocols via: Ctrl + Shift + E. I selected "Enable All".

I used the filter:

http.request.method == "POST" and ip.addr == 10.49.57.28

I right clicked the relevant request and used:

Follow > TCP Stream

And there I had all the relevant request information:

POST / HTTP/1.1
Host: 10.49.57.28
Accept: */*
Accept-Encoding: deflate, gzip
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
Content-Length: 2085
Expect: 100-continue

HTTP/1.1 100 Continue

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope ...

Of course, the response will be an error, yet I wasn't interested in that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM