Click here to Skip to main content
12,956,173 members (63,157 online)
Rate this:
 
Please Sign up or sign in to vote.
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="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

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

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
OriginalGriff 6,869
CHill60 3,550
Maciej Los 3,243
ppolymorphe 2,070
Jochen Arndt 1,973


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2017
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