【问题标题】:How do I create a SOAP request directly by parsing the WSDL file?如何通过解析 WSDL 文件直接创建 SOAP 请求?
【发布时间】:2015-06-11 19:45:07
【问题描述】:

我的任务是创建 Perl 脚本,该脚本可以使用提供的参数创建 XML 有效负载并调用 SOAP 调用,然后读取响应并解析参数以供下次使用。我是 SOAP 消息传递的新手。

我有一个 WSDL 文件,我可以基于该文件手动创建 XML SOAP 消息,但我认为这不是正确的方法。我也不明白如何调用 SOAP 调用。是的,我可以阅读文档并且我已经阅读了几次,但我想问一下是否有可能通过解析 WSDL 文件直接创建 SOAP 请求。这个话题有哪些可能性?

我只有一个关于它应该做什么的描述或伪代码,而且我对 SOAP/Web 服务还很陌生。你有什么对我有用的链接吗?

【问题讨论】:

标签: perl soap wsdl


【解决方案1】:

我会推荐XML::Compile::WSDL11

来自文档:

use XML::Compile::WSDL11 (); 

# once in your program
my $wsdl   = XML::Compile::WSDL11->new('def.wsdl');

# XML::Compile::Schema refuses to follow "include" and
# "import" commands, so you need to invoke them explicitly.
# $wsdl->addWSDL('file2.wsdl');            # optional
# $wsdl->importDefinitions('schema1.xsd'); # optional

# once for each of the defined operations
my $call   = $wsdl->compileClient('GetStockPrice');

# see XML::Compile::SOAP chapter DETAILS about call params
my $answer = $call->(%request);

【讨论】:

    猜你喜欢
    • 2014-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-08
    相关资源
    最近更新 更多