Kbase P155357: How to save a web service response to a text file
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/3/2009 |
|
Status: Unverified
GOAL:
How to save a web service response to a text file
GOAL:
How to save a SOAP response to an operating system text file before parsing it
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.x
FIX:
The following code will save a web service response received as a LONGCHAR to a text file:
DEFINE VARIABLE lcResponse AS LONGCHAR NO-UNDO.
DEFINE VARIABLE mResponse AS MEMPTR NO-UNDO.
DEFINE VARIABLE iResponseLength AS INTEGER NO-UNDO.
lcResponse = 'My test response'.
iResponseLength = LENGTH(lcResponse).
SET-SIZE(mResponse) = iResponseLength.
OUTPUT TO "response.txt" BINARY NO-MAP no-convert.
/* use the exact length of the LONGCHAR to avoid adding a null byte at the end*/
PUT-STRING(mResponse, 1, iResponseLength) = lcResponse.
EXPORT mResponse.
OUTPUT CLOSE.