Security problem for accessing Web Service (which is created to access AD) - InfoPath Dev
in

InfoPath Dev

Security problem for accessing Web Service (which is created to access AD)

Last post 04-06-2008 05:26 AM by Cutejon. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-26-2008 03:52 AM

    • Cutejon
    • Not Ranked
      Male
    • Joined on 03-26-2008
    • Philippines
    • Posts 20

    Security problem for accessing Web Service (which is created to access AD)

    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!

  • 03-27-2008 08:54 AM In reply to

    Re: Security problem for accessing Web Service (which is created to access AD)

    Welcome to the forum.

     

    have you tried accessing the web service via data conenctions rather than directly in your code?

    For a browser based form you would need to convert to a UDC, this can be done with one button click as a data connection.

  • 03-28-2008 06:27 AM In reply to

    Re: Security problem for accessing Web Service (which is created to access AD)

    Hi Cutejon,

    The best way to solve this Problem is Give Read Permission to UR custom Webservice, which is hosted under the IIS.

    Right click on the Webservice folder(Where U ve published i.e. Under Virtual Dir)-->Propertie-->Security-->Add Everyone and Give Only Read Access.

    So that Everyone can access the Datasource, which ur Web service is producing.

    I believe this will work !

     

    Thanks & Regards,
    Srikrushna Patro.
  • 03-29-2008 01:20 AM In reply to

    • Cutejon
    • Not Ranked
      Male
    • Joined on 03-26-2008
    • Philippines
    • Posts 20

    Re: Security problem for accessing Web Service (which is created to access AD)

    Hi Clay,

    Thank you for your reply.

     btw, my form is client based, not browser based.

    I have tried programming via UDC, and placing it as a data connection (under manage data connections of infopath)..then code wise, i have instanciated this object via the use of :

     Dim secondaryDataSource As DataSource = DataSources.Item(<name of datasource>)

     unfortunately, even if i set the values of the arguments ( e.g. GetUser(<ID Number>, <property>), the ID number & property), the return values are not given back to me.

     so how do send it back to the server to give back to me the values i need.

     I looked for the equivalent VBscript version, but to no avail.

     Thanks again.

  • 03-29-2008 01:40 AM In reply to

    • Cutejon
    • Not Ranked
      Male
    • Joined on 03-26-2008
    • Philippines
    • Posts 20

    Re: Security problem for accessing Web Service (which is created to access AD)

    Hi srikrushna,

    Thank you for your feedback. I had it tried immediately after reading your reply.

    Unfortunately, after trying your suggested option, and after publishing again my form in the sharepoint site, it didn't work.

     Btw, we changed it under the Option:

    Right click on the folder

    clicked permissions

    then security

    then added everyone and gave them read only access.

    Propertie-->Security-->Add Everyone and Give Only Read Access. <- path does not exists.

    What am i doing wrong? hope you can give me feedback on this. thanks.

     

     

  • 04-01-2008 01:02 AM In reply to

    Re: Security problem for accessing Web Service (which is created to access AD)

    Hi Cutejon,

    I wanted to know, whether your Security level of Infopath(Published) from is Domain of Full Trust Level.

    If it is Domain or "Automaticall detect trust level" , make it Full Trust Level and publish the Same.

    Believe,it will work.

    Thanks

     

    Thanks & Regards,
    Srikrushna Patro.
  • 04-06-2008 05:26 AM In reply to

    • Cutejon
    • Not Ranked
      Male
    • Joined on 03-26-2008
    • Philippines
    • Posts 20

    Re: Security problem for accessing Web Service (which is created to access AD)

    srikrushna,

     

    Yup, making the form full trust did the trick. It worked!

    But if you find any other way of making it work without making it full trust that would be better.

     Coz, making the form full trust means, extra work such as deploying certificates on different PCs.

     But for now, because Im having it deployed on production, full trust will have to do.

     

    Thanks again!

Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.