<%
Dim itemId
' Use some active auction's Id
' (for example, one of the Guldkorn
' auctions from the Tradera.com mainpage)
itemId = 0
Dim httpRequest
Set httpRequest = CreateObject("MSXML2.XMLHTTP")
'Create the SOAP Envelope, check the example page for each method
' (for instance https://api.tradera.com/v3/PublicService.asmx?op=GetItem)
Dim soapEnvelope
soapEnvelope = _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
" <soap:Body>" & _
" <GetItem xmlns=""https://api.tradera.com"">" & _
" <itemId>" & itemId & "</itemId>" & _
" </GetItem>" & _
" </soap:Body>" & _
"</soap:Envelope>"
Dim applicationId, applicationKey
' This should be your application Id
applicationId = yourApplicationId
' This should be your application key
applicationKey = "yourApplicationKey"
httpRequest.Open "POST", "https://api.tradera.com/v3/PublicService.asmx?appId=" & applicationId & "&appKey=" & applicationKey, False
httpRequest.SetRequestHeader "Content-Type", "text/xml"
' Set a header for the method to be called
httpRequest.SetRequestHeader "SOAPAction", "https://api.tradera.com/GetItem"
' Make the SOAP call
httpRequest.send soapEnvelope
If httpRequest.Status = 200 Then
' Create XML document from response
Dim xmlDoc
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.load(httpRequest.responseBody)
' Select the long description into an XML node
Dim longDescriptionNode
Set longDescriptionNode = xmlDoc.selectSingleNode("//LongDescription")
' Write out the long description
Response.Write "<h1>Long description for item #" & itemId & "</h1><pre>" & longDescriptionNode.Text & "</pre>"
Else
Response.Write "<h1>Status</h1><p>" & httpRequest.Status & " (" & httpRequest.StatusText & ")</p>"
End If
%>
|