Advertisement

05.06.2004 at 09:14AM PDT, ID: 20980437
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

Using .Net to post xml to an ASP page, get a respone back in xml

Asked by keith_dude in Extensible Markup Language (XML), Extensible HTML (XHTML)

Tags: , ,

This is continued from another question:

http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20931704.html#11007196

I'm trying to post xml to an asp page, then a response to the .net page.  
--------------------------------------------------------------------------------------------------
My .NET page:

<%@ Page Language="VB" Debug = true%>
<%@ Import namespace="System.Xml" %>
<%@ Import namespace="System.Web" %>
<%@ Import namespace="System.IO" %>
<%@ Import namespace="System.Collections" %>
 <%@ Import namespace="System.Diagnostics" %>
<%@ Import namespace="System.Net" %>
<script runat="server">

    ' Insert page code here
    '

    Sub Button1_Click(sender As Object, e As EventArgs)
        ' Put user code to initialize the page here
                Dim xmlDoc As XmlDocument
                xmlDoc = New XmlDocument

                Dim result As String = ""
                Dim myWriter As StreamWriter
                Dim sURL = "https://npsonline.pti-nps.com/activate/activateservice1.asp"
                Dim sXML = "<?xml version='1.0' encoding='utf-8' ?><Root><groupnum>test</groupnum></Root>"
                Dim objRequest As HttpWebRequest = WebRequest.Create(sURL)
                objRequest.Method = "POST"
                objRequest.ContentLength = sXML.Length
                objRequest.ContentType = "application/x-www-form-urlencoded"

                Try
                    myWriter = New StreamWriter(objRequest.GetRequestStream())
                    myWriter.Write(sXML)
                    myWriter.Flush()
                    myWriter.Close()

                Catch e1 As Exception
                    Debug.Write(e1.Message)
                Finally

                End Try

                Dim objResponse As HttpWebResponse = objRequest.GetResponse()
                Dim sr As StreamReader
                sr = New StreamReader(objResponse.GetResponseStream())
                result = sr.ReadToEnd()
                sr.Close()
                xmlDoc.LoadXml(result)
                'Xml1.Document = xmlDoc


    End Sub
</script>

<html>
<head>
</head>
<body>
    <form runat="server">
        <asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="Button"></asp:Button>
        <!-- Insert content here -->
    </form>
</body>
</html>


The ASP page receiving it:

<% @Language="vbscript" %>
<%
     Response.ContentType = "Text/XML"
     Set req = server.CreateObject("MSXML.DOMDocument")
     req.async=false
      i = req.load(Request)
      if i then
          set mynode=req.SelectSingleNode("Root/groupnum")
          groupnum = myNode.Text
          set mynode=req.SelectSingleNode("Root/controlnum")
          controlnum = myNode.Text
          Response.Write("<?xml version='1.0' encoding='utf-8' ?> ")
          Response.Write("<Root>" & groupnum  &  " </Root>")
      else
     
                Response.Write("<?xml version='1.0' encoding='utf-8' ?> ")
         Response.Write("<Root>" & req.ParseError.Reason &  " </Root>")
     End if

%>


My error:  


Line 37:                 End Try
Line 38:
Line 39:                 Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Line 40:                 Dim sr As StreamReader
Line 41:                 sr = New StreamReader(objResponse.GetResponseStream())
 

Source File: C:\Inetpub\wwwroot\websvc\test.aspx    Line: 39

Stack Trace:


[WebException: The remote server returned an error: (500) Internal Server Error.]
   System.Net.HttpWebRequest.CheckFinalStatus() +674
   System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +139
   System.Net.HttpWebRequest.GetResponse() +149
   ASP.test_aspx.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\websvc\test.aspx:39
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1277
Start Free Trial
 
Loading Advertisement...
 
[+][-]05.06.2004 at 09:24AM PDT, ID: 11007447

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 11:35AM PDT, ID: 11008560

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 12:20PM PDT, ID: 11008941

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 12:24PM PDT, ID: 11008972

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 12:32PM PDT, ID: 11009030

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 12:35PM PDT, ID: 11009047

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 12:35PM PDT, ID: 11009053

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Extensible Markup Language (XML), Extensible HTML (XHTML)
Tags: xml, post, server
Sign Up Now!
Solution Provided By: dfiala13
Participating Experts: 3
Solution Grade: A
 
 
[+][-]05.06.2004 at 12:57PM PDT, ID: 11009250

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2004 at 01:20PM PDT, ID: 11009474

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.09.2004 at 07:02AM PST, ID: 12783834

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32