[Solved] Can not load WSDL file?
Posted: Tue Jul 10, 2007 3:55 am
feyd | Please use
Client.php[/syntax]
server.php
When I try to run this example I got followibng error:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/dotNet.wsdl' in C:\wamp\www\client.php:2 Stack trace: #0 C:\wamp\www\client.php(2): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in C:\wamp\www\client.php on line 2
Help me.
Thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
I am trying to run a simple example. I cant load WSDL file. Following is my code:
WSDL file
dotNet.wsdl
[syntax="xml"]
<?xml version="1.0"?>
<definitions name="NetPuzzle" targetNamespace="urn:NetPuzzle" xmlns:
typens="urn:NetPuzzle" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:
soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.
xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
</definitions>
<message name="getPuzzle">
<part name="difficulty" type="xsd:int" />
</message>
<message name="getPuzzleResponse">
<part name="return" type="string" />
</message>
<portType name="NetPuzzlePort">
<operation name="getPuzzle">
<input message="typens:getPuzzle" />
<output message="typens:getPuzzleResponse" />
</operation>
</portType>
<binding name="NetPuzzleBinding" type="typens:NetPuzzlePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getPuzzle">
<soap:operation soapAction="urn:NetPuzzleAction" />
<input>
<soap:body use="encoded" namespace="urn:NetPuzzle"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="urn:NetPuzzle"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="NetPuzzleService">
<port name="NetPuzzlePort" binding="typens:NetPuzzleBinding">
<soap:address location="http://localhost/server.php" />
</port>
</service>
Code: Select all
<?php
$soap = new SoapClient('http://localhost/dotNet.wsdl');
echo $soap->getPuzzle("1");
?>Code: Select all
<?php
function getPuzzle($difficulty) {
$puzzles[1][] = “What is the best web mag in the world?”;
$puzzles[2][] = “What is the air-speed velocity of an unladen swallow?”;
$puzzles[3][] = “What is the meaning of life?”;
$randpuz = array_rand($puzzles[$difficulty]);
return $puzzles[$difficulty][$randpuz];
}
$server = new SoapServer(“dotnet1.wsdl”);
$server->addFunction(“getPuzzle”);
$server->handle();
?>Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost/dotNet.wsdl' in C:\wamp\www\client.php:2 Stack trace: #0 C:\wamp\www\client.php(2): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in C:\wamp\www\client.php on line 2
Help me.
Thanks
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]