1. mahmoud mahmoud
  2. PowerBuilder
  3. Tuesday, 25 July 2023 20:00 PM UTC

 

hello my friends

 

please help me

i need to add header to my api

        loo_xmlhttp.SetRequestHeade("X-Gateway-APIKey", "6f8f3577-8a09-4757-8b16-8c7e331d4a97")

i add it in code but when run application and debug app stopped at line ↓

loo_xmlhttp.SetRequestHeade("X-Gateway-APIKey", "6f8f3577-8a09-4757-8b16-8c7e331d4a97")

 
// 
//Create an instance of our COM object
loo_xmlhttp = Create OleObject
lole_xml_document = Create OleObject
li_rc = loo_xmlhttp.ConnectToNewObject("MSXML2.ServerXMLHTTP.6.0")
If li_rc = 0 Then //connect succeeds 

		loo_xmlhttp.Open ("POST",as_url, False) 	
		
		ls_Auth = f_encode_any_data64(as_user+":"+as_passwd) // Base 64 Encode
		
		//loo_xmlhttp.SetRequestHeader( "Accept", "application/json;")
		loo_xmlhttp.SetRequestHeade("X-Gateway-APIKey", "6f8f3577-8a09-4757-8b16-8c7e331d4a97")
		loo_xmlhttp.SetRequestHeader( "Authorization", "Basic " + ls_Auth )
		loo_xmlhttp.SetRequestHeader( "Content-Type", "application/json") //content type json
		loo_xmlhttp.SetRequestHeade("Cookie", "__cf_bm=ZWuqCaE3B1zB5YgpbY0IDGB7ef45PG2pI2tIM8_5xaQ-1690312019-0-AUCiGTmjDaxTaPpnjgW8l37r+8OgEdcJUEWJDSM3IT1aGrigKehPpIe5xf7/2tv9/XsRH85nW4Hqw027D+1oTWM=; visid_incap_2290886=PxelvogySAOtbSYDeEtN+lpoF2QAAAAAQUIPAAAAAACY8woWgzrJOuVpR9ZvfrGk")
						 
		loo_xmlhttp.Send(as_json_input) //Send data
		
		//Get our response
		ls_status_text = loo_xmlhttp.StatusText
		ll_status_code = loo_xmlhttp.Status
	end if
Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 25 July 2023 20:46 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, Mahmoud -

Perhaps the problem is the incorrect spelling of the SetRequestHeader method name (twice)?

Comment
  1. Miguel Leeuwe
  2. Wednesday, 26 July 2023 13:15 PM UTC
Hmmm, shouldn't that have given a compiler error and not allow to save?

Great spot though!
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 26 July 2023 13:16 PM UTC
Ah okay ... it's an OLE object. They don't check nothing.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 26 July 2023 13:16 PM UTC
(*anything)
  1. Helpful
There are no comments made yet.
mahmoud mahmoud Accepted Answer Pending Moderation
  1. Wednesday, 26 July 2023 10:29 AM UTC
  2. PowerBuilder
  3. # 1

You are right Mr John I modified it and now working 

Thanks alot

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 25 July 2023 20:52 PM UTC
  2. PowerBuilder
  3. # 2

it is far easier to use the native HTTP client.  

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.