[RESOLVED] Java web service from a php client
Dear who ever reads this
I have a Java web service using JAX-B. Recently I've been trying to use php to write a client side for this service. Everything has been working good, Php is still as cool as I've left it. I just have a small problem I don't know if it's me or php5.3.
One of my Java web methods returns an array of integers. php gets the response as hashtable - using $client->__getTypes() - which is good. but if I tried to var_dump items in the hashtable I get:
Quote:
object(stdClass)#3 (0) { }
object(stdClass)#4 (0) { }
object(stdClass)#5 (0) { }
object(stdClass)#6 (0) { }
object(stdClass)#7 (0) { }
object(stdClass)#8 (0) { }
object(stdClass)#9 (0) { }
where it should be [29, 32, 36, 37, 38, 39, 66]
Any ideas?
Re: Java web service from a php client
Re: Java web service from a php client
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
$wsdl_url = 'http://localhost/app/myservice?wsdl';
$client = new SoapClient($wsdl_url);
echo '<p>';
var_dump($client->__getTypes());
echo '</p>';
$params = array(
'username' => 'test-user',
'passwordMD5' => md5("asdasd")
);
$ret = $client->listProjects($params)->return;
echo '<b>Result:</b><br />';
var_dump($ret);
echo '<br /><b>Values</b><br />';
foreach ($ret as $x) {
var_dump($x);
echo '<br />';
}
?>
</body>
</html>
PHP version: PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23 2009 14:35:05)
Apache Version: Server version: Apache/2.2.11 (Ubuntu)
Ubuntu Version: Linux my-desktop 2.6.28-14-generic #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009 i686 GNU/Linux
Re: Java web service from a php client
Never mind this problem I was able to solve it. If anyone faces this.
I'm using Netbeans as my Java IDE. For some reason netbeans decided to change the generated wsdl file name. but not the url assigned to it (thats how servlets work).
Anyway I just deleted the original wsdl file (and it's xsd) found in: '$ProjectName\web\WEB-INF\wsdl\$HostName_$Port\$WebServiceName$' and rebuilt the project. And now it works. Not a php problem after all :)