Jump to content

SOAP/WSDL issue with SoapClient


maxxd

Recommended Posts

Hi y'all. I've been looking at this for two days now and my head is starting to hurt from it.

 

I'm trying to integrate with an existing web service for client log-in and having trouble getting it done and Google is being very little help at this point. Here's the code, annotated where necessary:

namespace myNamespace;

MyClass{
        private	$_apiLoginAddr = 'http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx?wsdl';

	public function logIn($email,$id){
/*
// these work...
		$testClient = new \SoapClient('http://www.webservicex.com/CurrencyConvertor.asmx?wsdl',array('trace'=>1,'exceptions'=>1));
		$resp = $testClient->ConversionRate(array('FromCurrency'=>'USD','ToCurrency'=>'CAD'));
		print($resp->ConversionRateResult);

		$testClientAWS = new \SoapClient('http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl',array('trace'=>1,'exceptions'=>1));
		$resp = $testClientAWS->ItemLookup(array('ItemID'=>'1430260319'));
 		var_dump($resp);

		$testClientP = new \SoapClient('https://pilot.prove-uru.co.uk/URUws/uru10a.asmx?wsdl',array('trace'=>1,'execptions'=>1));
		print_r($testClientP->__getFunctions());
		die();
*/
// turning off caching because apparently it's sometimes an issue...
		ini_set('soap.wsdl_cache_enbled','0');
		ini_set('soap.wsdl_cache_ttl','0');

// this doesn't work even a little bit...
		try{
			$creds = array(
				'trace'		=>	1,
				'exceptions'	=>	1,
				'cache_wsdl'	=>	'WSDL_CACHE_NONE',
				'soap_version'	=>	SOAP_1_1,
			);
			$client = new \SoapClient($this->_apiLoginAddr,$creds);
			$results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email));

			var_dump($client->__getLastRequest());
			print('break');
			var_dump($client->__getLastResponse());

		}catch(\SoapFault $e){
			print('Exception thrown!');
			var_dump($e);
			die();
		}
		print('Succesfully completed call!');
		var_dump($results);
		die();
	}
}

Using this code, the browser churns for about a minute before I get the error "SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx' : failed to load external entity "http://xxx.xxx.xxx.xxx:xxxx/ServiceAddress/Login.asmx", with or without the call to WebsiteLogin(). Now, I've also tried a non-wsdl version where I replaced the credentials array and SoapClient instantiation with the following:

try{
	$creds = array(
		'trace'		=>	1,
		'exceptions'	=>	1,
		'cache_wsdl'	=>	'WSDL_CACHE_NONE',
		'location'	=>	$this->_apiLoginAddr,
		'uri'		=>	'http://tempuri.org',
		'soap_version'	=>	SOAP_1_1,
	);
	$client = new \SoapClient(null,$creds);
        $results = $client->WebsiteLogin(array('_Password'=>$id,'_UserName'=>$email));
/* see previous code block */

Using this approach, my browser again churns for about a minute before I get the error "Could not connect to host". If I don't actually try to log in using the service's WebsiteLogin() function, SoapClient doesn't throw an error on this one and reports a successfully completed call. Which does me no good at all, because my users can't log in if I don't call the WebsiteLogin() function.

 

I can visit the end-point directly in my browser and it's definitely there and active, and SoapUI has no problem at all with the request or the response. I've tried uncommenting the open_ssl.dll in my php.ini, turning the wsdl caching options off in the php.ini directly, and pretty much everything short of ritual sacrifice to no avail.

 

My log in form is sending the credentials via AJAX to the logIn() method above, and all this is happening in a WordPress site. However, as the webservicex, webservices.amazon.com, and pilot.prove-uru.co.uk soap calls all complete successfully, I don't think that's an issue. I've spoken with the maintainer of the service gateway and he swears we're not blacklisted through the firewall, but nothing is working.

 

Anybody come across anything similar? Or have better Google skills that can actually find an applicable answer? Or have any ideas at all? 'Cause I'm at a loss...

Link to comment
Share on other sites

Update on this - it's still not working.

 

I created another call using the NuSoap library just to see if it was a SoapClient issue, but nusoap_client() is also timing out when attempting to connect to the end point, even if I explicitly tell the NuSoap client object to use cUrl. Another thought that I had is that my client script is being executed on a BlueHost shared server - is it possible that BH is blocking the outgoing call to the end point? Or any call that goes out to a non-standard port number?

 

I tried upping my timeout to 4 minutes using

ini_set('default_socket_timeout',240);
set_time_limit(240);
ini_set('max_execution_time',240);

but got no love that way, either...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.