i got error when call webservice with nusoap - php

i used nusoap for calling a webservice like this:
<?php
require 'nusoap/lib/nusoap.php';
$client = new nusoap_client('http://webserviceSite.com/webservices/globalservices.asmx?wsdl', 'WSDL');
$error = $client->getError();
if ($error) {
die("client construction error: {$error}\n");
}
$answer = $client->call('GetCaptchaImage');
$error = $client->getError();
if ($error) {
print_r("res:".$client->response);
print("\n");
print_r("debug:".$client->getDebug());
die();
}
print_r($answer);
?>
but i got this error:
`"wsdl error: HTTP ERROR: Couldn't open socket connection to server http://webserviceSite.com/webservices/globalservices.asmx?wsdl prior to connect(). This is often a problem looking up the host name. "
plz help me.i cant understand this error

This error is exactly what it says: "Couldn't open socket connection to server". Prior SOAP communication client must be able to establish HTTP TCP connection (usually on port 80). This error means that your client is unable to make such connection. It may be caused by many factors: firewall between client and server, server don't like your client, web proxy on the way does not allow you to connect, no routing and so on.
From the box where you run your client you should be able to do:
telnet webserviceSite.com 80
and you should see something like:
Connected to webserviceSite.com.
Escape character is '^]'
Then if you type up few characters and hit enter you should get error page from remote server and connection should close. Unless you can get your client box to connect to remote http host reliably your soap call would fail.

Related

socket_write(): unable to write to socket [10053]

I'm using whatsapp api with laravel 5.2
https://github.com/mgp25/Chat-API
And i got this error when i trying to send new message
socket_write(): unable to write to socket [10053]: An established connection was aborted by the software in your host machine.
Send Controller
$massage = "Thanks for subscribe";
Whatsapi::send($massage, function ($send) {
$user = User::Find(1);
$send->to($user->phone);
}
While following this tutorial
I was getting the same error in phperror.log which I have configured in my php.ini. Initially I thought it was due to some firewall issue, but it wasn't.
The problem was, I was running the client first and then the server. Client was probably not able to make a connection with the server when it ran for the first time.
So I resolved it by running the server first and then the client, which can now make a successful web socket connection.
EDIT : This error also comes up when we simply reload the client page without properly terminating the previous connection.

PHP - Getting more info on failed stream_socket_accept() requests

I’ve got a PHP communications server running using stream_socket_server() and stream_socket_accept(), a fairly complicated thing which uses SSL connections and certificates to be certain that the remote side is authorized to connect to the server. One of the things which is coming up in my logs are the failed connections. I’m trying to provide more details on these connections for security purposes.
I’m currently getting most of my error detail on the failed connections by setting an error handler for the stream_socket_accept() call:
public function on_ssa_error($errno, $errstr)
{
$this->ssa_error .= " ERROR [$errno]: $errstr\n";
}
public function on_select_read()
{
$this->ssa_error = "";
set_error_handler(array($this, "on_ssa_error"));
$rsocket = stream_socket_accept($this->ss, 0);
restore_error_handler();
if ($rsocket !== FALSE)
// Finish setting up the socket connection and start using it
else
// Report the error in $this->ssa_error
}
…when I have a failed connection, I tend to get errors like this:
ERROR [2]: stream_socket_accept(): SSL operation failed with code 1. OpenSSL Error messages: error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate
ERROR [2]: stream_socket_accept(): Failed to enable crypto
ERROR [2]: stream_socket_accept(): accept failed: Success
…which is partly useful in that it identifies the cause of the bad connection as a bad certificate, but I’d really like to have something indicating where the bad request came from, ideally the IP address or Mac Address of the source.
Is there any way to get the IP address of a failed connection using the stream_socket_xxx code? I know it’s possible to get the IP address of an accepted connection, but I’m stumped trying to figure out a way of getting it on a failed connection.

ActiveMQ Remote Broker

I'm an ActiveMq - STOMP PHP- Beginner.
How can I connect to a remote Broker on STOMP, the Producer is in php.
If I connect to the broker on the same machine like this:
$stompCon = new Stomp('tcp://localhost:61613');
$stompCon->connect();
$stompCon->send('/queue/notifications.test', $mapMessage);
$stompCon->disconnect();
it connects ok, but when I try on an external server like:
$stompCon = new Stomp('tcp://181.61.50.8:61613',$user,$pass);
$stompCon->connect();
$stompCon->send('/queue/notifications.test', $mapMessage);
$stompCon->disconnect();
It doesn't connect. Does someone knows how I can connect to a remote broker on another machine?
Error messsage:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, webmaster and inform them of
the time the error occurred, and anything you might have done that may
have caused the error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.
Apache Server at Port 80

When the connection is done with ldap for PHP?

I'm trying to understand PHP's ldap function in order to debug an app.
The authentication flow is like following:
ldap_connect($host, $port);
ldap_set_option($ds, $option);
ldap_bind($ds, $rdn, $pwd);
ldap_search($smth);
ldap_get_entries($smtgelse);
ldap_close($ds);
The error I get is:
The gateway did not receive a timely response from the upstream server or application.
I suspect a firewall to block the response, but I put a logger to see which statment is blocking, it's the ldap_bind one's.
If it's a network issue it should block on the ldap_connect statment shouldn't it?
From the PHP documentation - http://php.net/ldap_connect:
When OpenLDAP 2.x.x is used, ldap_connect() will always return a resource as
it does not actually connect but just initializes the connecting parameters.
The actual connect happens with the next calls to ldap_* funcs, usually with
ldap_bind().

Couldn't open socket connection to server

I'm getting the following error message in a php-file when trying to connect to a third party server.
HTTP Error: Couldn't open socket connection to server http:// xxxxxxxx prior to connect(). This is often a problem looking up the
host name.
I know that the address is correct. What is the most common problem with this error? Could it be that the server only accept certain IP's to connect?

Categories