Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

reading a xml file and sending to web service call and read response

Access 365 vba
I have a xml file i need to send to a service call and get a response back.
Dim myHTTP As New MSXML2.XMLHTTP30
Set myHTTP = CreateObject("msxml2.xmlhttp")
'create dom document variable
'stores the xml to send
Dim myDom As New MSXML2.DOMDocument30
'Create the DomDocument Object
Set myDom = CreateObject("MSXML2.DOMDocument")
'Load entire Document before moving on
myDom.async = False
'xml string variable
'replace with location if sending from file or URL
myDom.Load ("C:\Users\br1d\OneDriveinc\Desktop\RedBook Escalation\Skusubmission.xml")
 
'loads the xml
'change to .Load for file or url
myDom.Load (myDom.XML)
'open the connection
myHTTP.Open "POST", "https://xxxx01.dev-sap.gr.com:41111/sap/commerce/esrprice?sap-client=220", False, "xxxxx", "xxxxx"", False"
'send the XML
myHTTP.Send (myDom.XML)
'Display the response
MsgBox myHTTP.responseText

Open in new window


cant seem to get the xml document to load correctly.
Thanks
fordraiders
Avatar of HainKurt
HainKurt
Flag of Canada image

what's the error message?
which line fails?
Avatar of Fordraiders

ASKER

myDom.Load ("C:\Users\br1d\OneDriveinc\Desktop\RedBook Escalation\Skusubmission.xml")
it does not load the xml file at all.

Avatar of John Tsioumpris
If you put the "C:\Users\br1d\OneDriveinc\Desktop\RedBook Escalation\Skusubmission.xml "
in the explorer's address bar does it shows the Xml ?
is the path correct?
whats the exact error message?

also can you use XML 6.0

Dim myDom As MSXML2.DOMDocument60        ' declare the xml doc object
Set myDom = New MSXML2.DOMDocument60     ' set an instance of it to memory

Open in new window


ASKER CERTIFIED SOLUTION
Avatar of Fabrice Lambert
Fabrice Lambert
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial