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 all, im new to PEAR SOAP, and am having a few teething troubles. I have searched the web high and low, and still i have a problem. If anyone could spare a few mins.......
My overall soap is working, i can retrieve the wsdl details from the server script created, and i can get the wsdl link up (getDisco())........when i try to invoke the quoteservice method, i receive an object error(unhandled soap fault error). I am sure it is just slight syntax, can anyone see where i might be going wrong?
heres my code:
client1.php--------Code: Select all
<?php
include("SOAP/Client.php");
$wsdl = new Soap_WSDL("stockquote.wsdl");
$client = $wsdl->getProxy();
echo "<pre>\n";
print($client->getQuote("ibm"));
echo "\n";
print($client->getQuote("microsoft"));
echo "\n</pre>\n";
?>Code: Select all
<?php
include("SOAP/Server.php");
class QuoteService {
var $quotes = array("ibm" => 98.42);
function getQuote($symbol) {
if (isset($this->quotes[$symbol])) {
return $this->quotes[$symbol];
} else {
return "Server - Unknown Symbol '$symbol'.";
}
}
}
$server = new Soap_Server;
$server->_auto_translation = true;
$webservice = new QuoteService();
$server->addObjectMap($webservice,'http://schemas.xmlsoap.org/soap/envelope/');
if (isset($_SERVER['REQUEST_METHOD']) &&
$_SERVER['REQUEST_METHOD']=='POST') {
$server->service($HTTP_RAW_POST_DATA);
} else {
require_once 'SOAP/Disco.php';
$disco = new SOAP_DISCO_Server($server,'ServerExample');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING'])) {
echo $disco->getWSDL();
} else {
echo $disco->getDISCO();
}
exit;
}
?>and my WSDL : stockquote.wsdl-----------
Code: Select all
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='StockQuote'
targetNamespace='http://example.org/StockQuote'
xmlns:tns=' http://example.org/StockQuote '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='getQuoteRequest'>
<part name='symbol' type='xsd:string'/>
</message>
<message name='getQuoteResponse'>
<part name='Result' type='xsd:float'/>
</message>
<portType name='StockQuotePortType'>
<operation name='getQuote'>
<input message='tns:getQuoteRequest'/>
<output message='tns:getQuoteResponse'/>
</operation>
</portType>
<binding name='StockQuoteBinding' type='tns:StockQuotePortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getQuote'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='StockQuoteService'>
<port name='StockQuotePort' binding='StockQuoteBinding'>
<soap:address location='http://www.mentalwealthstudios.com/NNEPC2/server1.php'/>
</port>
</service>
</definitions>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]