简体   繁体   中英

Perl WSDL11 Can't Make it to Work on two WSDL files

This question is related to the issue I encountered on my Perl Program using XML::Compile::WSD11 Perl Module in which my company Webservice uses multiple WSDL with XML import.

The original post that describe this issue can be found here . From that post, I tried the suggestion of imatveev13 to use the addWSDL API from XML::Compile::WSDL11 and the code snippet is shown below.

The two WSDL files used in the test Perl program are: WSDL0 and WSDL1 .

#!/usr/bin/perl

use 5.018;
use strict;
use warnings;

use Data::Dumper qw{Dumper};

use XML::Compile::SOAP11; # XML::Compile::SOAP 2.x
use XML::Compile::WSDL11;
use XML::Compile::Transport::SOAPHTTP;

my $WSDL0 = 'CamstarWebClient0.wsdl';
my $WSDL1 = 'CamstarWebClient1.wsdl';

# Create service proxy for web service
my $wsdlXml0 = XML::LibXML->new->parse_file($WSDL0);
my $wsdlXml1 = XML::LibXML->new->parse_file($WSDL1);

my $SoapSrv = XML::Compile::WSDL11->new();
$SoapSrv->addWSDL($wsdlXml0);
$SoapSrv->addWSDL($wsdlXml1);

print Dumper($SoapSrv);

# Compile all service methods
my (%SoapOps);
foreach my $SoapOp ($SoapSrv->operations)
{
    print Dumper($SoapOp);
    # XML::Compile::SOAP 2.x
    if ($XML::Compile::SOAP::VERSION > 1.99)
    {
        $SoapOps{$SoapOp->name}
            = $SoapSrv->compileClient(operation => $SoapOp->name, 
                                      port => "ICamstar");
    }
}

print "\n";
exit;

Running the code gave me an error: cannot find port 'ICamstar', pick from BasicHttpBinding_ICamstar .

I also tried without specifying the port since the service do not implement multiple port but it gave me a different error.

Can't locate object method "_writer_body_rpcenc_hook" via package "XML::Compile::SOAP11::Client" at /usr/local/share/perl5/XML/Compile/SOAP.pm line 155 .

Appreciate any help from the community. Thanks.

确保在脚本顶部使用模块XML::Compile::SOAP11::Encoding

use XML::Compile::SOAP11::Encoding;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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