Skip to Content

QueryDocumentOutputRequestIn Web Service

Hi every body,

I would like to retreive all Customers invoices PDF.

I am not experimented with using the SAP API and I need some help.

To retreive the PDF, I wrote a PHP Script using Curl and QueryDocumentOutputReques Web Service.

While testing it, I enabled CURL verbose and always got a "500 internal error".

However, I saw the authentication was correct. Therefore, I thought it was my request which was wrong.

You can find below, my php CURL use and my request.

Thank you to everybody who can help.

Extract of my PHP script:

39 function RecupUrl($url,$request)

40 {

41 $headers = array(

42 "Content-type:text/xml",

43 "Accept: multipart/form-data",

44 "Cache-Control: no-cache",

45 "Pragma: no-cache",

46 "SOAPAction: <url>",

47 "Content-length: ".strlen($request),

48 );

49

51 $ch = curl_init();

52

53 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

54 curl_setopt($ch, CURLOPT_VERBOSE, 1);

55 curl_setopt($ch, CURLOPT_URL, $url);

56 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

57 curl_setopt($ch, CURLOPT_USERPWD, 'XXXXX:PPPPP); // XXXX=user name, PPPPP=Password

58 curl_setopt($ch, CURLOPT_POST, 1);

59 curl_setopt ( $ch, CURLOPT_CUSTOMREQUEST, "POST" );

60 curl_setopt($ch, CURLOPT_POSTFIELDS,$request);

61 curl_setopt($ch, CURLOPT_FAILONERROR, true);

62 curl_setopt($ch, CURLOPT_FORBID_REUSE, true);

63 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

67 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

68

69 curl_setopt($ch, CURLOPT_HEADER, array(

70 "Content-Type: multipart/form-data"

71 ));

73 $data = curl_exec($ch);

74 curl_close($ch);

76 return $data;

78 }

The request :

$request='

<?xml version="1.0" encoding="utf-8"?>

http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob=" http://sap.com/xi/SAPGlobal20/Global">

<soapenv:Header/>

<soapenv:Body>

<glob:DocumentOutputRequestPdf_sync>

<DocumentOutputRequestPDFInformation>

<ReadByDocumentUUID>XXXX-XXXX-XXXX</ReadByDocumentUUID>

</DocumentOutputRequestPDFInformation>

</glob:DocumentOutputRequestPdf_sync>

</soapenv:Body>

</soapenv:Envelope>';

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.