Shamil Salakhetdinov
shamil-users at mns.ru
Mon Jan 12 12:04:29 CST 2004
<<< The PHP would probably look something like this >>> Marty, Did you try this .php script? I tried to use it but I didn't get it to work correctly. Then I made a slightly corrected version of your sample .php script: http://www.smsconsulting.spb.ru/phptest/soap/test.php?isbn=0060188782 <?php // include nuSoap.php require_once('./nu/nusoap.php'); // get parameter $isbn = $HTTP_GET_VARS['isbn']; // make parameters array for Web Service call $parameters = array('isbn'=>$isbn); // test echoing of the parameters array echo "<b>Parameters:</b><br/>"; while(list($key, $value) = each($parameters)) { echo "$key = $value<br/>";} // create soapclient object $soapclient = new soapclient( 'http://www.xmethods.net/sd/2001/BNQuoteService.wsdl', 'wsdl'); // call getPrice Web Service $result = $soapclient->call('getPrice',$parameters); // echo Web Service call results echo "<br/><b>Result:</b><br/>"; print "price=$result<br/>"; ?> It didn't work either :( And teh following VB.Net code with a Web Reference set to http://www.xmethods.net/sd/2001/BNQuoteService.wsdl Dim wsrv As New net.xmethods.www.BNQuoteService() Me.txtPrice.Text = wsrv.getPrice("0060188782") works OK and returns: 13.75 Do you think the problem is with NuSOAP.php or with the corrected .php script? TIA for any additional tips and tricks, Shamil ----- Original Message ----- From: "MartyConnelly" <martyconnelly at shaw.ca> To: "Discussion of Hardware and Software issues" <dba-tech at databaseadvisors.com> Sent: Saturday, January 10, 2004 1:23 AM Subject: Re: [dba-Tech] Creating WebServices using PHP (preferred) or PERL > I think you can do this with multiple operations in your wsdl > Use this site to test your wsdl file url for validity It also returns > your operation method parameters. > > http://www.mgateway.com/wsdlClient.htm > > Here is an example of a multi operation wsdl It has 17 operations. > > http://www.financialwebservices.ltd.uk/axis/services/bond?wsdl > As for the wsdl syntax you will have to look up. > > The PHP would probably look something like this > > <?php > $isbn = $HTTP_POST_VARS['isbn']; > require_once('nusoap.php'); > $parameters = array('isbn' => $isbn); > $soapclient = new soapclient( > 'http://www.xmethods.net/sd/2001/BNQuoteService.wsdl', 'wsdl'); > $result = $soapclient->call('getPrice',$parameters); > print "&price=$result"; > ?> > > Shamil Salakhetdinov wrote: > > >Marty, > > > >Thanks for your refs! > > > >I seems to have success with NuSoap as I wrote in my second messge to > >this thread. > >Now, the question is can I put more than one function in PHP WebService > >script - e.g. having this: > > > ><?php > >require_once('../nu/nusoap.php'); > >$s = new soap_server; > >$s->register('hello'); > >function hello($name){ > > // optionally catch an error and return a fault > > if($name == ''){ > > return new soap_fault('Client','','Must supply a valid name.'); > > } > > return "HELLO, $name!"; > >} > >$s->service($HTTP_RAW_POST_DATA); > >?> > > > >How can I add something like this: > > > >function hello1($firstname, $lastname){ > > return "HELLO, $name $lastname!"; > >} > > > >to make it a second web service located in the same php file? > >Of course I can make another .php file but I hope it's possible to use > >one with two or more functions/web services. > > > >TIA, > >Shamil > > > > > >----- Original Message ----- > >From: "MartyConnelly" <martyconnelly at shaw.ca> > >To: "Discussion of Hardware and Software issues" > ><dba-tech at databaseadvisors.com> > >Sent: Friday, January 09, 2004 11:20 PM > >Subject: Re: [dba-Tech] Creating WebServices using PHP (preferred) or > >PERL > > > > > > > > > >>Well I know there was a large problem with Axis Soap and/or Apache and > >>MS Soap clients > >>It was fixed in later versions of Axis, RPC Document Lit coding? > >> > >>See listed in here somewhere > >>http://www.searchwebservices.com > >> > >> > >> > >http://searchwebservices.techtarget.com/originalContent/0,289142,sid26_ gci913069,00.html > > > > > >>or you could try the NuSoap code and PHP IDE > >>from > >>http://www.NuSphere.com > >>https://lists.sourceforge.net/lists/listinfo/nusoap-general > >> > >>or > >>http://sourceforge.net/projects/phpsoaptoolkit/ > >> > >>http://news.php.net/group.php?group=php.soap&i=1280 > >>Axis with Java RPC > >>http://www.techmetrix.com/trendmarkers/wp/pubproduct.php?P=wpp0802-1 > >> > >>You may have to use something like GLUE to generate your WSDL file > >> > >>Shamil Salakhetdinov wrote: > >> > >> > >> > >>>Hi All, > >>> > >>>Anybody knows it's a children work to make and install a Web Service > >>>using MS Tools - e.g. using MS VB6 and MS SOAP Toolkit 3.0. It's the > >>>same kind of easy work to get referenced and use a Web Service from > >>>VS.Net... > >>> > >>>Unfortunately I need/wanted to make a Web Services using PHP or PERL > >>> > >>> > >to > > > > > >>>run it on my ISP site, which uses Linix and Apache. > >>> > >>>I did some intensive search and I've found two interesting tools: > >>> > >>>- PHP: ftp://ftp.activestate.com/WebService/PHP/webservice.zip > >>>(http://dietrich.ganx4.com/nusoap/index.php) > >>>- PERL: http://soaplite.com/ > >>> > >>>PERL doesn't work on my ISP - some strange errors when using > >>> > >>> > >SOAP::Lite > > > > > >>>package (Can't locate URI.pm in @INC ) and I didn't yet find how to > >>>solve this problem - they say the path to one on the packages should > >>> > >>> > >be > > > > > >>>explicitly specified - added to the @INC array - how to add the path > >>> > >>> > >to > > > > > >>>this array - still a problem for me because I don't know PERL... > >>> > >>>I went more smoothly with PHP (I did get working sample web service > >>>callable from PHP itself) but I don't see how I can implement a PHP > >>> > >>> > >Web > > > > > >>>Service callable from e.g. VS.Net. Did anybody here do that? > >>> > >>>Basically, what is needed as far as I understand is to make a WSDL > >>> > >>> > >file > > > > > >>>similar to the one generated by SOAP Toolkit with the only difference > >>>that <port> element of this WSDL file should refer to a .php script - > >>>something like that: > >>> > >>>... > >>><service name='wshello' > > >>> <port name='CHelloSoapPort' binding='wsdlns:CHelloSoapBinding' > > >>> <soap:address location='http://localhost/wstest/wshello.PHP'/> > >>> </port> > >>></service> > >>>... > >>> > >>>Now, wshello.php should be able to accept SOAP requests from wshello > >>> > >>> > >web > > > > > >>>service clients, parse them to get parameters, call a .PHP, .cgi, etc > >>>.... implementations of a web service, get result and return SOAP > >>>response to the client. > >>> > >>>PHP solution (webservice.zip) referred above has sample code (see > >>>P.S.) - the samples 1 and 2 work OK for me but I must say I don't > >>> > >>> > >know > > > > > >>>what they mean by samples 3 and 4 nor I don't know how to call this > >>>sample PHP web service (sample 1 - works OK when called from sample > >>> > >>> > >2) > > > > > >>>from VS.NET. > >> > >> > >>>I guess the solution is very close if exists at all but I'm stuck > >>> > >>> > >with > > > > > >>>what to do next :( > >>> > >>>What I'm missing? > >>>Can anybody help me? > >>> > >>>TIA, > >>>Shamil > >>> > >>>P.S. > >>> > >>>USAGE EXAMPLES: (webservice.zip) > >>> > >>>1. BASIC SERVER EXAMPLE > >>> > >>><?php > >>> > >>>require_once('nusoap.php'); > >>>$s = new soap_server; > >>>$s->register('hello'); > >>>function hello($name){ > >>>// optionally catch an error and return a fault > >>>if($name == ''){ > >>> return new soap_fault('Client','','Must supply a valid name.'); > >>> } > >>>return "hello $name!"; > >>>} > >>>$s->service($HTTP_RAW_POST_DATA); > >>> > >>>?> > >>> > >>>2. BASIC CLIENT USAGE EXAMPLE > >>> > >>><?php > >>> > >>>require_once('nusoap.php'); > >>>$parameters = array('name'=>'dietrich'); > >>>$soapclient = new soapclient('http://someSOAPServer.com/hello.php'); > >>>echo $soapclient->call('hello',$parameters); > >>> > >>>?> > >>> > >>>3. WSDL CLIENT USAGE EXAMPLE > >>> > >>><?php > >>> > >>>require_once('nusoap.php'); > >>>$parameters = array('dietrich'); > >>>$soapclient = new > >>>soapclient('http://someSOAPServer.com/hello.wsdl','wsdl'); > >>>echo $soapclient->call('hello',$parameters); > >>> > >>>?> > >>> > >>>4. PROXY CLIENT USAGE EXAMPLE (only works w/ wsdl) > >>> > >>><?php > >>> > >>>require_once('nusoap.php'); > >>>$soapclient = new > >>>soapclient('http://someSOAPServer.com/hello.wsdl','wsdl'); > >>>$soap_proxy = $soapclient->getProxy(); > >>>echo $soap_proxy->hello('dietrich'); > >>> > >>>?> > >>> > >>>-- > >>>e-mail: shamil at smsconsulting.spb.ru > >>>Web: http://smsconsulting.spb.ru/shamil_s > >>> > >>>_______________________________________________ > >>>dba-Tech mailing list > >>>dba-Tech at databaseadvisors.com > >>>http://databaseadvisors.com/mailman/listinfo/dba-tech > >>>Website: http://www.databaseadvisors.com > >>> > >>> > >>> > >>> > >>> > >>-- > >>Marty Connelly > >>Victoria, B.C. > >>Canada > >> > >> > >> > >>_______________________________________________ > >>dba-Tech mailing list > >>dba-Tech at databaseadvisors.com > >>http://databaseadvisors.com/mailman/listinfo/dba-tech > >>Website: http://www.databaseadvisors.com > >> > >> > > > >_______________________________________________ > >dba-Tech mailing list > >dba-Tech at databaseadvisors.com > >http://databaseadvisors.com/mailman/listinfo/dba-tech > >Website: http://www.databaseadvisors.com > > > > > > > > -- > Marty Connelly > Victoria, B.C. > Canada > > > > _______________________________________________ > dba-Tech mailing list > dba-Tech at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-tech > Website: http://www.databaseadvisors.com