PB 12.6
Here's the part of the code: Thanks.
String ls_BOUNDARY, ls_mimetype_A = 'application/pdf', ls_mimetype_B = 'text/xml'
Blob blb_multipart
Blob blb_boundary, blb_terminus, blb_filename_A, blb_mimetype_A, blb_file_A
Blob blb_filename_B, blb_mimetype_B, blb_file_B
ls_BOUNDARY = "$$$Boundary$$$"
// build the content
blb_boundary = blob('~r~n--' + ls_Boundary + '~r~n', EncodingUTF8!)
blb_terminus = blob('~r~n--' + ls_Boundary + '--~r~n', EncodingUTF8!)
// Create component blobs - Part: file
blb_filename_A = blob('Content-Disposition: form-data; name="File-Name"' + '~r~n~r~n' + ls_FileName, EncodingUTF8!)
blb_mimetype_A = blob('Content-Disposition: form-data; name="Mime-Type"' + '~r~n~r~n' + ls_MimeType_A, EncodingUTF8!)
blb_file_A = blob( 'Content-Disposition: form-data; name="File"; filename="' + ls_FileName + '"' + '~r~n' + &
"Content-Type: " + ls_MimeType_A + "~r~n~r~n", EncodingUTF8!)
blb_multipart = blb_boundary + &
blb_filename_A + &
blb_mimetype_A + &
blb_file_A
// Create component blobs - Part: form
blb_filename_B = blob('Content-Disposition: form-data; name="Form"' + '~r~n~r~n' + ls_StrXml, EncodingUTF8!)
blb_mimetype_B = blob('Content-Disposition: form-data; name="Mime-Type"' + '~r~n~r~n' + ls_MimeType_B+ "~r~n~r~n", EncodingUTF8!)
blb_multipart += blb_boundary + &
blb_filename_B + &
blb_mimetype_B + &
blb_terminus
lobj_dom = CREATE OLEObject
ll_rc_dom = lobj_dom.ConnectToNewObject ("Msxml2.DOMDocument.6.0")
IF ll_rc_dom < 0 THEN
IF IsValid(lobj_dom) THEN DESTROY lobj_dom
ls_error_message = "Unable to connect to the OLE object Msxml2.DOMDocument.6.0.~r~n~r~nError code = '" + String(ll_rc_dom) + "'"
as_error_message = is_dms_message + '~r~rDMS Message: ' + ls_error_message
RETURN -1
END IF
IF gnv_dmssrvc.fnv_connect_endpoint (as_error_message) = 1 THEN
TRY
lobj_xmlhttp.Open("POST", ls_xml_data_param, FALSE)
lobj_xmlhttp.SetRequestHeader("Content-type", "multipart/form-data;boundary="+ ls_BOUNDARY)
lobj_xmlhttp.Send(blb_multipart)
ls_status_text = lobj_xmlhttp.StatusText
ll_status_code = lobj_xmlhttp.Status
ls_response_text = lobj_xmlhttp.ResponseText
First time consuming restful services in PB12.6 and i got the following response: Thanks,
<response>
<status>ERROR</status>
<errorDetails>
<errorType>VALIDATION_ERROR</errorType>
<errorTime>2020-01-30T09:27:13+08:00</errorTime>
<serviceEndpoint>/dev-webservice-3/documents</serviceEndpoint>
<username>wobjective</username>
<messages><message>Missing required part 'form'</message></messages>
</errorDetails>
</response>