webrequest - How to post XML document to HTTP with VB.Net -
i'm looking posting xml document url in vb.net. here's have far ...
public shared xml new system.xml.xmldocument() public shared sub main() dim root xmlelement root = xml.createelement("root") xml.appendchild(root) dim username xmlelement username = xml.createelement("username") username.innertext = _username root.appendchild(username) xml.save(console.out) dim url = "https://mydomain.com" dim req webrequest = webrequest.create(url) req.method = "post" req.contenttype = "application/xml" req.headers.add("custom: api_method") console.writeline(req.headers.tostring())
this things go awry:
i want post xml, , print results console.
dim newstream stream = req.getrequeststream() xml.save(newstream) dim response webresponse = req.getresponse() console.writeline(response.tostring()) end sub
this after:
xml.save(req.getrequeststream())
Comments
Post a Comment