1

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>
2
  • what is the error that is thrown from getNewsFromInsite?
    – djeeg
    Commented Jan 12, 2011 at 16:28
  • the above issue is occurring due to of authentication! Commented Jan 12, 2011 at 18:21

2 Answers 2

2

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.

1
  • Very Intelligent of you! I managed to step into the WS itself, which solved the issue. Thanks for the pointer! Commented Jan 14, 2011 at 14:12
0

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.

4
  • 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. Commented Jan 12, 2011 at 16:26
  • can you run two farms on the same server? do you have an links that show how to do this?
    – djeeg
    Commented Jan 12, 2011 at 16:30
  • Yes, through virtualization.
    – SPDoctor
    Commented Jan 12, 2011 at 18:39
  • @SPDoctor, its an authentication issue! Commented Jan 12, 2011 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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