繁体   English   中英

如何使用perl SOAP :: Lite输出soap片段?

[英]How can I output the soap fragment with perl SOAP::Lite?

我是肥皂协议的新手,所以我想找到一个用于生成肥皂片段的perl模块,以便我可以学习如何用它构建肥皂片段,SOAP :: Lite是一个非常好的肥皂模块,但是我不能查找有关如何将soap片段输出到文件或stdout的教程,那么有什么提示吗?
问候。

use strictures;
use SOAP::Lite qw();
my $soap_body = SOAP::Data->name('foo' => \SOAP::Data->value(SOAP::Data->name('bar' => '123')));
print SOAP::Serializer->envelope(freeform => $soap_body);

$ perl -C /tmp/soap.pl | xmllint -format -
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <soap:Body>
    <foo>
      <bar xsi:type="xsd:int">123</bar>
    </foo>
  </soap:Body>
</soap:Envelope>

对于这样的实验任务,通常最好使用REPL 它使您可以更快地完成周转,因为您在输入表达式后会立即看到结果。

暂无
暂无

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

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