In the WSDL, these are the relevant entries for 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 => {}), ], },
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?<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>
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 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";
#!/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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |