ASMX (OOTB SharePoint Web Service) reference in Custom web part
-
Dienstag, 1. Mai 2012 16:16
I have created a web part that consumes socialdataservice.asmx. For this I created a web reference to socialdataservice.asmx and creatd a proxy "socialservice".
In the code;
socialservice.SocialDataService proxy = new socialservice.SocialDataService();
proxy.PreAuthenticate = true;
proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
socialservice.SocialTermDetail[] tagDetails = proxy.GetTagTermsOnUrl(webURL, 50);
string[] users = new string[100];This code is working fine in my DEV but when I moved this to QA - Its causing the following exception
"Server was unable to process request"
how to resolve this?
Thanks
Alle Antworten
-
Dienstag, 1. Mai 2012 16:22
could you provide logs from ULS for this error ? are you sure that you have the right permissions ?
-
Dienstag, 1. Mai 2012 16:51
My reference.cs file contains the following code where the url points to server:6000 root site collection
public SocialDataService() {
this.Url = "http://server:6000/_vti_bin/socialdataservice.asmx";
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}I was wondering how to make it generic that will help us to point to the dite collection where the web part is installed?
-
Dienstag, 1. Mai 2012 16:56
Ya normally in your code along with PreAuthenticate and Credentials, you'd set the Url property to the path to the asmx file, something like SPContext.Current.Web.Url + "/_vti_bin/socialdataservice.asmx";
Please mark my response as an answer if appropriate.
Learn.SharePoint.com- Als Antwort markiert Daniel YangMicrosoft Contingent Staff, Moderator Mittwoch, 9. Mai 2012 09:28

