我正在使用Shoretel Web Services SDK,它提供了一个SOAP api。他们提供多种语言的示例,我使用的是Perl。我在创建要在注册方法中使用的结构时遇到困难。我相信我需要序列化数据,但在尝试多种方式后无效。
您可以在ufile.io/kpv4o
找到wsdl架构以下是代码:
use strict;
use warnings;
use SOAP::Lite;
use CGI;
use Digest::MD5 qw(md5 md5_hex md5_base64);
use Serializer;
my $query = new CGI;
my $ip = $query->remote_host; # IP address of remote party...use later as unique identifier.
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n\n";
my $myWebService = SOAP::Lite
-> uri('http://www.ShoreTel.com/ProServices/SDK/Web')
-> proxy('http://xxx.xxx.xxx.xxx:xxxx/ShoreTelWebSDK/WebService')
-> on_action(sub {sprintf '%s/ShoreTelWebService/%s', $_[0], $_[1]});
my $param = {
UserDN => '1111',
UserID => 'Test',
UserPassword => 'dfgdfgdgg'
};
my $regClientResult = $myWebService->RegisterClient(SOAP::Data->name('clientName' => $ip), SOAP::Data->name('userAuthenticationInfo' => $param));
我用该代码得到的错误是
FAULTYa:DeserializationFailed, The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.ShoreTel.com/ProServices/SDK/Web:userAuthenticationInfo. The InnerException message was 'Error in line 1 position 524. 'Element' 'UserPassword' from namespace 'http://www.ShoreTel.com/ProServices/SDK/Web' is not expected. Expecting element 'UserDN'.'. Please see InnerException for more details.
$ param结构的语法应该是什么样的?我已多次查看wsdl文件,无法弄清楚应该是什么。