Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have deployed a custom SharePoint Web service on Farm A. I am trying to access this Web service from a SharePoint timer job on Farm B. On Farm B, I am creating Class Library project, packaging it (wsp) and then deploying to GAC. The problem is I'm unable to access the Web Service using the following code. TodaysNewSVC is a service reference

      TodaysNewSVC.GetTodaysnewsfromInsite objGetNews = new    TodaysNewSVC.GetTodaysnewsfromInsite();
      objGetNews.PreAuthenticate = true;
      objGetNews.Credentials = CredentialCache.DefaultCredentials;
      objGetNews.Url = "http://insite-dev.portal/_vti_bin/todaysnews.asmx";
      DataTable dt2 = objGetNews.getNewsFromInsite(true, true);

//getNewsFromInsite is a WebMethod which returns the DataTable.

Note: Both farms use the same active directory authentication. I have also done the debugging for Timer Job and feature activation and they are working fine. The problem occurs during the call i.e. getNewsFromInsite

The asmx and wsdl files are accessible from Internet Explorer and also from Windows Console application. Here is the code which I use from console application:

GetTodaysnewsfromInsiteSoapClient objWSClient = new GetTodaysnewsfromInsiteSoapClient();
objWSClient.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
objWSClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
DataTable dt = objWSClient.getNewsFromInsite(true, true);

Here is the error message:

The request failed with the error message:
--
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="%2fPages%2fproblem-with-page.aspx%3fc%3d500">here</a>.</h2>
</body></html>
share|improve this question
    
what is the error that is thrown from getNewsFromInsite? –  djeeg Jan 12 '11 at 16:28
    
the above issue is occurring due to of authentication! –  Falak Mahmood Jan 12 '11 at 18:21

2 Answers 2

up vote 2 down vote accepted

Sounds to me like the web service on Farm A is throwing some sort of internal error (based on the error message "problem-with-page.aspx?c=500")

Have you attached the debugger to the web service? Also, how is the redirect to the problem-with-page.aspx being implemented? This looks like a custom error handler.

share|improve this answer
    
Very Intelligent of you! I managed to step into the WS itself, which solved the issue. Thanks for the pointer! –  Falak Mahmood Jan 14 '11 at 14:12

Are both farms running on the same hardware? You may need to disable loopback check on your server to enable a web services call back into the same machine.

share|improve this answer
    
No, they are on different hardware. Although, I did add the Farm A's Web app and IP address into host file Located on Farm B. –  Falak Mahmood Jan 12 '11 at 16:26
    
can you run two farms on the same server? do you have an links that show how to do this? –  djeeg Jan 12 '11 at 16:30
    
Yes, through virtualization. –  SPDoctor Jan 12 '11 at 18:39
    
@SPDoctor, its an authentication issue! –  Falak Mahmood Jan 12 '11 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.