Problem with loadXML and web services

G

Guest

Hi everyone,

I'm trying to access a webservice (asmx) from an asp page and I'm having a
problem with the load below:

<%

Dim dblTax, strQuery, objRequest, objXMLDoc, strXMLwsURL, strXMLMessage



Set objRequest = Server.CreateObject("Microsoft.XMLHTTP")
Set objXMLDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")


objXMLDoc.Async = False
strXMLwsURL = "http://localhost/asptest/OBWebSvc.asmx/GetDocGroups"
objRequest.Open "post", strXMLwsURL, False

objRequest.Send()


objXMLDoc.Load(objRequest.responseXML)

response.write objXMLDoc.ParseError.reason

%>

I get the error message 'XML document must have a top level element. '

The called webservice method(C#) returns data of class 'ArrayList'. When I
change the method return to a string ("i.e. Hello") it loads fine. Now I
access the webservice in VS.net using return val of 'ArrayList' and it also
works fine. It just doesn't work in the asp page. Heres a portion of my
asmx.cs file:

[WebMethod(Description="Retrieves an array of doctype groups")]
public string GetDocGroups()
public ArrayList GetDocGroups()
{


OBInterface ob = new OBInterface();
// return ob.GetDocGroupList(dsn, loginName, passWord);
return ob.GetDocGroupList();
// return "HELLO";


Any help would be much appreciated.

Dave
 
N

Nicholas Paldino [.NET/C# MVP]

Dave,

If you use the HttpWebRequest class to issue the request (with the POST,
and the empty content), what is returned? Is it an error? What is the
return code?
 
G

Guest

I'm not sure what you mean or how to do that in an asp page. In doing this
would I still be able to parse the xml (i.e. selectNodes) after I get the
reponse?

Thanks,
Dave

Nicholas Paldino said:
Dave,

If you use the HttpWebRequest class to issue the request (with the POST,
and the empty content), what is returned? Is it an error? What is the
return code?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dave H said:
Hi everyone,

I'm trying to access a webservice (asmx) from an asp page and I'm having a
problem with the load below:

<%

Dim dblTax, strQuery, objRequest, objXMLDoc, strXMLwsURL, strXMLMessage



Set objRequest = Server.CreateObject("Microsoft.XMLHTTP")
Set objXMLDoc = Server.CreateObject("MSXML2.DOMDocument.4.0")


objXMLDoc.Async = False
strXMLwsURL = "http://localhost/asptest/OBWebSvc.asmx/GetDocGroups"
objRequest.Open "post", strXMLwsURL, False

objRequest.Send()


objXMLDoc.Load(objRequest.responseXML)

response.write objXMLDoc.ParseError.reason

%>

I get the error message 'XML document must have a top level element. '

The called webservice method(C#) returns data of class 'ArrayList'. When I
change the method return to a string ("i.e. Hello") it loads fine. Now I
access the webservice in VS.net using return val of 'ArrayList' and it also
works fine. It just doesn't work in the asp page. Heres a portion of my
asmx.cs file:

[WebMethod(Description="Retrieves an array of doctype groups")]
public string GetDocGroups()
public ArrayList GetDocGroups()
{


OBInterface ob = new OBInterface();
// return ob.GetDocGroupList(dsn, loginName, passWord);
return ob.GetDocGroupList();
// return "HELLO";


Any help would be much appreciated.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top