Options

Talking to 3rd party Webservice

StLiStLi Member Posts: 83
edited 2015-05-08 in NAV Three Tier
Hi!

Disclaimer: This is not about offering a Webservice with NAV to some 3rd Party program. I want to do the exact opposite.

I'm looking for a way to connect to an external Webservice to transmit some data to it when the Navision user does a certain task. Like Updating attributes of an Item-Record. Or Posting a purchase order.

I guess this will lead me to write a .NET component but i was wondering if there are alternatives and if there is some kind of "best practise model" around already.

Thanks for your help in advance!

Edit: I figured it might help to elaborate a little more: We built a module able to exchange data with a Webshop via SOAP-interface. But so far it was always the Webshop sending requests to us. With the Webshop already having included Enduser friendly E-Mail-Template management and many more features, we now want to be able to push new events on the Navision side to the Webshop in realtime. At the moment we have a Timer on the Webshops side to ask for updates regularly. But we want more flexibility.

Comments

  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You can do this without writing a .NET component, through xmlHttp and SOAP.

    These links will get you started:
    Connect Navision with external web service
    Connecting to NAV Web Services from Microsoft Dynamics NAV 2009 SP1
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    StLiStLi Member Posts: 83
    Thank you very much, i'll look into this as soon as we're going to realise the extension.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I actually prefer using a dotnet component. With C# you can link to the webservice and it will generate all the classes. You can then use them in C# and NAV.

    This creates cleaner code and you can often use C# commands that are harder to do in NAV.

    Downside: you end up having business logic in C#.

    Personally I believe Microsoft should make it easier to consume webservices in nav. Programming xmlhttp directly is quite a hassle.

    Just my 2 cents.
  • Options
    MarijnMarijn Member Posts: 69
    Hello,

    I could help you with a bare bones working example without any error handling. However, it makes a difference how you will authenticate. For example, if you call another NAV installation, you will set the username and password in xmlhttp. But if you would call a Magento API, you need to set an ApiKey as a parameter and deal with session timeouts. So the actual implementation depends on the 3rd party app.
  • Options
    StLiStLi Member Posts: 83
    The Authentication will be done with each request so this is just a matter of two parameters.

    Unfortunately The realisation of this got down prioritized so I'll have to do other stuff for the next few months. Thanks for the help anyway. I hope i'll remember this thread when i'm back on the topic. :?
  • Options
    davmac1davmac1 Member Posts: 1,283
    I have been looking for the dotnet equivalent for calling a webservice.
    What is the dotnet equivalent of the XmlHttp?

    So far I have found a hint, but nothing I can use.
Sign In or Register to comment.