Options

Navision and .net Integration

anshpat2826anshpat2826 Member Posts: 44
edited 2010-01-27 in NAV Three Tier
Hello,
I worked on navision and net c#.
I already make project which is working fine on the same computer where navision is installed but while accessing
web service over network it shows error while Invoking method.
and error type is Inner Exception : 401 Not Authorized.
Any one can help me on this?
did i missed some thing about security ?
Himanshu Patel
Navision Consultant(Technical and Functional)
Phone No: 09979876474
Email : anshpat2826@gmail.com

Comments

  • Options
    cernstcernst Member Posts: 280
    Have you checked the firewall settings? You might need to add NAV (fin.exe) in the firewall.
    _____________________
    NAV Freelance Consultant
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    I checked firewall setting but still the same error..
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    cernstcernst Member Posts: 280
    It seems like you're missing to authenticate yourself, this is usaually done in the soap header.
    _____________________
    NAV Freelance Consultant
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    You are asking about crenditial.
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    Gabor_PestiGabor_Pesti Member, Microsoft Employee Posts: 7
    Hi,

    I am a bit confused: Someone recommended to add fin.exe (Client of the old stack) to the firewall, while the topic opener referred to Web Services, a functionality of the new 3 tier architecture. (Service executable is Microsoft.Dynamics.Nav.Server.exe - service name MicrosoftDynamicsNavWS by default). So if the root cause is some firewall rule then you should check the later has enough right.

    If the problem is in the .NET client (which I do not think so since on the same machine it worked fine) then by
    ws.UseDefaultCredentials = true;
    
    you can get it to forward the current credentials to the service.

    Where I would look for the issue is verifying whether there is some difference between the identity of the client running on the Local Machine or in the remote configuartion. Is it really the same user who tries to connect in the two case?

    Finally there might be some problem related to delegation settings: http://msdn.microsoft.com/en-us/library/ee414212.aspx
    Regards,

    Gabor Pesti

    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Software Developer Engineer in Test
    MSFT
    Dynamics NAV
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    No both are different user ...
    public NAVPageServiceHelper Get_Cust()
    {
    Assembly PageRef;
    PageRef = NAVPageDynamicWebReference.BuildAssemblyFromWSDL(new Uri("http://anshu-pc:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Page/Customer"), 200000);
    serviceHelper = new NAVPageServiceHelper(PageRef, "Customer");
    return serviceHelper;
    }
    this is uri when i am using my own computer and see this one

    public NAVPageServiceHelper Get_Cust()
    {
    Assembly PageRef;
    PageRef = NAVPageDynamicWebReference.BuildAssemblyFromWSDL(new Uri("http://IPon SERVER:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Page/Customer"), 200000);
    serviceHelper = new NAVPageServiceHelper(PageRef, "Customer");
    return serviceHelper;
    }
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    I can see you have a space in the server name in

    http://IPon SERVER:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Page/Customer

    Could that be the problem?
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    This is just test name
    actuallly there is no space .

    See i am explaining my problem ..
    Assembly PageRef;
    PageRef = NAVPageDynamicWebReference.BuildAssemblyFromWSDL(new Uri
    ("http://anshu-pc:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Page/Customer"), 200000);
    serviceHelper = new NAVPageServiceHelper(PageRef, "Customer");
    return serviceHelper;

    I modified the dynamicpagewebreferance:

    public static Assembly BuildAssemblyFromWSDL(Uri webServiceUri, int timeout)
    {
    ICredentials _Credntial = new System.Net.NetworkCredential("test", "xxxxx", "");
    //server credintial
    //ICredentials _Credntial = new System.Net.NetworkCredential("anshu", "anshu", "");
    if (String.IsNullOrEmpty(webServiceUri.ToString()))
    throw new Exception("Web Service Not Found");

    WebRequest request = WebRequest.Create(webServiceUri.ToString());
    request.Method = "GET";
    request.ContentType = "text/xml";
    request.Timeout = timeout;
    // request.UseDefaultCredentials = false;
    request.Credentials = _Credntial;
    WebResponse response = request.GetResponse();
    XmlTextReader xmlreader = new XmlTextReader(response.GetResponseStream());
    ServiceDescriptionImporter descriptionImporter = BuildServiceDescriptionImporter(xmlreader);
    return CompileAssembly(descriptionImporter);
    }

    I set credintial according to my computer now i changed :
    PageRef = NAVPageDynamicWebReference.BuildAssemblyFromWSDL(new Uri
    ("http://servername:7047/DynamicsNAV/WS/CRONUS_India_Ltd/Page/Customer"), 200000);

    Case 1.> still i did not changed my ID and Password so it will give error at (this is b cos i still did not set credintial as server PC)
    WebResponse response = request.GetResponse();

    Case 2 .> Now i change credintial as server ID and password then error occured while reading data from NAV. so from this i got my credintial are verified.

    public object[] ReadMultiple(ArrayList filterArrayList)
    {
    return (object[])this.readMultipleMethod.Invoke(this.service, new object[] { filterArrayList == null ? null : filterArrayList.ToArray(this.filterType), null, 100 });
    }
    Sir I dont have domain on my computer is it problem.
    I am daily accessing your blog its awesome thanks for helping...
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    The server is NOT part of a domain?

    ANS : Yes, Both Machine are working in separate work group, no domain

    You are trying to connect to a web service listener on that machine?

    ANS : YES

    Both SQL Server AND middle tier is on that server?

    ANS : YES

    You can see http://server:7047/DynamicsNAV/WS/SystemService on the server?

    ANS : YES, This services are visible but it requires windows authentication of machine where services are available.

    You are running 2009 RTM (NOT SP1)?

    ANS : YES, WE ARE WORKING ON 2009 RTM

    Have you tried specifying the server name as domain in new
    NetWorkCredential(user, pwd, domain)?

    ANS : WE ARE PASSING USER NAME AND PASSWORD, NOT DOMAIN
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    I also tried SERVER Computer name as domain parameter but i got same error
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    I can post my project zip file on mibuso if any one want send me message i will send link to download the project.
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
  • Options
    anshpat2826anshpat2826 Member Posts: 44
    Ok done
    Problem i am facing is solved.
    Thanks all who has posted reply and also those who visit the post.
    Any one need any kind of information i will provide.
    you can also pm to me regarding web service integration to java and c#.
    Himanshu Patel
    Navision Consultant(Technical and Functional)
    Phone No: 09979876474
    Email : anshpat2826@gmail.com
Sign In or Register to comment.