faustf

setrequestheader send XML script

13 posts in this topic

hi guy 

how  is  possible  to send  a   script  XML  script ?

<?xml version="1.0" encoding="utf-8"?>
<GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RuName>MyRunamehere</RuName>
</GetSessionIDRequest>
; The data to be sent
;$sPD = '<?xml version="1.0" encoding="utf-8"?><GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents"><RuName>MyRuNameHere</RuName></GetSessionIDRequest>'
$sPD='<?xml version="1.0" encoding="utf-8"?>' & _
'<GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents"> '& _
 ' <RuName>MyRuNameHere</RuName>' & _
'</GetSessionIDRequest>'

; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://open.api.sandbox.ebay.com/shopping?", False)
$oHTTP.SetRequestHeader("X-EBAY-API-APP-ID", "developf-develop-SBX-02f8a652f-80372f63")
$oHTTP.SetRequestHeader("X-EBAY-API-VERSION", "963")
$oHTTP.SetRequestHeader("X-EBAY-API-SITE-ID", "0")
$oHTTP.SetRequestHeader("X-EBAY-API-CALL-NAME", "GeteBayTime")
$oHTTP.SetRequestHeader("X-EBAY-API-REQUEST-ENCODING", "XML")


; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 then
 MsgBox(4096, "Response code", $oStatusCode)
EndIf

ConsoleWrite($oReceived)
#cs
; Saves the body response regardless of the Response code
 $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
 FileWrite($file, $oReceived)
 FileClose($file)
 #ce

i have  this  error

 

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
<?xml version="1.0" encoding="UTF-8"?>

  <GeteBayTimeResponse xmlns="">
   <ns1:Ack xmlns:ns1="urn:ebay:apis:eBLBaseComponents">Failure</ns1:Ack>
   <ns2:Errors xmlns:ns2="urn:ebay:apis:eBLBaseComponents">
    <ns2:ShortMessage>Input data is invalid.</ns2:ShortMessage>
    <ns2:LongMessage>Input data for the given tag is invalid or missing. Please check API documentation.</ns2:LongMessage>
    <ns2:ErrorCode>1.22</ns2:ErrorCode>
    <ns2:SeverityCode>Error</ns2:SeverityCode>
    <ns2:ErrorParameters ParamID="0">
     <ns2:Value></ns2:Value>
    </ns2:ErrorParameters>
    <ns2:ErrorClassification>RequestError</ns2:ErrorClassification>
   </ns2:Errors>
   <ns3:Build xmlns:ns3="urn:ebay:apis:eBLBaseComponents">E963_CORE_APILW_17934819_R1</ns3:Build>
   <ns4:Version xmlns:ns4="urn:ebay:apis:eBLBaseComponents">963</ns4:Version>
  </GeteBayTimeResponse>
 +>22:11:16 AutoIt3.exe ended.rc:0
+>22:11:16 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.196

 

Share this post


Link to post
Share on other sites



I don't know, but try debug:
 

; The data to be sent
;~ $sPD = '<?xml version="1.0" encoding="utf-8"?><GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents"><RuName>MyRuNameHere</RuName></GetSessionIDRequest>'
$sPD = '<?xml version="1.0" encoding="utf-8"?>' & _
        '<GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents"> ' & _
        ' <RuName>MyRuNameHere</RuName>' & _
        '</GetSessionIDRequest>'

; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://open.api.sandbox.ebay.com/shopping?", False)
$oHTTP.SetRequestHeader("X-EBAY-API-APP-ID", "developf-develop-SBX-02f8a652f-80372f63")
$oHTTP.SetRequestHeader("X-EBAY-API-VERSION", "963")
$oHTTP.SetRequestHeader("X-EBAY-API-SITE-ID", "0")
$oHTTP.SetRequestHeader("X-EBAY-API-CALL-NAME", "GeteBayTime")
$oHTTP.SetRequestHeader("X-EBAY-API-REQUEST-ENCODING", "XML")


; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 Then
    MsgBox(4096, "Response code", $oStatusCode)
EndIf

ConsoleWrite($oReceived & @CRLF)
ConsoleWrite("!------------------------------------------------" & @CRLF)

$oReceived = $oHTTP.GetAllResponseHeaders()
ConsoleWrite($oReceived & @CRLF)
#cs
    ; Saves the body response regardless of the Response code
    $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
    FileWrite($file, $oReceived)
    FileClose($file)
#ce

 


Regards,
 

Share this post


Link to post
Share on other sites

mmm i tryed but  not understund so much

<GeteBayTimeResponse xmlns="">
   <ns1:Ack xmlns:ns1="urn:ebay:apis:eBLBaseComponents">Failure</ns1:Ack>
   <ns2:Errors xmlns:ns2="urn:ebay:apis:eBLBaseComponents">
    <ns2:ShortMessage>Input data is invalid.</ns2:ShortMessage>
    <ns2:LongMessage>Input data for the given tag is invalid or missing. Please check API documentation.</ns2:LongMessage>
    <ns2:ErrorCode>1.22</ns2:ErrorCode>
    <ns2:SeverityCode>Error</ns2:SeverityCode>
    <ns2:ErrorParameters ParamID="0">
     <ns2:Value></ns2:Value>
    </ns2:ErrorParameters>
    <ns2:ErrorClassification>RequestError</ns2:ErrorClassification>
   </ns2:Errors>
   <ns3:Build xmlns:ns3="urn:ebay:apis:eBLBaseComponents">E963_CORE_APILW_17934819_R1</ns3:Build>
   <ns4:Version xmlns:ns4="urn:ebay:apis:eBLBaseComponents">963</ns4:Version>
  </GeteBayTimeResponse>
 
!----------------------------------------
Cache-Control: no-cache
Connection: Keep-Alive
Date: Tue, 10 May 2016 20:44:42 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/xml;charset=utf-8
Expires: Sat, 25 Dec 1999 00:00:00 GMT
Last-Modified: Tue, 10 May 2016 20:44:42 GMT
Server: Apache-Coyote/1.1
X-EBAY-API-BUILD-TAG: E963_CORE_APILW_17934819_R1
X-EBAY-API-POOL-NAME: ___cDRidW9rdHZnaWdnaX9ganRi
X-EBAY-API-SERVER-NAME: ___dm8ucnA3Myg0YWBhZDIyKjc3LTI3KTE8KDIwPz43OzU=
X-EBAY-ESB-GUID: urn:uuid:1B977D579C3C1225B326991775554435590-491244872

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I see you are creating one big project.
It is interesting to watching all your questions as this showing how AutoIt can be used to combine several technologies to develop CRM/ERP like program with many awesome feature.

This reminds me of one of my projects.

btw.

This:

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

Should look like this:

; Get the body response if any, and get the server status response code.
$sReceived = $oHTTP.ResponseText
$sStatusCode = $oHTTP.Status

As you are not downloading it (this is already in this object just after 

; Performing the Request
$oHTTP.Send($sPD)

because when you are using Send then server sending to you response automaticaly and you do not must download it separatly.
So this object method Send is waiting for response and automatiacly sets ResponseText.
So you are ust getting object property.

.....

and this is property which get to you results as string not object, so you should use correct variable naming $sReceived instead $oReceived  - just for clarity of code.

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Try to look here: VIES over SOAP 

This is my solution to similar case.


 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

hi @mLipok how are you ?

i hope  very well :)

 

yea so big  project :D  i hope  finish  one  day,  the code posted  is only  for  test  if  i understund  how  work ebay api  .  i rewrite ;) 

Share this post


Link to post
Share on other sites

Thanks, good.
I see you are also full of idea and things to do, in the process of making, interesting things.
This is a great time when you see from day to day, you progress with the work forward, and the whole thing takes on a real shape.


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Btw. here on the forum already is 

 

Did you look at this ?

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

yea  seangriffin inspire me   i just  create  a  half  udf  for  get  info ,    but  now  is  very hard  for me  :) , i  want coding  all api  for ebay  and  share  at  comunity  my  udf  :D

but  the target  is  so far :)

 

Share this post


Link to post
Share on other sites

i did  do  some  modify

; The data to be sent

$sPD = _
'<?xml version="1.0" encoding="utf-8"?>' & _
'<GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents">' & _
  '<RuName>develop_faustf-developf-develo-ygpoetp</RuName>' & _
'</GetSessionIDRequest>' & _
''

; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://open.api.sandbox.ebay.com/shopping?", False)
$oHTTP.SetRequestHeader("X-EBAY-API-DEV-ID", "49cd0e8e-cbce-4830-acc1-0e3a250a33ae")
$oHTTP.SetRequestHeader("X-EBAY-API-APP-ID", "developf-develop-SBX-02f8a652f-80372f63")
$oHTTP.SetRequestHeader("X-EBAY-API-CERT-ID", "SBX-2f8a6526f23ec-65bd-42d7-b081-5a25")
$oHTTP.SetRequestHeader("X-EBAY-API-VERSION", "963")
$oHTTP.SetRequestHeader("X-EBAY-API-SITE-ID", "0")
$oHTTP.SetRequestHeader("X-EBAY-API-CALL-NAME", "GetSessionID")
$oHTTP.SetRequestHeader("X-EBAY-API-REQUEST-ENCODING", "XML")

;MsgBox  (0,'',$sPD)

; Performing the Request
$oHTTP.Send($sPD)


; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 Then
    MsgBox(4096, "Response code","Response  Code:   "& $oStatusCode)
EndIf

ConsoleWrite($oReceived & @CRLF)
ConsoleWrite("!----------------------------------------" & @CRLF)
$oReceived = $oHTTP.GetALLResponseHeaders()
ConsoleWrite($oReceived & @CRLF)

#cs
    ; Saves the body response regardless of the Response code
    $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
    FileWrite($file, $oReceived)
    FileClose($file)
#ce

now  answer me  with 500 error

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><GetSessionIDResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>Tue May 10 2016 16:08:01 GMT-0700 (GMT-07:00)</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Service unavailable.</ShortMessage><LongMessage>Service unavailable.</LongMessage><ErrorCode>99.99</ErrorCode><SeverityCode>Error</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><CallName>GetSessionID</CallName><ResponseCode>null</ResponseCode><ContentType>null</ContentType><Build>UNSET</Build><Version>653</Version></GetSessionIDResponse></soapenv:Body></soapenv:Envelope>

 

 

Share this post


Link to post
Share on other sites

It worked fine with my ID!
Good luck:

Local $RuName = "Your-RuName"
Local $DevID = "Your-DEV-ID"
Local $AppID = "Your-AP-IP"
Local $CerID = "Your-CER-ID"

;~ HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36")

Local $sData = '<?xml version="1.0" encoding="UTF-8" ?>'
$sData &= '<GetSessionIDRequest xmlns="urn:ebay:apis:eBLBaseComponents">'
$sData &= '  <RuName>' & $RuName & '</RuName>'
$sData &= '</GetSessionIDRequest>'

; Creating the object
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") ;Microsoft.XMLHTTP
$oHTTP.Open("POST", "https://api.sandbox.ebay.com/ws/api.dll", False)
;~  $oHTTP.Open("POST", "http://open.api.sandbox.ebay.com/shopping?", False)
$oHTTP.SetRequestHeader("Content-Type", "text/xml; charset=UTF-8")
$oHTTP.SetRequestHeader("X-EBAY-API-COMPATIBILITY-LEVEL", "931")
$oHTTP.SetRequestHeader("X-EBAY-API-VERSION", "963")
$oHTTP.SetRequestHeader("X-EBAY-API-DEV-NAME", $DevID)
$oHTTP.SetRequestHeader("X-EBAY-API-APP-NAME", $AppID)
;~ $oHTTP.SetRequestHeader("X-EBAY-API-APP-ID", $AppID)
$oHTTP.SetRequestHeader("X-EBAY-API-CERT-NAME", $CerID)
;~ $oHTTP.SetRequestHeader("X-EBAY-API-SITE-ID", "0")
$oHTTP.SetRequestHeader("X-EBAY-API-SITEID", "0")
$oHTTP.SetRequestHeader("X-EBAY-API-CALL-NAME", "GetSessionID")
$oHTTP.SetRequestHeader("X-EBAY-API-REQUEST-ENCODING", "XML")

; Performing the Request
$oHTTP.Send($sData)

; Download the body response if any, and get the server status response code.
Local $oReceived = $oHTTP.ResponseText
Local $oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 Then ConsoleWrite("!Response  Code:   " & $oStatusCode & @CRLF)
ConsoleWrite($oReceived & @CRLF)

 


Regards,
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now