Calling functions with parameters using SOAP with Perl

前端 未结 3 378
遇见更好的自我
遇见更好的自我 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:01

    You can use wsdl2perl.pl to generate client stub code from wsdl. This makes things pretty easy. wsdl2perl.pl is part of SOAP::WSDL. Here is the sample code after you have generates client stub.

    use MyInterfaces::SoapImplService::SoapPort;
    
    my $soap = MyInterfaces::SoapImplService::SoapPort->new();
    #calling method createRecipient which takes 2 parameterss:
    #1. Complex type : recipient
    #2. Complex type : authentication
    
    my $response=$soap->createRecipient( { # MyTypes::createRecipient
        recipient =>  { # MyTypes::Recipient
          address =>  "test701\@test.com", # string
          externalID =>  "test701\@test.com", # string
          sourceDescription =>  "testing perl", # string
          demographics =>  { # MyTypes::StringCollection
            },
        },
      },,
     { # MyTypes::authentication
       username=>'testuser' , password=>'pass'
      },,
     );
    
    #you can find example code of calling every function in your "MyInterfaces\SoapImplService\SoapPort.pm" file.
    

提交回复
热议问题