Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Error using List web service

  Asked By: Kendall Lindsey         Date: Jan 04, 2010      Category: Sharepoint      Views: 217
 

In my web part, I have the following code to access a remote web service
list.asmx:
MyWebReference.ListsmyList =newMyWebReference.Lists();
myList.Credentials
=newSystem.Net.NetworkCredential("theUser","passwd","myDomain");
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
credential("theUser","passwd","myDomain").

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

What weng wrong?

Tagged:          

 

3 Answers Found

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

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, 2010       

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, 2010       

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.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].