<p>DOING THE POST IS NOT THE PROBLEM!  Formatting the message so that I get a response is the problem.</p>

<p>Ideally I'd be able to construct a message and use WinHTTP to perform a post to a WCF service (hosted in IIS) and get a response, but so far I've been unable to construct something that works properly.</p>

<p>Does anyone have an example of doing this that is straightforward?</p>

<p>In the 2.0 Web Service world this was as easy as putting a setting in the web.config to get the service to respond to a post and then calling the appropriate web method with the right parameters.  There seems to be no analogue for this in the WCF world.</p>

<p>As of now there is no option for me to convert the consumer (the vbscript end) into .NET.</p>

<p>Assume at this point that at the endpoint I can convert to using whatever bindings are available right up to whatever is supported in .NET 3.5, but at the same time if this can be done using WsHttpBinding or BasicHttpBinding then the proper answer to this would be to describe how to format the message for either of those bindings in the context of VBScript or if there is no way to do that then just say, you can't do it.  If this can be done using WebHTTPBinding then I have not found a way to make it happen as I've already investigated the WebInvoke attribute and been unable to create a test from VBScript to WCF that worked properly.</p>

<p>Assume that the posted data type is a string and the response is also a string.</p>

<p>Also this question is not WinHTTP related.  I already know how to perform the post using WinHTTP it's the construction of the message that the WCF service will respond to that is the problem.</p>

<p>While I could use something other than WinHTTP to perform the post from ASP over to the WCF service such as XMLHTTP I still have the problem of constructing an XML message that the WCF service will respond to.  I've tried variations on this and still am unable to fathom what sort of format I need to use to make this happen.</p>

<p>I know theoretically that all the WCF service needs is a properly formatted message. I'm just unable to construct the message properly and usually while everyone has some suggestion on how to send the message I have yet to see someone give an actual example of what the proper message format would be in this situation since everyone is so used to using .NET to send the message and it's all done for you in that context.</p>

[{'answer_id': 77115, 'author': 'Spike', 'author_id': 13111, 'author_profile': 'https://Stackoverflow.com/users/13111', 'pm_score': 0, 'selected': False, 'text': '<p>I wote some code a while ago for an excel macro which reads a XML file, posts the contents to a URL then saves the result.</p>\n\n<pre><code>Sub ExportToHTTPPOST()\nDim sURL, sExtraParams\nConst ForReading = 1, ForWriting = 2, ForAppending = 3\n\nSet rs = CreateObject("Scripting.FileSystemObject")\nSet r = rs.OpenTextFile("y:\\test.xml", ForReading)\n\nSet Ws = CreateObject("Scripting.FileSystemObject")\nSet w = Ws.OpenTextFile("Y:\\test2.xml", ForWriting, True)\n\nDo Until r.AtEndOfStream\n\n    sData = sData &amp; r.readline\n\nLoop\n\nsURL = "http://MyServer/MyWebApp.asp"\n\nsData = "payload=" &amp; sData\n\n    Set objHTTP = New WinHttp.WinHttpRequest\n\n            objHTTP.Open "POST", sURL, False\n            objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"\n            objHTTP.send sData\n            w.writeline objHTTP.ResponseText\n    Set objHTTP = Nothing\n    w.Close\n    r.Close\nEnd Sub\n</code></pre>\n'}, {'answer_id': 78907, 'author': 'tomasr', 'author_id': 10292, 'author_profile': 'https://Stackoverflow.com/users/10292', 'pm_score': 2, 'selected': True, 'text': '<p>You don\'t specify one thing: What binding are you exposing your service as? If you\'re using WsHttpBinding or BasicHttpBinding, then there\'s no simple "http post" you can do, because you need to include at the very least the entire SOAP envelope (with the right SOAP version and potentially security headers and so forth).</p>\n\n<p>If you\'re using (or can migrate to) .NET 3.5, then there\'s a new binding explicitly created to support scenarios like this, where you want your service to be exposed not as a SOAP service but as fully REST-like service, or simply as XML/JSON over HTTP. It\'s called the WebHttpBinding.</p>\n\n<p>There are many options you can tweak, but it\'s very likely you might just be able to add a new endpoint with webHttpBinding and have that working almost right away.</p>\n\n<p>This might give you a head-start on the new programming model: <a href="http://msdn.microsoft.com/en-us/library/bb412169.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb412169.aspx</a></p>\n'}, {'answer_id': 95307, 'author': 'Skyhigh', 'author_id': 13387, 'author_profile': 'https://Stackoverflow.com/users/13387', 'pm_score': 1, 'selected': False, 'text': '<p>This is the simplest code I\'ve got for doing a background HTTP post in ASP</p>\n\n<pre><code>Set objXML = CreateObject("MSXML2.ServerXMLHTTP.6.0")\nobjXML.open "POST", url, false\nobjXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"\nobjXML.send("key="&amp; Server.URLEncode(xmlvalue))\nSet responseXML = objXML.responseXML\nSet objXML = nothing\n</code></pre>\n\n<p>This just requires that you have the MSXML objects installed on your server.  I use this for all kinds of things including an XML-RPC server/client in ASP.</p>\n\n<p>edit: Re-read your question and if you are set on that specific way then this won\'t help, but if you are really just looking for a way to access your webservice this would work as long as you construct your XML to post correctly.</p>\n'}]
['https://Stackoverflow.com/questions/76925', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10004/']