简体   繁体   English

PHP SOAP WSDL功能列表

[英]PHP SOAP WSDL list of functions

I'm very new to soap programming and I'm stuck on something that looks very simple but I don't how to follow... 我是肥皂编程的新手,但我坚持看起来很简单的东西,但我却不怎么遵循...

Here's my situation. 这是我的情况。 I ask to wsdl soap server for a list of functions, i use __getFunctions() .. and I got this : 我向wsdl soap服务器请求功能列表,我使用了__getFunctions() ..我得到了:

array(10) { [0]=> string(68) "inserirClaustreResponse inserirClaustre(inserirClaustre $parameters)" [1]=> string(56) "inserirCursResponse inserirCurs(inserirCurs $parameters)" [2]=> string(38) "loginResponse login(login $parameters)" [3]=> string(68) "inserirPropostaResponse inserirProposta(inserirProposta $parameters)" [4]=> string(71) "inserirCalendariResponse inserirCalendari(inserirCalendari $parameters)" [5]=> string(59) "inserirPreusResponse inserirPreus(inserirPreus $parameters)" [6]=> string(80) "inserirAprofitamentResponse inserirAprofitament(inserirAprofitament $parameters)" [7]=> string(62) "inserirAlumneResponse inserirAlumne(inserirAlumne $parameters)" [8]=> string(62) "inserirHorariResponse inserirHorari(inserirHorari $parameters)" [9]=> string(41) "logoutResponse logout(logout $parameters)" } 

if I use __getTypes() , I got this : 如果我使用__getTypes() ,我得到了:

[13]=> string(52) "struct LoginInfo { string password; string user; }"

Ok, when I do $client->login(array('password'=>'pass', 'user'=>'admin')); 好的,当我执行$client->login(array('password'=>'pass', 'user'=>'admin'));

If I do a __getLastRequest() 如果我做一个__getLastRequest()

I see this on my request : 我在要求下看到了这个:

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xmlns:ns1="http://***masked***.net">
<SOAP-ENV:Body>
<ns1:login>
<ns1:in0 xsi:nil="true"/>
</ns1:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

I can't see password and user inside <ns1:login> ... I'm not getting and error, but the server is not accepting because there is no data in function login... 我在<ns1:login>中看不到密码和用户...我没有收到错误,但服务器未接受,因为函数登录中没有数据...

Instead of using an array for the parameter you should build a class which represents the requestparameters as attributes: 而不是使用数组作为参数,您应该构建一个将requestparameters表示为属性的类:

class Login{
 public $password;
 public $user;

 function __construct() {
  $this->password = "pass";
  $this->user = "admin";
 }
}

And then initialize the class and add the object as paramter to the soap-request: 然后初始化该类,并将该对象作为参数添加到soap-request中:

$login = new Login();
$client->login(array($login));

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

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