简体   繁体   English

NuSOAP标头身份验证PHP Web服务

[英]NuSOAP Header Authentication PHP Webservice

I am new to SOAP webservices and I need to develop a SOAP Server Webservice that authenticates with the header information. 我是SOAP Web服务的新手,我需要开发一个使用标头信息进行身份验证的SOAP Server Web服务。 I am using NuSOAP as it seems to be a pretty helpful class. 我正在使用NuSOAP,因为它似乎是一个非常有用的类。 I can find a lot of information in regards to the client side of making SOAP calls, but nothing that is very information on the server side. 在进行SOAP调用的客户端方面,我可以找到很多信息,但是在服务器端,没有什么是非常有用的信息。 Looking for any guidance or tutorials for the server side of SOAP. 寻找有关SOAP服务器端的任何指导或教程。

Here is what I have thus far, I'm not sure if this is the proper way to handle the authentication or if there are built in methods: 这是到目前为止的内容,我不确定这是处理身份验证的正确方法还是内置的方法:

$server = new nusoap_server();
$server->configureWSDL("ProjectName", "name:space");

$server->register(

    "authenticate",
    array("UserName"=>"xsd:string",
           "Password"=>"xsd:string",
           "MessageText"=>"xsd:string"),
    array("return"=>"xsd:string")

);

$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);

function authenticate($UserName, $Password, $MessageText) {

}

Thanks for helping a SOAP Noobie!! 感谢您帮助SOAP Noobie! :) :)

You can access the header data by parsing the HTTP_RAW_POST_DATA as XML and using a generic XML library to do what ever is needed. 您可以通过将HTTP_RAW_POST_DATA解析为XML并使用通用XML库执行所需的操作来访问标头数据。

$data = $HTTP_RAW_POST_DATA;        

$doc = new DOMDocument();
$doc->loadXML($data);
$doc->getElementsByTagName('UserName')->item(0)->nodeValue;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM