PHP Soap not loading WSDL from remote server

I'm trying to access the following SOAP service on a different server (animplant.com):

http://www.animplant.com:8080/rmb/rmbService?wsdl

using the following php code on my server:

$client = new SoapClient('http://www.animplant.com:8080/rmb/rmbService?wsdl');

however, I keep getting the following error:

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.animplant.com:8080/rmb/rmbService?wsdl' : Start tag expected, '<' not found

The strange thing is that I can load the xml in a browser fine. And even stranger, when I copy the xml file to the same server as the php code, php can process it.

Any ideas what the problem is?

Thanks
hbizAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zappafan2k2Commented:
Hmm, on my server, this
<?php
$client = new SoapClient('http://www.animplant.com:8080/rmb/rmbService?wsdl');
print_r($client->__getFunctions());

Open in new window

produced this:
Array
(
    [0] => getResultResponse getResult(getResult $parameters)
    [1] => addTrainingDataResponse addTrainingData(addTrainingData $parameters)
    [2] => getTrainingDataResponse getTrainingData(getTrainingData $parameters)
)

Open in new window


Is there anything else in your server logs?  Have you tried
ini_set('error_reporting', E_ALL);

Open in new window

to see if there's a better explanation for what's going on?
0
hbizAuthor Commented:
I tried adding that ini_set() and I still the get the same SOAP error:

500 | Internal Server Error | SoapFault
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.animplant.com:8080/rmb/rmbService?wsdl' : Start tag expected, '<' not found


I have no clue what's going on. I can't get past the constructor for SoapClient
0
hbizAuthor Commented:
I've also tried setting up a new account on a free hosting site (000webhost) and ran your php code and got the same error:

http://jumpstarmedia.host22.com/test.php

code:

<?php
ini_set('error_reporting', E_ALL);

$client = new SoapClient('http://www.animplant.com:8080/rmb/rmbService?wsdl');
print_r($client->__getFunctions());
?>
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Ray PaseurCommented:
Some of my colleagues say that SOAP is the devil.  I do not go quite that far, but I know that the internet is littered with the dessicated rotting husks of failed SOAP projects.  In contrast, I have never seen a RESTful interface that you could not understand and use immediately with great success.  So my recommendation is to contact the web service provider and ask if they have a REST interface that you can use, instead of the SOAP interface.  You can learn more (than you ever need to know) about REST interfaces here.  
http://en.wikipedia.org/wiki/Representational_state_transfer

A good example of a RESTful web service is the Yahoo Geocoder.  Look it up to see how easy it can be to use REST.  I do not even have SOAP in my PHP installation, that's how little I think of it!

If you want to see what "animplant" is giving you back, you can look at this.
http://www.laprbass.com/RAY_temp_hbiz.php
<?php // RAY_temp_hbiz.php
error_reporting(E_ALL);
echo "<pre>";

$xml = file_get_contents('http://www.animplant.com:8080/rmb/rmbService?wsdl');
echo htmlentities($xml);

Open in new window

0
hbizAuthor Commented:
Thanks for the help everyone. I managed to get the service provider to switch to port 80 and PHP was able to process the wsdl url.

My next problem is that I'm unable to use one of the functions (getResult)

Using this testing page as an example:

http://www.animplant.com/rmb/rmbService?Tester

I'm sending the following request:

$net = new SoapClient("http://www.animplant.com/rmb/rmbService?wsdl");
print_r($net->getResult('10',0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2))

however, I get a java null exception.

I figured that was a bug on their end, however, when I put those values in the testing page, it works correctly.

Am I formatting my request parameters incorrectly?

Thanks
0
zappafan2k2Commented:
Have you tried putting the arguments into an array and using the __soapcall function?
http://us2.php.net/manual/en/soapclient.soapcall.php
0
hbizAuthor Commented:
unfortunately that yields the same results:

print_r($net->__soapCall('getResult', array('10',0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2)));



500 | Internal Server Error | SoapFault
java.lang.NullPointerException

0
Rose BabuSenior Team ManagerCommented:
Hi,

have a look on the  below php soap client sample code.

it returns the response. (addTrainingData returns empty response data and getResult returns some response data)

<?php
ini_set('error_reporting', E_ALL);

$client = new SoapClient('http://www.animplant.com:8080/rmb/rmbService?wsdl');

// Call addTrainingData
echo "<u>addTrainingData Response</u><br /><br />";
$arrParameters = array('network' => '10', 'x1' => '0.2', 'y1' => '0.2', 'x2' => '0.2', 'y2' => '0.2', 'x3' => '0.2', 'y3' => '0.2', 'x4' => '0.2', 'y4' => '0.2', 'x5' => '0.2', 'y5' => '0.2', 'x6' => '0.2', 'y6' => '0.2', 'x7' => '0.2', 'y7' => '0.2', 'x8' => '0.2', 'y8' => '0.2', 'x9' => '0.2', 'y9' => '0.2', 'x10' => '0.2', 'y10' => '0.2', 'x11' => '0.2', 'y11' => '0.2', 'x12' => '0.2', 'y12' => '0.2', 'x13' => '0.2', 'y13' => '0.2', 'x14' => '0.2', 'y14' => '0.2', 'target' => '0.2');
$response = $client->addTrainingData($arrParameters);

print_r($response); // $response -> addTrainingDataResponse);

echo "<br /><br /><br />";

// Call getResult
echo "<u>getResult Response</u> <br /><br />";
$arrParameters = array('network' => '10', 'x1' => '0.2', 'y1' => '0.2', 'x2' => '0.2', 'y2' => '0.2', 'x3' => '0.2', 'y3' => '0.2', 'x4' => '0.2', 'y4' => '0.2', 'x5' => '0.2', 'y5' => '0.2', 'x6' => '0.2', 'y6' => '0.2', 'x7' => '0.2', 'y7' => '0.2', 'x8' => '0.2', 'y8' => '0.2', 'x9' => '0.2', 'y9' => '0.2', 'x10' => '0.2', 'y10' => '0.2', 'x11' => '0.2', 'y11' => '0.2', 'x12' => '0.2', 'y12' => '0.2', 'x13' => '0.2', 'y13' => '0.2', 'x14' => '0.2', 'y14' => '0.2');
$response = $client->getResult($arrParameters);

print_r($response); // $response -> getResultResponse);
?>

Open in new window

hope this may help you...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.