Error when calling webservice with wrong url

elwin68
Member Posts: 153
Hello,
I have a problem when calling a webservice out off NAV 2009 SP1.
The following lines are used.
XmlHttpLaut.open('POST', VarURL, FALSE);
XmlHttpLaut.setRequestHeader('Content-type','text/xml; charset=utf-16');
XmlHttpLaut.setRequestHeader('SOAPAction', VarSoapaction);
XmlHttpLaut.setRequestHeader('Timeout','100000');
XmlHttpLaut.send(XmlDocLaut);
VarURL is a variable with the url of the webservice.
When VarURL has the correct url everything is working well.
When VarURL has the wrong url an error occures for the method Open.
Is it possible to catch this error in NAV so I can generate an error myself?
Thanks in advance.
I have a problem when calling a webservice out off NAV 2009 SP1.
The following lines are used.
XmlHttpLaut.open('POST', VarURL, FALSE);
XmlHttpLaut.setRequestHeader('Content-type','text/xml; charset=utf-16');
XmlHttpLaut.setRequestHeader('SOAPAction', VarSoapaction);
XmlHttpLaut.setRequestHeader('Timeout','100000');
XmlHttpLaut.send(XmlDocLaut);
VarURL is a variable with the url of the webservice.
When VarURL has the correct url everything is working well.
When VarURL has the wrong url an error occures for the method Open.
Is it possible to catch this error in NAV so I can generate an error myself?
Thanks in advance.
0
Answers
-
Why do you want to catch error in Navision? If you catch the exception (outside Navision) then you can simply send this Exception message to NAV, format it as you want and return back.Ufuk Asci
Pargesoft0 -
Hello ufuk,
The following error occures which is not clear for a user.
This message is for C/AL programmers.
An exeption occured with the method Open.
....
....
So it would be nice I can catch this error when calling the XmlHttpLaut.open method.
And I have no code outside NAV.0 -
In Navision you won't have additional information to handle this Exception. So it doesn't matter if you implement error handling in Navision or on an external platform. (In fact it will be more difficult.)
Why don't you use switch statements based on Error Codes that display user friendly messages?Ufuk Asci
Pargesoft0 -
Thanks for your answer.
I'm quite new in calling webservices out of NAV.
Is there an example so I can see how this works?
Thanks in advance.0 -
If the error raises from Navision, Exception.Message already includes Navision error.
If not, you can play with the InnerException and Source properties of the Exception class.Ufuk Asci
Pargesoft0 -
[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
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