Calling webservice from nav2013

Benno67
Member Posts: 39
Hi All,
We have a problem in NAV2013 that we donot understand:
We are trying to compile a CU with a XmlHTTPConn creation in it. Compiling goes well, from the designer, but saving gives an error message : You cannot create an Automation object "XmlHttpConn" on Microsoft Dynamics NAV Server. You must create it on a client computer.
The solution apperently is : place the creation between a "if not isservicetier" begin/end. Afterwards we are able to save and compile the codeunit.
The only problem that remains is executing the codeunit : In NAV2013 the coding is always running on the servicetier? So calling webservices is not possible anymore?
How do we create objects on a client in NAV2013?
Regards
Benno
We have a problem in NAV2013 that we donot understand:
We are trying to compile a CU with a XmlHTTPConn creation in it. Compiling goes well, from the designer, but saving gives an error message : You cannot create an Automation object "XmlHttpConn" on Microsoft Dynamics NAV Server. You must create it on a client computer.
The solution apperently is : place the creation between a "if not isservicetier" begin/end. Afterwards we are able to save and compile the codeunit.
The only problem that remains is executing the codeunit : In NAV2013 the coding is always running on the servicetier? So calling webservices is not possible anymore?
How do we create objects on a client in NAV2013?
Regards
Benno
0
Answers
-
You need to use .NET interop. Try to use .net assemblies to do what you need instead Automations...0
-
I am not amused, found out that it is possible to create automations client site, but ran into the fact that streming is not supported anymore, at least client site streaming :thumbsdown:
By having to use Interopt we are back at the discussions last TechDay's on using .Net by Navision developers.....
Thanks Anyway, not you fault0 -
I hardly remember the discussion, but yes, we need to learn .net, but .net interop with events is better way than automations...0
-
[Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi Kine,
Maybe I am a bit stubborn on not wanting to use .NET Interopt. It has to do with being afraid to lose the “old” skills and productivity, and getting back more time consuming .NET programming.
Perhaps you can help to solve this problem with Interopt, and prove me being to skeptical :
I want to read a XmlFile into a XmlDoc. In the classic environment it can be solved easy with In/OutStreams
Running it on NAV2013 results in : Streams cannot be used with client-side invoked automation objects.
Can you give me a start on how to solve it with Interopt (Simply declaring a DONET Memory Stream variable is not the answer)
Benno0 -
And the XML is saved on disk? You can use the load member of the XMLDocument class to load it, no?0
-
The XmlDoc has to be created client site, (server site is not possible since the cu is running client site).
Trying to load the XmlFile (on the server) results in an empty XmlDoc.
Copying the save XmlDoc to the client, and loading it from there makes it all working.
Creating the XmlFile on the client does not work either, because it has to be filled using a XmlPort, with streams... and they do not work on the client.
Trying to do something Microsoft did not thought of?0 -
Why the CU is run on client? Can you run it rather on server?0
-
With the help of Codeunit 419 and Table 99008535 you should be able to stream your XMLPort to tempBLOB and stream it to a client side temporary file that you can open with them XMLDoc automation on the client. Right ?
1. Create an outstream based on tempBLOB
2. Export using XMLPort
3. Create an instream based on the same tempBLOB
4. DOWNLOADFROMSTREAM into a client side file
5. Use XMLDoc.load to import the file.________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
Life can be very simple!
Did not know of the existence of DOWNLOADFROMSTREAM!
Thanks Gunner and Kine :thumbsup:0 -
We will need to go over to .NET eventually, but if you are adamant on creating an automation on the 3-tier structure, then you need to use the optional parameters or NewServer and OnClient. The full function description is: [Ok :=] CREATE(Automation [,NewServer] [,OnClient])
This means that CREATE(XmlHttpConn, FALSE, TRUE) will prevent this error from occurring.0 -
I created a web request dotnet code for nav 2009 that should work for nav 2013.
http://www.dynamics.is/?p=1018________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0 -
Hi Gunnar,
Exactly my question, without automation, no server/client site dependency's!
I am going to fit it in into our old solution, and try it on Nav2013.
Thanks
Benno0 -
I've just started looking into this in NAV2013 and got a bit confused.
I can create my XMLHttpConn using CREATE(XMLDoc, FALSE, TRUE), call Send and load the response into an XMLDoc. I can pass that XMLDoc as a variable to a a function in a codeunit which saves a debug xml file on my file system and the files looks just fine. But I cant pass the XMLDoc to a function in a codeunit where I try to use the XMLDoc whith functions like XMLDoc.getElementsByTagName to process it.
Any suggestions?Lars Westman
http://www.linkedin.com/in/larswestman0 -
It was XML6.0 that caused my problems. changing to XML3.0 fixed itLars Westman
http://www.linkedin.com/in/larswestman0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions