First of all, I am a newbie with SOAP. So, please be easy on me.

I used stubmaker.pl which came with SOAP::Lite to generate a test.pm from a WSDL. In the generated Adaptive.pm, I see this method.
PaymentDetails => { endpoint => 'https://svcs.paypal.com/AdaptivePayments', soapaction => 'urn:PaymentDetails', namespace => 'http://svcs.paypal.com/services', parameters => [ SOAP::Data->new(name => 'PaymentDetailsRequest', type => 'ap:Pay +mentDetailsRequest', attr => {}), ], },
In the WSDL, these are the relevant entries for this method.
<xs:complexType name="PaymentDetailsRequest"> <xs:sequence> <xs:element minOccurs="1" name="requestEnvelope" type="common:Requ +estEnvelope"> </xs:element> <xs:element minOccurs="0" maxOccurs="1" name="payKey" type="xs:str +ing"> </xs:element> <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##other" pr +ocessContents="lax"/> </xs:sequence> </xs:complexType> <wsdl:operation name="PaymentDetails"> <wsdl:input message="services:PaymentDetailsRequest" name="PaymentDe +tailsRequest"/> <wsdl:output message="services:PaymentDetailsResponse" name="Payment +DetailsResponse"/> <wsdl:fault message="services:PPFaultMessage" name="PPFaultMessage"/ +> </wsdl:operation> <wsdl:operation name="PaymentDetails"> <soap:operation soapAction="urn:PaymentDetails" style="document"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> <wsdl:fault name="PPFaultMessage"> <soap:fault use="literal" name="PPFaultMessage"/> </wsdl:fault> </wsdl:operation>
I have a script below that creates a Soap request and sends its via HTTP. But my end goal is to be able to learn how to use SOAP::Lite. So, how do I use the method that stubmaker.pl generated for me and incorporate that in my script?
#!/usr/bin/perl use warnings; use strict; use HTTP::Request::Common; use LWP::UserAgent; my $user = ''; my $password = ''; my $signature = ''; my $application_id = '' my $url = 'https://svcs.sandbox.paypal.com/AdaptivePayments +/PaymentDetails'; my $ua = LWP::UserAgent->new(); my $headers = HTTP::Headers->new( 'X-PAYPAL-SECURITY-USERID' => $user, 'X-PAYPAL-SECURITY-PASSWORD' => $password, 'X-PAYPAL-SECURITY-SIGNATURE' => $signature, 'X-PAYPAL-APPLICATION-ID' => $application_id, 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SOAP11'); my $format = '%s' x 8; my $content = sprintf( $format, '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/so +ap/envelope/">', '<soapenv:Body>', '<PayRequest><requestEnvelope>', '<errorLanguage>en_US</errorLanguage></requestEnvelope>', '<payKey>AP-xxxxxxxxxxxxx</payKey>', '</PayRequest>', '</soapenv:Body>', '</soapenv:Envelope>'); my $request = HTTP::Request->new( 'POST', $url, $headers, $content ); my $response = $ua->request( $request ); print $response->status_line, "\n";
This is what I have tried so far using SOAP::Lite which I know is 100% incorrect.
#!/usr/bin/perl use warnings; use strict; use SOAP::Lite; my $xmlns = 'http://svcs.paypal.com/services'; my $endpoint = 'https://svcs.sandbox.paypal.com/AdaptivePayments/'; my $soapaction = 'urn:PaymentDetails'; my $method = 'PaymentDetails'; my $user = ''; my $password = ''; my $signature = ''; my $application_id = ''; my $pp = SOAP::Lite->new( uri => $soapaction, proxy => $endpoint ); my $header = SOAP::Header->name( '' => SOAP::Data->name( 'X-PAYPAL-SECURITY-USERID' => $us +er ), SOAP::Data->name( 'X-PAYPAL-SECURITY-PASSWORD' => $pa +ssword ), SOAP::Data->name( 'X-PAYPAL-SECURITY-SIGNATURE' => $si +gnature ), SOAP::Data->name( 'X-PAYPAL-APPLICATION-ID' => $ap +plication_id ), SOAP::Data->name( 'X-PAYPAL-MESSAGE-PROTOCOL' => 'SO +AP11' ), ); my $request = SOAP::Data->new( name => 'PaymentDetailsRequest', type => 'ap:PaymentDetailsRequest', attr => {} ); my $response = $pp->call( $header, $request );

In reply to Help / Confusion with SOAP::Lite by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.