gargle has asked for the wisdom of the Perl Monks concerning the following question:
How come I have to use the following:#!/usr/bin/perl use strict; use warnings; use Readonly; use SOAP::Lite +trace => "debug"; use Data::Dumper; Readonly my $SOAPURL => 'http://the.webservice/service/pers?wsdl'; my $service = SOAP::Lite->service($SOAPURL); my $payload = SOAP::Data->name( 'persKeyParam' => '123456' ); my $info = $service->getEmpInfo( '', $payload ); print Data::Dumper->new( [$info], [qw/$info/] )->Indent(1)->Dump;
The examples found in the documentation always speak of:my $info = $service->getEmpInfo( '', $payload );
The code just above returns a $info = undef;my $info = $service->getEmpInfo( $payload );
and<xs:complexType name='getEmpInfo'> <xs:sequence> <xs:element minOccurs='0' name='persKeyParam' type='xs:string'/> </xs:sequence> </xs:complexType>
Calling $service->getEmpInfo( $payload ); with debug on gives:<operation name='getEmpInfo'> <soap:operation soapAction=''/> <input> <soap:body use='literal'/> </input> <output> <soap:body use='literal'/> </output> </operation>
Calling $service->getEmpInfo( '', $payload ); with debug on gives:<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://webservice.my. +work/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <tns:getEmpInfo> <getEmpInfo xsi:nil="true" xsi:type="tns:getEmpInfo" /> </tns:getEmpInfo> </soap:Body> </soap:Envelope>
The SOAP::Lite I'm using is 0.710.10<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http:/ +/www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://webservice.my. +work/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <tns:getEmpInfo> <getEmpInfo xsi:nil="true" xsi:type="tns:getEmpInfo" /> <persKeyParam xsi:type="xsd:int"> 123456 </persKeyParam> </tns:getEmpInfo> </soap:Body> </soap:Envelope>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SOAP::Lite, I don't get it
by Anonymous Monk on Sep 17, 2010 at 17:16 UTC |