N
needin4mation
Hi, I have a simple web service. In my HelloWorld() all it does it
retreive about five last and first names from a database. It then
returns the DataSet.
When I run the Web Service in VS 2003 and I get the general IIS web
service page I press "Invoke" and the web service runs and brings back
what looks like a schema and an XML page.
I also have a consumer. But when I run it I get that tags don't match
when I attempt to use the XmlTextReader.read().
I took the XML data out of the web service and cleaned it up (it had
diffgr, etc. in it) and ran my consumer against the same data in file
form and it worked.
Here is my question:
When I run the web service it brings back more than just the XML data
from the database. Was I supposed to do something besided just using
XmlTextReader to parse the web service page?
Here is my consumer:
string table = null;
string last_name = null;
string first_name = null;
StringBuilder sb = new StringBuilder();
try
{
sb.Append("<ul>");
XmlTextReader reader = new
XmlTextReader("http://localhost/myWebService/employeeInfo.asmx");
//XmlTextReader reader = new
XmlTextReader(Server.MapPath("./test.xml"));
reader.MoveToContent();
while (reader.Read())
{
if (reader.Name == "Table" && reader.NodeType ==
XmlNodeType.Element)
{
sb.Append("<li>");
}
if (reader.Name == "last_name")
{
last_name = reader.ReadString();
}
if (reader.Name == "first_name")
{
first_name = reader.ReadString();
}
if (reader.Name == "Table" && reader.NodeType ==
XmlNodeType.EndElement)
{
sb.Append("Last: " + last_name + ", " + "First: " + first_name);
sb.Append("<BR>");
sb.Append("</li>");
}
}
sb.Append("</ul>");
Label1.Text = sb.ToString();
reader.Close();
Thank you for any help.
retreive about five last and first names from a database. It then
returns the DataSet.
When I run the Web Service in VS 2003 and I get the general IIS web
service page I press "Invoke" and the web service runs and brings back
what looks like a schema and an XML page.
I also have a consumer. But when I run it I get that tags don't match
when I attempt to use the XmlTextReader.read().
I took the XML data out of the web service and cleaned it up (it had
diffgr, etc. in it) and ran my consumer against the same data in file
form and it worked.
Here is my question:
When I run the web service it brings back more than just the XML data
from the database. Was I supposed to do something besided just using
XmlTextReader to parse the web service page?
Here is my consumer:
string table = null;
string last_name = null;
string first_name = null;
StringBuilder sb = new StringBuilder();
try
{
sb.Append("<ul>");
XmlTextReader reader = new
XmlTextReader("http://localhost/myWebService/employeeInfo.asmx");
//XmlTextReader reader = new
XmlTextReader(Server.MapPath("./test.xml"));
reader.MoveToContent();
while (reader.Read())
{
if (reader.Name == "Table" && reader.NodeType ==
XmlNodeType.Element)
{
sb.Append("<li>");
}
if (reader.Name == "last_name")
{
last_name = reader.ReadString();
}
if (reader.Name == "first_name")
{
first_name = reader.ReadString();
}
if (reader.Name == "Table" && reader.NodeType ==
XmlNodeType.EndElement)
{
sb.Append("Last: " + last_name + ", " + "First: " + first_name);
sb.Append("<BR>");
sb.Append("</li>");
}
}
sb.Append("</ul>");
Label1.Text = sb.ToString();
reader.Close();
Thank you for any help.