开发者

MOSS 2007 404 error when accessing Lists.asmx webservice

Currently I have an ASP.net 4.0 app in which I've made a web reference to an MOSS 2007 server. When I access any lists.asmx methods from the root application, everything works fine. However, if I try to change the service URL in C# code-behind to that of a subfolders list.asmx, then access the any method, I get a 404 error. The really strange thing though is if I take the URL that I've changed it to and plug it manually into IE and run it, the service loads fi开发者_开发问答ne (giving me a list of any methods available as expected.)

Here's a rundown of my code that I'm using:

This works:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 // No change to URL, defaults to 'http://mosstest/SiteDirectory/RootApp/SubApp/_vti_bin/lists.asmx'
 XmlNode listColl = m_listService.GetListCollection();  // Works fine, gives me collection of lists in the root folder.

This doesn't work:

 ListsService.Lists m_listService = 
 ICredentials m_credentials = CredentialCache.DefaultCredentials;
 m_listService.Credentials = m_credentials;
 m_listService.Url = "http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx";
 XmlNode listColl = m_listService.GetListCollection();  // Throws a 404 Not found error.

Anyone else run into something similar?


Turns out I was trying to access a List itself, which in turn was not an application. I'm learning this headfirst. I will note however that SP seems to not give a 404 error when accessing via the browser, regardless of the URL. If I type in something like "http://mosstest/SiteDirectory/RootApp/SubApp/Subfolder1/_vti_bin/lists.asmx", with SubFolder1 not existing, it still gives a list of methods "available" and runs as if a service was indeed there. Not sure why it does this, but it does cause a great deal of confusion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜