Calling functions with parameters using SOAP with Perl

前端 未结 3 379
遇见更好的自我
遇见更好的自我 2021-02-03 15:26

I am attempting to access a web service using SOAP through Perl and am having issues calling the service\'s functions that require parameters. The XSD that dictates the SOAP cal

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-03 16:00

    Use SOAP::WSDL to consume the service wsdl, it also marshals from and (optionally) to plain perl data structures for you. Highly recommended module.

    Something like the following:

    use SOAP::WSDL;
    use Data::Dumper;
    
    my $soap = SOAP::WSDL->new(
      wsdl => 'http://server/pathtoservice?WSDL',
      outputhash => 1
    );
    my $res = $soap->call('method', { foo => 1, bar =>2 });
    die $res->faultstring if $res->fault;
    print Dumper($res->result);
    

提交回复
热议问题