Problem sending data using HttpEndpoint
Posted: Mon May 02, 2022 11:06 am
The below snippet of code shows how I have been sending BASE64 data to our Web Service.
This has been working fine until today. There have been no code changes on either end.
The Base64 string that gets sent is the correct length but some characters have been changed from upper case to lower case.
I have tried changing content type and accept type to no avail. Any ideas?
This has been working fine until today. There have been no code changes on either end.
The Base64 string that gets sent is the correct length but some characters have been changed from upper case to lower case.
I have tried changing content type and accept type to no avail. Any ideas?
Code: Select all
Sent:
jvberi0xljqkjdp0zoekmsawig9iago8paovq3jlyxrpb25eyxrlkeq6mjaymja1mdiwote1ntctmdynmdankqovq3jlyxrvcihqrezzagfyccaxljuwljuxnd ...
Received:
JVBERi0xLjQKJdP0zOEKMSAwIG9iago8PAovQ3JlYXRpb25EYXRlKEQ6MjAyMjA1MDIwOTE1NTctMDYnMDAnKQovQ3JlYXRvcihQREZzaGFycCAxLjUwLjUxND ...
Code: Select all
cVehDoc := File2Base64(DC_Path(AppName(.t.))+'OutputDoc_1.Pdf')
cMedDoc := File2Base64(DC_Path(AppName(.t.))+'OutputDoc_2.Pdf')
Base642File(cVehDoc,'Veh.Pdf')
Base642File(cMedDoc,'Med.Pdf')
MemoWrit('Veh.txt',cVehDoc)
MemoWrit('Med.txt',cMedDoc)
wtf Len(cVehDoc), Len(cMedDoc)
IF Empty(cVehDoc)
DCMSGBOX 'Cannot open OutputDoc_1.Pdf'
RETURN .f.
ENDIF
IF Empty(cMedDoc)
DCMSGBOX 'Cannot open OutputDoc_2.Pdf'
RETURN .f.
ENDIF
cUrl := WebServiceUrl() + 'SubmitSignedLeaseDocuments'
oHC := HttpClient():new( cUrl )
oHC:httpRequest:setParameter( "lseid", cLseID )
oHC:httpRequest:setParameter( "userID",'0007' )
oHC:httpRequest:setParameter( "vehicle_document", cVehDoc )
oHC:httpRequest:setParameter( "medallion_document", cMedDoc )
oHC:httpRequest:setContentType("multipart/form-data")