Perl WSDL11 无法通过 XML 导入处理 WSDL [英] Perl WSDL11 Can't Make it to Work on WSDL with XML import

查看:23
本文介绍了Perl WSDL11 无法通过 XML 导入处理 WSDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Perl 编程的新手.

I am a newbie to Perl programming.

为了学习访问soap服务,我尝试创建一个可以连接到的soap客户端这是,我成功地使用了网络服务.

In order to learn accessing a soap service, I tried to create a soap client that can connect to this in which I was successful to use the web service.

现在,我迁移了代码以连接到我公司的soap服务,但遇到了问题.

Now, I migrated my code to connect to my company's soap service but I encountered a problem.

错误说他们没有port_type,也没有操作."

"The error says that their were no port_type and no operation as well."

请参阅下面的代码片段.

See code snippet below.

#!/usr/bin/perl

use 5.018;
use strict;
use warnings;

use Data::Dumper qw{Dumper};
use XML::Compile::SOAP11;
use XML::Compile::SOAP12;
use XML::Compile::WSDL11;

my $WsdlUrl;
my $WsdlXml;
my $SoapSrvc;
my (%SoapOps);

$WsdlUrl = "http://maxcavmes04/CamstarExternal/camstar.svc";
$WsdlXml = XML::LibXML->new->parse_file($WsdlUrl);
$SoapSrvc = XML::Compile::WSDL11->new($WsdlXml);

print Dumper(\$SoapSrvc);

foreach my $SoapOp ($SoapSrvc->operations())
{
    # XML::Compile::SOAP 2.x
    if ($XML::Compile::SOAP::VERSION > 1.99)
    {
        $SoapOps{$SoapOp->name} 
            = $SoapSrvc->compileClient(operation => $SoapOp->name,
                                       port => SOAP_PORT_TYPE);
    }
    else  # XML::Compile::SOAP 0.7x
    {
        $SoapOps{$SoapOp->{operation}} 
            =  $SoapSrvc->compileClient(operation => $SoapOp->{operation},
                                        port => SOAP_PORT_TYPE);
    }
}

print "\n\n";
exit(0);

进一步调查它为什么不起作用,我使用了名为 .NET WebService Studio 的 3rd 方软件.我从WebService Studio的返回中了解到,我公司的Soap服务通过WSDL:Import使用了两个WSDL文件.

Investigating it further why it won't work, I use a 3rd party software called .NET WebService Studio. I realize from the returned of the WebService Studio that my company's Soap service uses two WSDL file through WSDL:Import.

我想从这个社区询问我如何修改我的程序以便使用 WSDL11 访问公司的肥皂服务.

I would like to ask from this community of how I can modify my program in order to have access to company's soap service using WSDL11.

我还通过print Dumper(\$SoapSrvc)语句附加了soap服务连接的转储数据作为参考.

I have also attached the dumped data of the soap service connection as reference through print Dumper(\$SoapSrvc) statement.

链接:Dumped_SoapSrvc 数据

推荐答案

原因可能是 XML::Compile::WSDL11 没有加载从 wsdl 文件引用的 xsd.您必须下载您的 wsdl 文件.阅读它以查找对外部文件的引用,例如 .下载引用的文件,检查它们的引用......当你拥有一切后,你可以像这样使用它:

A cause can be that XML::Compile::WSDL11 doesn't load xsd's referenced from a wsdl file. You have to download your wsdl file. Read it to find references to external files like . Download referenced files check them for references... When you have everything you can use it like this:

my $wsdl = XML::Compile::WSDL11->new();
$wsdl->importDefinitions("first.xsd");
$wsdl->importDefinitions("second.xsd");
$wsdl->addWSDL("my_service.wsdl");

如果您发布 wsdl 文件,会更容易诊断问题.

It would be easier to diagnose the problem if you post the wsdl file.

这篇关于Perl WSDL11 无法通过 XML 导入处理 WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆