Jump to content

How to get parameters in soapserver?


beyzad

Recommended Posts

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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.