[HTTP] Could not connect to host
[email protected] ("Chris Suter")
| Newsgroups | php.soap |
|---|---|
| Message-ID | <[email protected]> |
I have been working with PHP soap for a few weeks now, with a great
deal of success. I am using Apache Axis v1.4, set up as an endpoint on
Mule v1.4.1 ( http://mule.codehaus.org ), which in turn is running as
a service on JBoss AS v4.2.0.
When testing with everything on localhost, I had no problems using the
SoapClient object for a number of services that were exposed via Axis
and Mule. However, when deployed to the live box, I get a connection
error (see subject of this email). The error in more detail is as
follows:
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect
to host in /var/www/myproject/login.php:19
Stack trace:
#0 [internal function]: SoapClient->__doRequest(<?xml version="...',
'http://localhos...', '', 1, 0)
#1 [internal function]: SoapClient->__call('login', Array)
#2 /var/www/myproject/login.php(19): SoapClient->login(Array)
#3 /var/www/myproject/login.php(4): doLogin('dummy', 'dummy')
#4 {main} thrown in /var/www/myproject/login.php on line 19
My php code is as follows (the LoginRequest object is just a simple
wrapper class which contains only the fields which I set on it in this
code; it is the reason for the include on line 2):
1 <?php
2 include 'myproject.php';
3
4 doLogin('dummy','dummy');
5
6
7 function doLogin($username, $password)
8 {
9 $client = new
SoapClient("http://myserverIP:8090/actions/AuthenticationUMO?wsdl");
10
11 $request = new LoginRequest();
12
13 $request->username = $username;
14 $request->password = $password;
15 $request->messagetype = "LOGIN";
16
17 $loginRequest = array("in0" => $request);
18
19 $response = $client->login($loginRequest)->loginReturn;
20
21 print (debug_backtrace());
22
23 if ($response->ack == 'LOGGED_IN')
24 {
25 print("login successful<BR>");
26 }
27 else
28 {
29 print("login failed...<BR>");
30 }
31 }
32
33 ?>
The wsdl file corresponding to this service is definitely accessible
(so the SoapClient is not failing to find the wsdl) and if I call
$client->__getFunctions(), it prints out the expected info. I will
spare the details of the actual wsdl file, unless absolutely
necessary.
I am new to pretty much all of these technologies, but have been
working with Mule and Axis for a couple of months now. Please note, I
am NOT a php programmer, I'm just testing my backend code before I
send an API to our frontend developers. This code is just for testing.
I imagine that the problem is something pretty simple, but I have no
clue what it could be. There didn't seem to be anything similar to
this in the mailing list, which tells me that I'm probably making a
stupid error. But any guidance will be hugely appreciated. Thanks in
advance for your time.
--
Christopher Suter
Software Engineer
Escape Media Group
Gainesville, FL