I'm trying to get working WSO2 ESB 4.7.0 with PHP 5.4.9 SoapClient.
I've got a problem when I use SoapClient in WSDL mode with ESB echo service, that connection from ESB is not closed after sending WSDL. I'm able to reproduce this problem also with telnet as client.
$ telnet localhost 8280
HTTP 1.0 request:
GET /services/echo?wsdl HTTP/1.0
HTTP 1.0 response:
HTTP/1.0 200 OK
Content-Type: text/xml
Date: Mon, 29 Jul 2013 07:37:20 GMT
Connection: Close
And after response connection stays open (as would stay with "Connection: keep-alive" header).
Is this a bug or problem in configuration? Is anybody experiencing the same problem?
I think I have a similar issue. My LB is querying Version service but after a while the ESB stops responding and a bunch of connection timeouts are visible in the logs. I think the ESB is not releasing its connections. Must be some configuration option to specify to close connection or timeout after a period.
Related
I have come across this header for the first time and not sure what it does or mean. I have searched around and couldn't find what I was looking for.
I am trying to consume a SOAP API using PHP SoapClient class and it's returning an empty response and these response headers. Also, no exception is thrown.
HTTP/1.1 200 OK
X-Backside-Transport: FAIL FAIL,FAIL FAIL
Connection: close
Transfer-Encoding: chunked
Content-Type: text/xml
Date: Tue, 21 Jun 2016 20:09:50 GMT
X-Client-IP: xx.xxx.xxx.xxx
Any help is appreciated.
It seems that the web service you're trying to communicate is behind the xml firewall (probably IBM DataPower, it does send X-Backside-Transport header on failere) and blocks the error response (aka. fault message). This is the default behaviour for the xml firewalls. Root cause can be malformed soap message (i.e.: wrong data type) or an server site exception.
In order to solve the problem, you should contact with the web service owner.
I've seen this in the past when communicating with IBM Backends, in my experience it has also been joined with a HTTP 401 Unauthorised.
The reason for the error on my side was because of duplicate headers (e.g. sending the same head twice...)
Hope this helps.
I am using a DocuSign API and have run into some issues.
When sending the data request to their server I am getting the following error:
SoapFault exception: [q0:InvalidSecurity] An error was discovered
processing the <Security> header ---> WSE065: Creation time of the
timestamp is in the future. This typically indicates lack of synchronization
between sender and receiver clocks. Make sure the clocks are synchronized
or use the timeToleranceInSeconds element in the microsoft.web.services3
configuration section to adjust tolerance for lack of clock synchronization.
I have looked all over their community forums and the only response I can find from their forum admin is this:
The message means that the client clock is wrong. The timezone might be set
incorrectly. If the SOAP request is timestamped too far in the future or in the
past, the server will reject it. We generally run into this error with mobile
apps since folks don't always have their devices set to sync to network time.
I checked my server time as well as my computer time to make sure everything is fine. My computer time is set to EST, and the server is set to CST. I have tried updated and synchronized my system clock on my computer as well as trying to adjust my timezone to CST to make sure they both match. I have also changed my computer time to GMT because that is what they say their server time is. I have also tried updating my server's clock since it seems to be the one that is a little bit off. (there seems to be like a 6 minute difference between my clock and the server clock).
I ran this command on the server:
sudo ntpdate ntp.ubuntu.com
Response:
27 Sep 08:51:41 ntpdate[18858]: step time server 91.189.94.4 offset -357.639332 sec
I also tried editing my grub configuration file on the server (/boot/grub/grub.conf). I tried adding different combinations of these params to the end of the kernel line:
clock=pit
acpi=off
noapic
As well as trying to update the hardware clock with this command:
hwclock=systohc
The soap headers are as follows:
This request was sent out at 10:41AM(my computer time [EST]), 9:47AM (my server time [CST]).
Request:
POST /api/3.0/api.asmx HTTP/1.1
Host: www.docusign.net
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.3.16
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.docusign.net/API/3.0/CreateEnvelope"
Content-Length: 116157
Response:
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 1696
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 27 Sep 2012 14:41:13 GMT
Vary: Accept-Encoding
Strict-Transport-Security: max-age=7776000; includeSubDomains
If anyone has any thoughts as to what might be causing this error, or if anyone has any further advice on how to go about synchronizing my clocks, I would love to hear them.
Thanks in advance for your time and consideration.
I ended up contacting the company I am hosting my virtual server with and as it turns out it wasn't an issue with anything I have control over at all. It turned out that their hypervisor (virtual machine monitor - VMM) was having issues so when my server was synchronizing its time from it, my time was getting offset by about 7 minutes. Since the system clock of my server was being controlled by it, this also disallowed me from being able to set the time manually with this command:
date -s "27 SEP 2012 HH:MM:SS"
since the changes would just be superseded by the VMM.
I have an app which connects to my web server and transfers data via XML.
The headers I connect with are:
POST /app/API/Data/Receiver.php HTTP/1.1
User-Agent: Custom User Agent 1.0.0
Accept: text/xml
Content-Type: text/xml
Content-Length: 1580
Host: servername.com
The app then handles the data and returns its own XML formatted reply. One of the header's I'm setting in the response is:
header("Connection: close");
When I send connect and send my data from a simple app on my PC (C++) it works fine, I get the close header correctly and the connection is closed as soon as the data is available. When I send the exact same data using a GSM modem and and embedded app, the connection header comes back as:
header("Connection: keep-alive");
The GSM modem also sits and waits until the connection is closed before moving on and often just times out.
Is there someway to close the connection on the server so that the GSM side does not time out?
It is possible that your GSM service provider transparently proxing connections. Try to send data on non-standard port (i.e not 80, 8080, 443)
Also setting cache control header private might work.
Cache-Control: PRIVATE
Headers are just plain text but cannot be sent once data has been sent in PHP. Try this:
echo "\r\n\r\nConnection: close";
die();
and adjust to your needs
I'm accessing a remote SOAP Service that tends to be reacting very slow from time to time (we're talking about more than 10 seconds here).
System is PHP Version 5.3.1, running on Windows Server 2003.
My client is set up like this:
new SoapClient($wsdl, array("trace" => true, "exceptions" => true, "cache_wsdl" => WSDL_CACHE_BOTH, "connection_timeout"=>5000));
Now when I'm shooting a request that takes more than about 10 seconds, the following happens: I get the late but correct response from the service, together with a 200 header (taken from SoapClient::__getLastResponse)
Response Headers:
HTTP/1.1 200 OK Via: 1.1 XXX Connection: Keep-Alive Proxy-Connection: Keep-Alive Content-Length: 430 Date: Mon, 10 Oct 2011 16:03:15 GMT Content-Type: text/xml;charset=UTF-8 Server: Microsoft-IIS/7.5 X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1 X-Powered-By: ASP.NET
But as the SOAP result, I get a SoapFault:
fault:
code: 500
message: An internal error occurred. Please contact our support.
I've tried preventing this with:
ini_set('default_socket_timeout', 5000 );
and setting up the SoapClient with "connection_timeout"=>5000 as seen above. Nothing helps. Any suggestions would be heavily appreciated.
Just had the same problem while accessing a Web Service in SAP and it was not a PHP Bug but a timeout setting in the SAP Web Dispatcher.
I was fighting this for many hours trying to figure out what was wrong with PHP or the SOAP Module.
Finally, I tested in SOAP-UI and the problem was solved quickly. You should do the same with SOAP-UI. Perhaps the Webservice you are calling is depending on another remote connection that has its own timeout settings.
The HTTP/1.1 RFC stipulates "The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response." I know Apache honors the RFC but modules don't have to. My question is, does mod_php5 honor this?
The reason I ask is because I just came across an article saying that PHP developers should check this themselves with:
if (stripos($_SERVER['REQUEST_METHOD'], 'HEAD') !== FALSE) {
exit();
}
I googled a second and not much turned up, other than some people saying they try to strange things like mod_rewrite/redirect after getting HEAD requests and some old bug ticket from like 2002 claiming that mod_php still executed the rest of the script by default. So I just ran a quick test by using PECL::HTTP to run
http_head('http://mysite.com/test-head-request.php');
while having:
<?php error_log('REST OF SCRIPT STILL RAN'); ?>
in test-head-request.php to see if the rest of the script still executed, and it didn't.
I figure that should be enough to settle it, but want to get more feedback and maybe help clear up confusion for anyone else who has wondered about this. So if anyone knows off the top of their head (no pun intended) - or have any conventions they use for receiving HEAD requests, that'd be great. Otherwise, I'll grep the C source later and respond in a comment with my findings. Thanks.
The HEAD method is identical to GET
except that the server MUST NOT return
a message-body in the response.
That is why the check should not be performed. Clients should have confidence that HEAD requests process just the same as if a GET was issued (database connection, processing, etc...).
Addendum:
When performing
HEAD /test.php?a=3 HTTP/1.1
Host: somesite.com
PHP will still fill $_GET (and $_REQUEST) with the variables placed in the query string even though it was not a GET request. This allows compliance with the HEAD definition.
I just did a quick test with a PHP file, temp.php, which contains this portion of code :
<?php
echo "Hello, World!\n";
die;
Sending an HTTP GET request to that file gets me the content of the page :
$ telnet localhost 80
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /temp/temp.php HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Date: Thu, 08 Apr 2010 20:17:35 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.3.2RC2
Vary: Accept-Encoding
Content-Length: 14
Content-Type: text/html
Hello, World!
While sending an HTTP HEAD request doesn't :
$ telnet localhost 80
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD /temp/temp.php HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Date: Thu, 08 Apr 2010 20:17:50 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.3.2RC2
Vary: Accept-Encoding
Content-Type: text/html
Not sure this is always true, though...
I remember a situation (some time ago ; was PHP 5.1) in which I've had to test myself, in the PHP code, if I was getting a GET or a HEAD request.
EDIT : After an additionnal test
I just did another test : my temp.php file now contains this :
<?php
file_put_contents('/tmp/a.txt', $_SERVER['REQUEST_METHOD'], FILE_APPEND);
var_dump($_SERVER['REQUEST_METHOD']);
die;
Sending an HTTP HEAD request, I get this :
$ telnet localhost 80
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD /temp/temp.php HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Date: Thu, 08 Apr 2010 20:21:30 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.3.2RC2
Vary: Accept-Encoding
Content-Type: text/html
Connection closed by foreign host.
Here, no output.
BUT, looking at the /tmp/a.txt file :
$ cat /tmp/a.txt
HEAD
So : no output sent by the server doesn't mean that there is nothing done ;-)