beyzad Posted June 18, 2012 Share Posted June 18, 2012 Hi there. I am developing a SOAP web service and i need to authenticate the user. So i'm using the following code: <?php $params = array('login' => 'user_test' , 'password' => 'pass_test'); $client = new SoapClient('http://web.service/wsdl.xml' , $params); ?> This is all good. but i have no idea how to get values of 'login' and 'password' At the server side application. How to get the above values? What are they? They are POST? GET? or whatever? Thanks. Quote Link to comment Share on other sites More sharing options...
cpd Posted June 18, 2012 Share Posted June 18, 2012 What do you mean you've no idea how to get the parameters? Have you created a web service or are you just trying to execute a method a web service offers? If you've created a web service, what language are you writing your web service in? Executing a web service will often return some sort of result be it a boolean value or perhaps a JSON string. You must then interpret the returned data. E.g. A weather web service - you can find many on the internet - may have a method "getWeatherByLocation(String location)". In calling this method you may get an XML dataset which tells you the temperature in C and F, the humidity, cloud coverage, wind speed/direction. You must then parse this XML data and read it in PHP... Quote Link to comment Share on other sites More sharing options...
beyzad Posted June 18, 2012 Author Share Posted June 18, 2012 What do you mean you've no idea how to get the parameters? Have you created a web service or are you just trying to execute a method a web service offers? If you've created a web service, what language are you writing your web service in? Executing a web service will often return some sort of result be it a boolean value or perhaps a JSON string. You must then interpret the returned data. E.g. A weather web service - you can find many on the internet - may have a method "getWeatherByLocation(String location)". In calling this method you may get an XML dataset which tells you the temperature in C and F, the humidity, cloud coverage, wind speed/direction. You must then parse this XML data and read it in PHP... Hi there. As i said, I am developing the web service. I used WSDL/SOAP in PHP. I have no problem using both server and client sides. But the only thing i can't understand is the following: <?php $params = array('login' => 'user_test' , 'password' => 'pass_test'); $client = new SoapClient('http://web.service/wsdl.xml' , $params); ?> At my server-side script, I am using the following: <?php class WebSkyClass { blahblahblahblah.... } $server = new SoapServer('wsdl.xml'); $server -> setClass('WebSkyClass'); $server -> handle(); But i still dont know how can i use $params that i used in soapclient() IN another language, I need to authenticate my webservice as all other webservices do. But i dont know how. Thanks Quote Link to comment Share on other sites More sharing options...
cpd Posted June 18, 2012 Share Posted June 18, 2012 I see what your saying. As far as I'm aware, the SoapServer is not concerned with the parameters as YOU the developer should know if parameters are required. If you provide parameters upon calling said method, the SoapServer will pass those parameters to the registered method which is being called and the method will then do its thing. So as long as you register the method, in the SoapServer using SoapServer::setFunction(FuncName) you should be fine. Quote Link to comment Share on other sites More sharing options...
beyzad Posted June 19, 2012 Author Share Posted June 19, 2012 Hi again. Finally got it. Those parameters will fetch into $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] I wonder why there is nothing in php.net or anywhere else about this... Regards Quote Link to comment Share on other sites More sharing options...
beyzad Posted June 19, 2012 Author Share Posted June 19, 2012 wrong post sorry Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.