Click here to Skip to main content
11,924,280 members (54,081 online)
Rate this:
Please Sign up or sign in to vote.
See more: PHP SOAP WebService WSDL
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

<?xml version='1.0' encoding='UTF-8'?>
<wsdl:definitions name="UserInfo" xmlns:xsd="" targetNamespace="UserInfo" xmlns:soap="" xmlns:tns="UserInfo" xmlns:wsdl=""  >
  <wsdl:message name="userDataRequest">
   <wsdl:part name="id" type="xsd:string"></wsdl:part>
  <wsdl:message name="userDataResponse">
   <wsdl:part name="firstName" type="xsd:string"></wsdl:part>
  <wsdl:portType name="UserInfo">
    <wsdl:operation name="getUserData">
      <wsdl:input message="tns:userDataRequest"/>
      <wsdl:output message="tns:userDataResponse"/>
  <wsdl:binding name="UserInfo" type="tns:UserInfo">
   <soap:binding style="rpc" transport="" />
   <wsdl:operation name="getUserData">
    <soap:operation soapAction="server.php" />
     <soap:body use="literal" namespace="UserInfo" />
     <soap:body use="literal" namespace="UserInfo" />
  <wsdl:service name="UserInfo">
    <wsdl:port binding="tns:UserInfo" name="YUserInfo">
      <soap:address location="server.php" />

This is client.php file code

   ini_set("soap.wsdl_cache_enabled", "0");
   $client = new SoapClient("assign8.wsdl",array(
    "trace"      => 1,
    "exceptions" => 0));
     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");
Posted 3-Feb-13 1:24am
Edited 3-Feb-13 1:40am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.3 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100