Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

QueryDocumentOutputRequestIn Web Service

0 Kudos
177

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"?>

<soapenv:Envelope xmlns:soapenv="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>';

  • SAP Managed Tags:
0 REPLIES 0