Retrieving PDFs from SAP using "wrapper" IS service which can be exposed externally

We have an RFC in SAP which generates an order confirmation PDF, and we want to allow an external website to call that RFC to display the PDF in a browser window. We currently have our IS server (Business Connector 4.6) in the DMZ and we do all of our service exposures from there, including other RFCs from SAP. This is the first time we’re trying to retrieve a PDF, however, and having some trouble. Up until now the SAP RFCs we’ve exposed return plain ascii data…

We’ve tried having the SAP RFC return both hex binary, and a base64 encoded binary string, but we can’t get either to work. For now we’re trying to get just a simple SMTP flow to email me the file, figuring if I can get that to work then I can go from there to get an HTTP call to work, but the email attachment is always garbage.

In the case of the hex binary return from SAP, I tried taking that as-is as the Content for the attachment, but no go. I tried bytestoStream and as expected, no go. We then switched to base64 encoded string output and I get a record set of multiple lines (SAP’s limit on # chars per line I guess) so I first joined all the lines together (no carriage returns) and ran that through the base64Decode and piped that into the Content of the smtp step, but no go. Tried just piping the base64 string into the Content, but as expected no go.

I can’t find anything in the forums or online that describes this exact scenario. I know a piece of this is understanding what SAP is sending us, but all I have to go on is what the SAP developer is telling me (hex binary vs. base64 encoded string).

Has anyone done anything like this before? Any ideas on what I could try next?


Did you find a solution to the PDF file problem?