cancel
Showing results for 
Search instead for 
Did you mean: 

PayPal integration using SOAP messages

Former Member
0 Kudos

Hello,

for a integration scenario we want to call a PayPal SOAP API as described in <a href="https://www.x.com/docs/DOC-1244 ">https://www.x.com/docs/DOC-1244</a>.

The PayPal safety requirements are fullfilled by giving a Username, Password and Signature in the SOAP Header:


<SOAP-ENV:Header>      
  <RequesterCredentials xmlns=u201Durn:ebay:api:PayPalAPIu201D xsi:type=u201Debl:CustomSecurityHeaderTypeu201D>           
   <Credentials xmlns=u201Durn:ebay:apis:eBLBaseComponentsu201D xsi:type=u201Debl:UserIdPasswordTypeu201D>                        
    <Username>api_username</Username>                
    <Password>api_password</Password>               
    <Signature>api_signature</Signature>                
    <Subject>authorizing_account_emailaddress</Subject>          
   </Credentials>     
  </RequesterCredentials> 
</SOAP-ENV:Header>

I have given the three values as Adapter-Specific Message Attributes filled by UDF in Message Mapping.

The filled values are also visible in monitoring in section DynamicConfiguration.

SOAP Adapter: http://s3.directupload.net/file/d/2127/r8y4aywt_jpg.htm

Monitoring: http://s5.directupload.net/file/d/2127/cqvfds35_jpg.htm

But PayPal responded:

Authentication/Authorization Failed

You do not have permissions to make this API call

My credentials are ok. I have tested it within the PayPal NVP API Tester: http://www.shopsandbox.de/PayPal/Refund/ .

How do I have to manipulate the SOAP header for a successful SOAP API call?

Is it necessary also to insert the nodes ?

If yes, how?

Thanks in advance,

André

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Andre,

Are you using the SOAP adapter in standard & no-SOAP mode to be able to add the headers? If not, it will ignore the headers and just transport the body element.

Axis mode does support adding of headers by configuration parameters I believe.

Did you try to put a tracer in the middle between PI and PayPal to see what is actually being transferred?

Regards,

Gokhan

Former Member
0 Kudos

Sorry, just saw your screenshot now. You have configured Variable headers, but those are HTTP headers, not SOAP headers. Your parameters are only added to the HTTP call as HTTP header, so your message probably has no SOAP header, and that causes the unauthorization.

You need to go one of the 2 ways as I described - noSOAP mode where you have construct the whole SOAP envelope, header, and body yourself, or use the Axis mode.

Please refer to SOAP adapter FAQ from SAP Notes to get more info.

Regards,

Gokhan

Former Member
0 Kudos

>

I recommend to implement it in a Java mapping

>

For option one (no SOAP mode), you can use Java mapping or develop your own Adapter Module. The adapter module option will be much faster & convenient at runtime so I would advise you to go this way.

Regards,

Gokhan

Former Member
0 Kudos

Hi Christian & Gokhan,

many thanks for your reply.

My understanding:

- I have to activate the Conversion Parameter Do Not Use SOAP Envelope in the Receiver SOAP channel

- I have to build the whole message with envelope, header and body in Message Mapping by my own

I'll try it and will respond asap.

Thanks,

André

Former Member
0 Kudos

Andre, kindly check for doing it with the Axis mode if possible - since this is a simple requirement, it might save you the task of creating an adapter module from scratch.

For the Axis mode, please check yzanagi's post to the following thread to have an idea about how it's done:

Regards,

Gokhan

Former Member
0 Kudos

Hi,

I´ve created the whole SOAP message in Message Mapping and changed the SOAP receiver adapter sending the message without envelope. But the response is:

ADAPTER.HTTP_EXCEPTION

HTTP 500 Internal Server Error



<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
 <Header>
  <RequesterCredentials>
   <Credentials>
     <Username>xxxxx</Username>
     <Password>xxxx</Password>
     <Signature>xxxxxx</Signature>
     </Credentials>
   </RequesterCredentials>
  </Header>
  <Body>
   <RefundTransactionReq>
    <RefundTransactionRequest>
     <Version>54.0</Version>
     <TransactionID>xxxxxxxxx</TransactionID>
     <InvoiceID>222222</InvoiceID>
     <RefundType>Partial</RefundType>
    <Amount>1</Amount>
    <Memo>memotext</Memo>
   </RefundTransactionRequest>
  </RefundTransactionReq>
 </Body>
</Envelope>

Have I missed sth?

Thanks,

André

Former Member
0 Kudos

Check the content type of your message. Error 500 is often related to wrong content type.

CSY

Former Member
0 Kudos

Hi Christian,

there is no content type in SOAP adapter.

Text/Xml is only available in HTTP adapter.

Former Member
0 Kudos

I recommend to use a tool like TCPMon to redirect the SOAP request, and compare the request for the call which works (the API client) and that which fails (PI). This should give a good hint.

Also I recommend to use a tool like soapUI which allows you to manually modify the SOAP request. Without these tools, unfortunately you are quite lost in PI when you implement SOAP calls and face a problem. A helpful new feature for PI 7.3 would be to have a good SOAP debugger, so that we do not have to use external tools for that anymore.

CSY

Former Member
0 Kudos

Ok,

1.) I have tested the request with the WSDL https://www.paypal.com/wsdl/PayPalSvc.wsdl and SOAP UI. Request works fine.

2.) Afterwards I rebuilt the whole message with the envelope, header and body as an XML file and sent it against the PayPal SOAP API.

Result:

SOAP-ENV:VersionMismatch

SOAP version mismatch or invalid SOAP message

There are three different namespace in the WSDL. I have no chance to put three namespaces into my XSD/XML I want to fire with the receiver SOAP adapter. So the error occours.

If I use the WSDL as external definition I only get the body part in my message mapping but no envelope and header nodes/elements.

How can I rebuild the whole message? Or do I have use the original WSDL so that there is no chance to rebuild?

Thanks,

André

Former Member
0 Kudos

You really need to do an HTTP trace to find out what is actually being transferred, your payload is probably still not correct.

Kindly check SAP note 856597 and download aiitcpgw.jar to trace your HTTP post to PayPal. The note will guide you on how to use the tool as well.

Regards,

Gokhan

Former Member
0 Kudos

When I have implemented a similar thing, I just created the whole input XMLfor the SOAP request "manually" in the Java mapping.

That should give you all freedom. You do not need to use the WSDL.

CSY

Former Member
0 Kudos

Hi Christian,

I´ve created a Java Mapping where I built the whole SOAP message "manually".

I´m putting the created Java mapping class into my Operation Mapping (as described in /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi).

What I have to do with the Service Interface in the Target Operation of the Operation Message?

I think the Service Interface with the Target Message must have the same message structure as the message built in the Java Class, right?

Or can I use a Service Interface without a structure?

Thanks in advance,

André

Answers (1)

Answers (1)

Former Member
0 Kudos

>Is it necessary also to insert the nodes <RequesterCredentials> and <Credentials>?

>If yes, how?

this will be necessary for sure. Otherwise the server will not recognize your login attributes. I recommend to implement it in a Java mapping because there you can create any target XML. I have done a similar thing, first create the XML in Java, then call the SOAP adapter with the SOAP lookup method in this Java mapping. That should work fine.

CSY