How to format SOAP request?

youradds
Contributor
Contributor

Hi,

 

I'm trying to get the Adaptive payment stuff working (for paying multiple users at once). I'm trying the following SOAP request:

 

my $content = sprintf( $format, qq|<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
       <soapenv:Body>
         <actionType>PayRequest</actionType>
         <PayRequest>
           <requestEnvelope>
            <errorLanguage>en_US</errorLanguage>
             <currencyCode>USD</currencyCode>
             <receiverList>
                <receiver>
                  <amount>5</amount>
                  <email>test email here -but wont let me post it!</email>
                </receiver>
             </receiverList>
            <returnUrl>silly forum wont let me post a test link here???</returnUrl>
            <cancelUrl>silly forum wont let me post a test link here???</cancelUrl>
           </requestEnvelope>
           <payKey>AP-xxxxxxxxxxxxx</payKey>',
         </PayRequest>
       </soapenv:Body>
       </soapenv:Envelope>|);

 

That gives me a ton of errors:

 

          'soapenv:Header' => {},
          'soapenv:Body' => {
                            'soapenv:Fault' => {
                                               'detail' => {
                                                           'ns3:FaultMessage' => {
                                                                                 'responseEnvelope' => {
                                                                                                       'correlationId' => 'f51f7844c8698',
                                                                                                       'timestamp' => '2014-03-31T08:59:42.716-07:00',
                                                                                                       'ack' => 'Failure',
                                                                                                       'build' => '10273932'
                                                                                                     },
                                                                                 'xmlns:ns3' => 'http://svcs.paypal.com/types/common',
                                                                                 'error' => [
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'requestEnvelope',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: requestEnvelope cannot be null'
                                                                                            },
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'actionType',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: actionType cannot be null'
                                                                                            },
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'cancelUrl',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: cancelUrl cannot be null'
                                                                                            },
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'currencyCode',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: currencyCode cannot be null'
                                                                                            },
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'receiverList',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: receiverList cannot be null'
                                                                                            },
                                                                                            {
                                                                                              'parameter' => [
                                                                                                             'returnUrl',
                                                                                                             'null'
                                                                                                           ],
                                                                                              'domain' => 'PLATFORM',
                                                                                              'category' => 'Application',
                                                                                              'subdomain' => 'Application',
                                                                                              'errorId' => '580022',
                                                                                              'severity' => 'Error',
                                                                                              'message' => 'Invalid request parameter: returnUrl cannot be null'
                                                                                            }
                                                                                          ],
                                                                                 'xmlns:ns2' => 'http://svcs.paypal.com/types/ap'
                                                                               }
                                                         },
                                               'xmlns:axis2ns4344' => 'http://schemas.xmlsoap.org/soap/envelope/',
                                               'faultcode' => 'axis2ns4344:Server',
                                               'faultstring' => 'Invalid request parameter: requestEnvelope cannot be null'
                                             }
                          },
          'xmlns:soapenv' => 'http://schemas.xmlsoap.org/soap/envelope/'

 

 

I'm a bit baffled as to why its saying all those values are undef, even though I'm clearly passing them in? Its detecting the different params I'm passing in, but it just doesn't seem to like getting the values from them

 

Can anyone suggest what I'm doing wrong?

 

TIA

 

Andy

Login to Me Too
2 REPLIES 2

snowshoe
Frequent Advisor
Frequent Advisor

Suggest visiting the Developer's Forum, this forum tends to be a bit less techical.  You should be able to get some help there.

http://stackoverflow.com/questions/tagged/paypal

Login to Me Too

youradds
Contributor
Contributor

Thanks - have posted there 🙂

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.