how to POST data to server

irade92

Registered User.
Local time
Today, 10:10
Joined
Dec 26, 2010
Messages
229
Hi
I am making an application in Access 2010

This is the XML file I have to post.:

Post Request Example
<?xml version="1.0" encoding="UTF-8"?>
<prescription>
<prescription_code>WE45927</prescription_code>
<exempt_from_participation>true</exempt_from_participation>
<pharmacist_facsimile>999999</pharmacist_facsimile>
<drug_fund_code>979376</drug_fund_code>
<quantity/>
</prescription>

and this is the response I should receive:

Response example
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>OK</status>
<message>Prescription successfully realized</message>
<message_mk>Рецептот е успешно реализиран</message_mk>
<prescription_rank>4-Лекови ослободени од партиципација</prescription_rank>
</response>

and this is the url where to post:

https://api.zdravstvo.gov.mk/rest/prescriptions/realize


and this is my code that does not want to work:



Private Sub proba7()
Dim HttpReq As New MSXML2.XMLHTTP60
Dim xmldom As New MSXML2.DOMDocument

HttpReq.Open "POST", "https://api.zdravstvo.gov.mk/rest/prescriptions/realize", False
HttpReq.setRequestHeader "Content-Type", "application/xml"
xmltext = "c:\apteka\prescription.xml"
xmldom.loadXML xmltext
HttpReq.send



If HttpReq.status = 200 Then
MsgBox ("ok") ' HttpReq.responseXML.Save Response
Else
MsgBox ("not ok") ' Response.Write "Error: " & HttpReq.statusText
End If

'MsgBox HttpReq.responseXML
'Debug.Print HttReq.responseXML
End Sub


Please help. My headache is getting serious... Thanks a lot
 

Users who are viewing this thread

Back
Top Bottom