|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
WSDL error can someone helpHi all,
I'm getting a strange error when using nusoap with php, both host and client are on a local machine. Here is the server code. <?php function getStockQuote($symbol) { mysql_connect('localhost','user','password'); mysql_select_db('database'); $query = "SELECT stock_price FROM stockprices " . "WHERE stock_symbol = '$symbol'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); return $row['stock_price']; } require('nusoap.php'); $server = new soap_server(); $server->configureWSDL('stockserver', 'urn:stockquote'); $server->register("getStockQuote", array('symbol' => 'xsd:string'), array('return' => 'xsd:decimal'), 'urn:stockquote', 'urn:stockquote#getStockQuote'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server->service($HTTP_RAW_POST_DATA); ?> When I connect to this via a web browser I can view the wsdl for the service and all seems grand. This is the client code. <?php require_once('nusoap.php'); $c = new soapclient('http://localhost:80/distribsys/newtest/server.php'); $stockprice = $c->call('getStockQuote',array('symbol' => 'ABC')); echo "The stock price for 'ABC' is $stockprice."; ?> When i connect I get this error Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:80/distribsys/newtest/server.php' in /var/www/distribsys/newtest/client.php:4 Stack trace: #0 /var/www/distribsys/newtest/client.php(4): SoapClient->SoapClient('http://localhos...') #1 {main} thrown in /var/www/distribsys/newtest/client.php on line 4 I cannot solve this, I have looked all over the web for solutions and no luck, can anyone guess what could be potentially wrong with this, thanks very much in advance, any help is greatly appreciated. |
|
|
AW: WSDL error can someone helpHi,
> $c = new > soapclient('http://localhost:80/distribsys/newtest/server.php'); You forgot the "?wsdl" appendix to the URL. Best regards Christian -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: AW: WSDL error can someone helpHi Christian,
Thanks for the help, one less error. Now there's a new one. Apparently call is a bad function. Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in /var/www/distribsys/newtest/client.php:6 Stack trace: #0 [internal function]: SoapClient->__call('call', Array) #1 /var/www/distribsys/newtest/client.php(6): SoapClient->call('getStockQuote', Array) #2 {main} thrown in /var/www/distribsys/newtest/client.php on line 6 Notice anything else bad in my code. :P Thanks again |
|
|
AW: AW: WSDL error can someone helpHi,
> Fatal error: Uncaught SoapFault exception: [Client] Function ("call") > is not > a valid method for this service in > /var/www/distribsys/newtest/client.php:6 > Stack trace: #0 [internal function]: SoapClient->__call('call', Array) Since you are using WSDL mode anyway, why don't you try something like this (after settting $c): $proxy = $c->getProxy(); $stockprice = $proxy->getStockQuote('ABC'); Best regards Christian -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: AW: AW: WSDL error can someone helpHmm tried, that similar error.
Fatal error: Uncaught SoapFault exception: [Client] Function ("getProxy") is not a valid method for this service in /var/www/distribsys/newtest/client.php:6 Stack trace: #0 [internal function]: SoapClient->__call('getProxy', Array) #1 /var/www/distribsys/newtest/client.php(6): SoapClient->getProxy() #2 {main} thrown in /var/www/distribsys/newtest/client.php on line 6 This is my clients code. <?php require_once('nusoap.php'); $c = new soapclient('http://localhost/distribsys/newtest/server.php?wsdl'); $proxy = $c->getProxy(); $stockprice = $proxy->getStockQuote('ABC'); #$stockprice = $c->call('getStockQuote',array('symbol' => 'ABC')); echo "The stock price for 'ABC' is $stockprice."; ?> |
|
|
AW: AW: AW: WSDL error can someone help> $c = new > soapclient('http://localhost/distribsys/newtest/server.php?wsdl'); Aah, didn't spot that at first. SoapClient is from PHP5's SOAP extension. Use nusoap_client instead. If you want to use SoapClient, omit the getProxy() call. --Christian -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: AW: AW: AW: WSDL error can someone helpThanks Christian,
I think I'm accessing the server now. Do I need to change any code in my server for implement nusoap? I would prefer to use it over regular SoapClient. I'm getting the error. Fatal error: Call to a member function getStockQuote() on a non-object in /var/www/distribsys/newtest/client.php on line 7 Client code here again. <?php require_once('../nusoap/lib/nusoap.php'); $c = new nusoap_client('http://localhost:80/distribsys/newtest/server.php?wsdl'); $proxy = $c->getProxy(); $stockprice = $proxy->getStockQuote('ABC'); #$stockprice = $c->call('getStockQuote',array('symbol' => 'ABC')); echo "The stock price for 'ABC' is $stockprice."; ?> And server is the same. Thanks again for all the help. It's very much appreciated. I don't know how I would have solved this myself.
|
|
|
AW: AW: AW: AW: WSDL error can someone helpHi,
> $c = new > nusoap_client('http://localhost:80/distribsys/newtest/server.php?wsdl') Aah, forgot to tell you to use "true" as the second argument for the nusoap_client constructor. Then it will work. If you want to use PHP5-SOAP, refer to http://php.net/soap. However you may need to generate the WSDL by yourself. Best regards Christian -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: AW: AW: AW: AW: WSDL error can someone helpThats fixed it,
Thanks very much Christian, I think i'll stick with nusoap for the the moment, now that Ive got it working. :D |
|
|
Re: AW: AW: AW: WSDL error can someone helpThank you Christian!. You helped me much!
|
| Free Forum Powered by Nabble | Forum Help |