Answered by:
Store a SOAP message POSTed to my ASP url

Question
-
User297976670 posted
I am trying to receive ebay api transaction notifications into an ASP hosted on my web server. The notifications are sent as SOAP messages and are sent (POST) to a URL with a query string. Notifications must be responded to with HTTP 200 OK. I would like the notification to land inside a variable so that I can parse it and send it on to the next part of the system.
In the documentation they mention that this is possible, but the sample they give goes the route of subscribing to an email server. This ASP would not necessarily need to make SOAP requests, just accept SOAP messages from the ebay servers.
I have simple test ASP files executing on my server, I just cant figure out how to store a SOAP message that is sent to a static URL.
I am studying ASP, SOAP, and query strings, but a little guidance would be truly appreciated. Thanks!
Friday, May 13, 2016 4:05 PM
Answers
-
User1559292362 posted
Hi junkomatic,
The SOAP by design is done by 'post', so it should be fairly easy to call into an ASP vb script. Is there a name or some sort of ID that I can call using Request.Form()? Im looking but I dont see anything familiar I can call.According to your description, it seems that you could use asp to retrieve the soap message by using 'Post' method, and you want to assgin the response result to a vairable, doest it? if it's the case, it seems that you could use WebReuqest and WebResponse method to achieve it. like below.
// Create a request using a URL that can receive a post. WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx "); // Set the Method property of the request to POST. request.Method = "POST"; // Create POST data and convert it to a byte array. string postData = "This is a test that posts this string to a Web server."; byte[] byteArray = Encoding.UTF8.GetBytes (postData); // Set the ContentType property of the WebRequest. request.ContentType = "application/x-www-form-urlencoded"; // Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length; // Get the request stream. Stream dataStream = request.GetRequestStream (); // Write the data to the request stream. dataStream.Write (byteArray, 0, byteArray.Length); // Close the Stream object. dataStream.Close (); // Get the response. WebResponse response = request.GetResponse (); // Display the status. Console.WriteLine (((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream (); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader (dataStream); // Read the content. string responseFromServer = reader.ReadToEnd (); // Display the content. Console.WriteLine (responseFromServer); // Clean up the streams. reader.Close (); dataStream.Close (); response.Close ();
For more information, please refer to:
https://msdn.microsoft.com/en-us/library/debx8sh9%28v=vs.110%29.aspx
If i misunderstand your issue, please let me know.
Best regards,
Cole Wu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 17, 2016 2:08 PM
All replies
-
User297976670 posted
The SOAP by design is done by 'post', so it should be fairly easy to call into an ASP vb script. Is there a name or some sort of ID that I can call using Request.Form()? Im looking but I dont see anything familiar I can call.
Friday, May 13, 2016 6:56 PM -
User1559292362 posted
Hi junkomatic,
The SOAP by design is done by 'post', so it should be fairly easy to call into an ASP vb script. Is there a name or some sort of ID that I can call using Request.Form()? Im looking but I dont see anything familiar I can call.According to your description, it seems that you could use asp to retrieve the soap message by using 'Post' method, and you want to assgin the response result to a vairable, doest it? if it's the case, it seems that you could use WebReuqest and WebResponse method to achieve it. like below.
// Create a request using a URL that can receive a post. WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx "); // Set the Method property of the request to POST. request.Method = "POST"; // Create POST data and convert it to a byte array. string postData = "This is a test that posts this string to a Web server."; byte[] byteArray = Encoding.UTF8.GetBytes (postData); // Set the ContentType property of the WebRequest. request.ContentType = "application/x-www-form-urlencoded"; // Set the ContentLength property of the WebRequest. request.ContentLength = byteArray.Length; // Get the request stream. Stream dataStream = request.GetRequestStream (); // Write the data to the request stream. dataStream.Write (byteArray, 0, byteArray.Length); // Close the Stream object. dataStream.Close (); // Get the response. WebResponse response = request.GetResponse (); // Display the status. Console.WriteLine (((HttpWebResponse)response).StatusDescription); // Get the stream containing content returned by the server. dataStream = response.GetResponseStream (); // Open the stream using a StreamReader for easy access. StreamReader reader = new StreamReader (dataStream); // Read the content. string responseFromServer = reader.ReadToEnd (); // Display the content. Console.WriteLine (responseFromServer); // Clean up the streams. reader.Close (); dataStream.Close (); response.Close ();
For more information, please refer to:
https://msdn.microsoft.com/en-us/library/debx8sh9%28v=vs.110%29.aspx
If i misunderstand your issue, please let me know.
Best regards,
Cole Wu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, May 17, 2016 2:08 PM