Hello.
I use a web service to qery the AD to get the givenname and the surname of the preson hwo opens the form. The form is published on sharepoint. When someone wants to fill a form, he goes on sharepoint, on the form library and clicks on "fill this form". I want that the givenname and the surname of theperson that opens the form to be completed on load.
So in my infopath project made in vs 2005 with c# i added a web reference to the web service. This reference is named SP2007.
The web service contains two web methods
string GetSurname(string userName){}
string GetGivenName(string userName){}
And then i add a on_load event, end write code to complete the textboxes with the strings returned by methods:
public void OnLoad(DocReturnEvent e){
// Write your code here.string userName = System.Environment.UserName;sp2007.Service serviciu= new sp2007.Service();string nume = serviciu.GetNume(userName);
void OnLoad(DocReturnEvent e){
// Write your code here.string userName = System.Environment.UserName;sp2007.Service serviciu= new sp2007.Service();string nume = serviciu.GetNume(userName);
// Write your code here.string userName = System.Environment.UserName;sp2007.Service serviciu= new sp2007.Service();string nume = serviciu.GetNume(userName);
string userName = System.Environment.UserName;sp2007.Service serviciu= new sp2007.Service();string nume = serviciu.GetNume(userName);
Service serviciu= new sp2007.Service();string nume = serviciu.GetNume(userName);
string nume = serviciu.GetNume(userName);thisXDocument.DOM.selectSingleNode("/my:myFields/my:nume").text =serviciu.GetSurname(userName);thisXDocument.DOM.selectSingleNode("/my:myFields/my:prenume").text = serviciu.GetGivenname(userName);
"/my:myFields/my:nume").text =serviciu.GetSurname(userName);thisXDocument.DOM.selectSingleNode("/my:myFields/my:prenume").text = serviciu.GetGivenname(userName);
"/my:myFields/my:prenume").text = serviciu.GetGivenname(userName);}
ok
that is all my code.
I am not using any data connections. I am not using WebServiceAdapter2 or anything like that. is it a problem? Should have i use these?
The thing is when i run the form from within vs2005 all works fine. After i published on sharepoint the web service doesn't work.
I get this:
System.Security.SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 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 CerereInvoire.sp2007.Service.GetNume(String userName) at CerereInvoire.CerereInvoire.OnLoad(DocReturnEvent e) The action that failed was: Demand The type of the first permission that failed was: System.Net.WebPermission The Zone of the assembly that failed was: Intranet
Please help me a little. i am stuck.
Basescu