Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Error using List web service

  Asked By: Kendall    Date: Jan 04    Category: Sharepoint    Views: 1139

In my web part, I have the following code to access a remote web service
MyWebReference.ListsmyList =newMyWebReference.Lists();
llnlList.Url ="https://remoteServer/_vti_bin/lists.asmx";
XmlNodelistCollection =myList.GetListCollection();

The last line alwaysthrowsan exception:The remote name could not be resolved.

I can accesshttps://remoteServer/_vti_bin/lists.asmxperfectly using the

I believe that the same error will occur for me using any other web service.

What weng wrong?



3 Answers Found

Answer #1    Answered By: Fidel Crane     Answered On: Jan 04

It looks like we're missing some of the relevant code  here. For
example, I don't see anything about the history of "llnlList". Could you
provide a larger sample?

Answer #2    Answered By: Akshara Sanghavi     Answered On: Jan 04

First I apologize that I've overlooked your kind response. I thought there was
no response from anyone and had moved on to using other list  methods.

The code  should read:
MyWebReference.Lists myList =newMyWebReference.Lists();
myList.Credentials =newSystem.Net. NetworkCredentia l("theUser" ,"passwd"
,"myDomain" );
myList.Url ="https://remoteServe r/_vti_bin/ lists.asmx";
XmlNode listCollection =myList.GetListColl ection();

I finally gave up and used the following code instead:

SPWeb myWeb = SPControl.GetContextWeb(Context);

SPList myList = myWeb.Lists["listName"];

Answer #3    Answered By: Aishwarya Dixit     Answered On: Jan 04

No problem; thanks for the follow-up. The new way is much more concise
and should serve you well as long as your code  is on the SharePoint server.

Didn't find what you were looking for? Find more on Error using List web service Or get search suggestion and latest updates.