locked
Problem with external Webservice RRS feed

  • Question

  • Hello, did a Webservice that calls a function in SQL, if Webservice run by the local web server, brings me data without problem, but if I run on the CRM Web server , the function does not return anything, I read that for security reasons, CRM no returns  data when making consultations, is it is true? as I solve my problem, thanks
    PS: I attach the code of Webservice.
     
     

    Code Block

    Imports System.Web

    Imports System.Web.Services

    Imports System.Web.Services.Protocols

    <WebService(Namespace:="http://tempuri.org/")> _

    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

    Public Class Service

    Inherits System.Web.Services.WebService

    <WebMethod()> _

    Public Function CRM_GetMainNode(ByVal sID As String) As String

    Dim cn As New ADODB.Connection()

    Dim rs As New ADODB.Recordset()

    Dim cnStr As String

    Dim sRes As String

    Dim cmd As New ADODB.Command()

    cnStr = "Provider=SQLOLEDB;Server=SVRCRM1D;Database=BDD_Desarrollo_MSCRM;Integrated Security=sspi"

    cn.ConnectionString = cnStr

    cn.Open(cnStr)

    rs = cn.Execute("SELECT [BDD_Desarrollo_MSCRM].[dbo].[GetTreeNodeLevel] ('" + sID + "')")

    sRes = rs.Fields(0).Value.ToString()

    rs.Close()

    cn.Close()

    rs = Nothing

    cn = Nothing

    Return sRes

    End Function

    End Class

     

     

    Atte.

    Manuel Arriagada

    Saturday, October 20, 2007 8:58 PM

Answers

  • You should use NT impersonation, using the following in web.config

     

    <configuration>
     <system.web>
      <authentication mode="Windows" />
      <identity impersonate="true" />
     </system.web>
    </configuration>

     

    • Marked as answer by Jim Glass Jr Tuesday, November 3, 2009 4:24 PM
    Monday, October 22, 2007 6:30 PM
    Moderator

All replies

  • The issue is probably the user account under which the code runs. If your view GetTreeNodeLevel references one or more filtered views, they will only return data if the code is running under the security context of a CRM user

     

    Sunday, October 21, 2007 6:56 PM
    Moderator
  • Review roles and permissions, the function has now permits "ReportingGroup", "SQLAccessGroup", "NT AUTHORITY \ NETWORK SERVICE" and finally porve adding user "guest", all licensed to run and does not return data, I do Select on any table (in the Webservice) and the result is the same.
    Should have a special configuration IIS, which runs my WebService?
    Monday, October 22, 2007 12:57 PM
  • You should use NT impersonation, using the following in web.config

     

    <configuration>
     <system.web>
      <authentication mode="Windows" />
      <identity impersonate="true" />
     </system.web>
    </configuration>

     

    • Marked as answer by Jim Glass Jr Tuesday, November 3, 2009 4:24 PM
    Monday, October 22, 2007 6:30 PM
    Moderator
  •  DavidJennaway wrote:

    You should use NT impersonation, using the following in web.config

     

    <configuration>
     <system.web>
      <authentication mode="Windows" />
      <identity impersonate="true" />
     </system.web>
    </configuration>

     

     

    this code already exist in my "Web.Config"

     

    I run the "webservice" calling another database (ESCRIBESAMPLE) and works, apparently security CRM, can not return data to querys.
    I still testing alternatives
    Monday, October 22, 2007 9:11 PM