I developed a java web service(JAX-WS).
When I test the web service in browser, it is returning the values as required. (return value is a String array with 2 elements in it).
Then I try called this method(named getMoreFriends) of web service from php. It returns an error. Not sure what’s going on?
Can anyone help me in this?
This is how my exact code:
<?php
require_once(‘nusoap.php’);
$zip = "95112";
$param = array('zipcode' => $zip);
$wsdl = "htp://localhost:8080/LocationWsApplication/moreFriendsService?WSDL";
// $mynamespace = "htp://phonedirlux.homeip.net/types"; no more need of this...
$client = new soapclient($wsdl, true);
$err = $client->getError();
if ($err) {
echo 'Constructor error' . $err;
}
$response = $client->call('getMoreFriends', $param);
$err = $client->getError();
if ($err) {
echo 'Error in fetching data' . $err;
}
foreach($response as $friend)
echo $friend." ";
Is is not printing any error… I think, $err variable value is null…
So it displays just the error message text “Error in fetching data”…
One thing you would like to notice:
When I try ti print the values of the array elements, it shows “S:Client: Cannot find dispatch method for {}getMoreFriends”. Here getMoreFriends is the name of the method I am calling…
There doesn’t really seem to be anything wrong with your client code, so is there a possibility that there is something wrong with the web service?
Have you tested the web service in any other way? Maybe with a java client?
The issue was I was not including namespace.
I copied the namespace from wsdl file… passed this namespace as third argument to call() method. working fine now… hats off to me…