我试图用SOAP :: Lite编写肥皂服务器来处理现有的肥皂客户端(特别是tr-069 dsl调制解调器),但是不清楚传入的xml如何触发调用。肥皂精简版邮件列表主持人对于将我添加到他们的列表中的速度很慢,所以我想我是否有人可以帮助我指出正确的方向...
首先,我得到了:
<faultstring>Unrecognized header has mustUnderstand attribute set to 'true'</faultstring>
我怀疑这意味着我还没有定义一个函数来处理它想要处理的东西。处理程序代码(基于SOAP :: Server手册页中的示例):
SOAP::Transport::HTTP::CGI
->dispatch_to('PeakACS')
->handle;
BEGIN {
package PeakACS;
use vars qw(@ISA);
@ISA = qw(Exporter SOAP::Server::Parameters);
use SOAP::Lite;
my $debugging = 1;
my $console = 0;
my $prog_id = 'peakacs';
my $log = DebugLog->new($prog_id, $debugging, $console);
$log->debug_msg('info', 'handle', '%s', 'handler setup');
sub ID {
$log->debug_msg('info', 'id', '%s', 'got an id');
}
sub Header {
$log->debug_msg('info', 'header', '%s', 'heading');
}
sub Inform {
$log->debug_msg('info', 'inform', '%s', 'informing');
}
}
如果我理解SOAP权利(远非给定的),标记应转换为对Inform的调用 - xml请求的顶部如下:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
<SOAP-ENV:Header>
<cwmp:ID SOAP-ENV:mustUnderstand="1">1539095918</cwmp:ID>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<cwmp:Inform>
<DeviceId>
答案 0 :(得分:0)
如果要将mustUnderstand属性设置为Header中的某个实体,请执行以下操作:
$sheader = SOAP::Header->name('someEntity');
$sheader->mustUnderstand(1);
调用方法时:
$soap->someMethod($sheader,@request);
产生:
<soap:Header>
<someEntity soap:mustUnderstand="1" />
</soap:Header>