Web services with .net

KonanKonan Member Posts: 18
edited 2010-12-16 in NAV Three Tier
Good morning,
I have an application in Navision with .Net and web services , and I have a little problem.
If I'm connected to my office network works perfectly, but if I disconnect and run the program in my house for instance, does not work.
Should we create a reference to the Navision server?
I'm a bit lost if you could lend a hand to me, I would greatly appreciate it.

A greeting and thanks in advance

Comments

  • kinekine Member Posts: 12,562
    If you are running it from home, is your PC in the domain? The authentication could be the problem...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • KonanKonan Member Posts: 18
    Yes, the problem is the authentication,
    How I can fix it? How I can connect to the web service without being connected to the domain?
  • kinekine Member Posts: 12,562
    You need to set the correct identity when connecting to the webservices. In most demos you are using "DefaultIdentity". You need to change that.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • KonanKonan Member Posts: 18
    Thanks above all to answer.

    Do not quite understand what you mean, to connect to the webservice use the property "name." Credentials ("user", "pass", "domain")
    and the function "name." URL ("The address of webservices)

    What am I doing wrong?

    I just tried to run the network cable disconnected, and I do not work ... idk if this detail will do any good

    A greeting and thanks
  • EgnazEgnaz Member Posts: 111
    If you use Service References to connect to your webservice try the following:

    Example for the Customer Page:

    baseURL is the address to the webservice

    string customerPageURL = baseURL + Uri.EscapeDataString(cur) + "/Page/Customer";
    customerService = new Customer_PortClient(navWSBinding, new EndpointAddress(customerPageURL));
    customerService.ClientCredentials.Windows.ClientCredential = new NetworkCredential("User","Pwd","Domain");
    customerService.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

    Regards,
    egnaz
  • KonanKonan Member Posts: 18
    hello Egnaz,

    My question now is: Where should I enter the code you provided? Every time you connect to web services I have to enter that code?

    Thank you very much for your contribution.

    Greetings
  • EgnazEgnaz Member Posts: 111
    Hi Konan,

    you need the "login" just one time for the connection to the webservices. I had a login process and after that I use the services without another login because the objects were initialised and "logged in".

    If you have more questions or problems please let me know and I can go more in detail if you need.

    Best regards,
    egnaz
  • KonanKonan Member Posts: 18
    egnaz hello,

    My problem is:

    I have a project in VB.net and published several pages and codeunit of Navision, and I refer in different events at different webServices VB.net.

    In the office I have no problem to connect to the program and use webServices to go home but I say I'm not authorized.

    Honestly I am newbie in this of Navision and VB.net and I have little idea about networks.

    If I could spell like a 5 year old I would appreciate it because I am quite lost.

    Is that the server is private IP. Does that have anything to do?

    Something must be done in the Navision server or my office to access it from another domain?

    Thank you very much for your help.
  • EgnazEgnaz Member Posts: 111
    Ok let's check if I got it right.

    - VB.net project with several webservices to NAV
    - in your office (in the correct domain) you have no problem to connect
    - when you were at home you try to connect to the NAV server by the VB.net program

    How is your access to your company network from your home office?
    Can you connect to NAV by using the RTC from your home office?

    I'll do some research and will post the things I hopefully found for that issue.
    I'm very interested in the solution of this problem because this is a future feature I need to.

    So let's keep on finding a solution :)

    Regards,
    eganz
  • KonanKonan Member Posts: 18
    Hi egnaz,

    You're right in all your statements, and with regard to your questions, I've never tried to access the RTC from home, since I'm new in the company and I have many privileges.

    Could it be server permissions?
    Do I need any special permission to give the server?

    Thank you very much for your support / help

    A greeting, and if I find the solution will not hesitate to put it in this forum.
  • EgnazEgnaz Member Posts: 111
    Hi Konan,

    after lots of research it should be possible to connect over the web without being in the domain.

    Can you ping the server IP from your home?
    Have you tried your connection with a fixed value in the NetworkCredential? (fixed domain value)
    Do you connect by vpn tunneling to your company? This could be a problem. I found an interesting posting here, https://community.dynamics.com/product/ ... 43361.aspx

    I keep an eye on this topic ;)
  • KonanKonan Member Posts: 18
    Many thanks,

    The problem is that we believe we have assembled a VPN, because at home we can not access the office, neither I nor anyone else (I just learned of this detail, sorry)

    NetworkCredential the domain is fixed.

    Do you think if we create a VPN would solve the problem?
    Do you have any link on how to manually create a VPN and what requirements are necessary?

    Thanks,
  • EgnazEgnaz Member Posts: 111
    Hi,

    sorry my knowledge about VPN setup is worse.

    I'll do some testing at home this evening. Maybe I can get it running or I can find the same error. I have to do some configuration tests by my own. My small test code is roughly finished.

    After doing the tests I'll post my results but I can't do it until evening because I'm in the office at the moment.

    So stay tuned.
  • KonanKonan Member Posts: 18
    Muchas gracias egnaz,

    Estare esperando tu solucion, y de todas formas si yo consigo algo lo subire tambien

    Un saludo.
  • ChemanelChemanel Member Posts: 15
    Do you solve your problem? Maybe i can help too but i need a little more information...
  • EgnazEgnaz Member Posts: 111
    Problem is still unsolved. Because of some technical problems I couldn't test yet and have to do it tomorrow.

    So feel free to ask your questions maybe we can find a solution.

    Regards,
    egnaz
  • ChemanelChemanel Member Posts: 15
    Can you (Konan) copy paste the exact error that .net generate ?

    Cause if you can ping your server from home, it's just a problem of code in your .net app.

    Maybe you can share the .vb too...
  • KonanKonan Member Posts: 18
    hello

    now I'm in the office and do not remember the error, so when I get home (about 7) I upload the error.

    Thanks.
  • EgnazEgnaz Member Posts: 111
    Hi Konan,

    just in this moment I made a test with my .net program and I can connect to the server across the network.
    Started my vpn tunnel and run the code. It is slow but without any problems.

    So please tell us your error message and we can go on to find the solution or maybe we can locate the problem.

    Greetings,
    egnaz
  • KonanKonan Member Posts: 18
    Hi,

    The message is: "Unable to connect to the remote server"

    thank you
  • EgnazEgnaz Member Posts: 111
    Can you ping your server where the webservice is running?
  • KonanKonan Member Posts: 18
    No, I can´t

    Why??

    Thank you!!
  • EgnazEgnaz Member Posts: 111
    If you can't ping it you couldn't connect to it.

    When your vpn is activ you can't ping the server. Is this right?
  • ChemanelChemanel Member Posts: 15
    I think the problem is not with NAV our with your C#, but with you're VPN infrastructure... Can't anyone at your office help you with that? Normally you must be able to ping your NAV server without any problem..
  • Denis_VitseDenis_Vitse Member Posts: 34
    Hey,

    pinging might not work but connecting to Nav could work. Firewall can drop a ping request (which is ICMP network protocol) but allow tcp or udp connections on specific ports, like tcp 7047, which is Nav Webservice connection entry point, I believe.

    You need to check with your infrastructure that any firewall between your station and the Nav server has rule to let TCP 7047 pass.
    It is slightly important to indicate your infrastructure department that you want this to work through VPN.

    When saying Firewall, I am including Windows firewalls both on your client machine and on the Nav server.

    For the latter, I think Nav Installer already created a inbound rule for Nav webservice server during install.

    Good Luck
Sign In or Register to comment.