I am making a web service for the first time. Im getting this exception
SoapFault exception: [HTTP] Unable to parse URL in C:\wamp\www\Assignment 8\client.php:22 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('getUserData', Array) #2 C:\wamp\www\Assignment 8\client.php(22): SoapClient->getUserData('1') #3 {main}
I google the exception too but did'nt solve it yet
This is my WSDL file code
='1.0'='UTF-8'
<wsdl:definitions name="UserInfo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="UserInfo" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="UserInfo" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
<wsdl:message name="userDataRequest">
<wsdl:part name="id" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:message name="userDataResponse">
<wsdl:part name="firstName" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:portType name="UserInfo">
<wsdl:operation name="getUserData">
<wsdl:input message="tns:userDataRequest"/>
<wsdl:output message="tns:userDataResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserInfo" type="tns:UserInfo">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getUserData">
<soap:operation soapAction="server.php" />
<wsdl:input>
<soap:body use="literal" namespace="UserInfo" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" namespace="UserInfo" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UserInfo">
<wsdl:port binding="tns:UserInfo" name="YUserInfo">
<soap:address location="server.php" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
This is client.php file code
= new= 1,
"exceptions" => 0));
print($client->getUserData("1"));
print "<pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";
?>
and this is server.php code
function getUserData($id)
{
$array = array('firstName'=>'ASma');
return $array;
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("assign8.wsdl");
$server->addFunction("getUserData");
$server->handle();
?>