NuSOAP - create server with the authentication
I've created WebService using NuSoap library, but I can't find anywhere how to implement authentication. Basically what I want is to connect to this service from C# and add NetworkCredential with the username and password.
userdatawsdl d = new userdatawsdl();
d.Credentials = new NetworkCredential("test", "test");
val = d.GetUserData("x");
So basically what I need to do in php script in order to accept this data and automatically authenticate client request.
This is how my php script looks like now, I have excluded methods which are registered
require_once('lib/nusoap.php');
// create the server object
$server = new soap_server;
// Initialize WSDL support
$server->configureWSDL('userdatawsdl', 'urn:userdatawsdl');
// register soap funct开发者_运维技巧ions
$server->register('GetUserData', array('memberNumber' => 'xsd:string'), array('result' => 'xsd:string'));
$server->register('GetUserStatus', array('memberNumber' => 'xsd:string'), array('result' => 'xsd:string'));
if (isset($error))
{
$fault =
$server->fault('soap:Server','',$error);
}
// send the result as a SOAP response over HTTP
$server->service($HTTP_RAW_POST_DATA);
Take a look at this: it covers implementing authentication in a SOAP server with NuSOAP, which sounds like what you want.
精彩评论