Hi everyone,
This is my first time to use this site and also to use infopath and also with sharepoint.
I have an infopath form, which has managed codes in it(VBScript). In this code, i added a web reference, pointing to a custom created web service that can access the AD. Then i used this web service in my code, declared it, and used it to reference and get the values offered by this web service.
I created the web service using VS, and published it in my local pc, then referenced that local link to the Infopath form (which has full trust at that time) and it worked.
Then I ported it to the test environment sharepoint website.
Webservice is placed to a IIS website(same domain and even same place where the sharepoint website is located).
Infopath form is published with security level set to 'Automatically determine security level' to the sharepoint website, and changed the link of the web service from local to the new location produced from the IIS server.
But running the form on sharepoint produced me this error:
System.Security.SecurityException
Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
at System.Net.HttpRequestCreator.Create(Uri Uri)
at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
at System.Net.WebRequest.Create(Uri requestUri)
at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ADProfileService.AdWebServices.GetUser(String strUserName)
at EOD_Summary.FormCode.sendMail()
at EOD_Summary.FormCode.bSendReport_Clicked(Object sender, ClickedEventArgs e)
at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
*what was the form doing:
1. trying to access the Webservice by feeding it the CN/accountname (ID number in our case) and returning the displayname property
*issue(s) to consider
1. forms should not be full trust when published in sharepoint.
--some of my colleagues here suggested to use the connection library(website connection center) and create UDC, but I noticed that using a UDC will only reference a method(only one at a time) of the webservice. But what i need is all the methods from the webservice, so does it mean i have to create for each method a UDC?
My Question now is...
What is the best way to impliment the solution in the said problem? Or what settings should I do on the server to enable the webservice for infopath use?
Your help will be much appreciated!