Web Service Connection Error Exception.

baigs_arshi2004
Member Posts: 4
Hi
The below code sends an xml request and picks the xml response perfectly when the Internet connection is up. Just suppose if the connection is down or Web service deosn't resond i get below error message at XMLHttpConn.send(XMLDoc);
I need to handle this exception by checking the connection before send the xml request.
I understand this error is due to connection failure, is there a way to handle this connection error exception.
Please advice..
Below are Code and Error message
==========CODE===============================
WebServiceLink:='http://aldoagi.icongodev.com/aldoagiws/instore.cfc?wsdl';
CLEAR(XP6);
DLG.OPEN('#1########################\\'+
'#2########################\');
DLG.UPDATE(1, 'Order Pre-Confirm');
DLG.UPDATE(2, 'Preparing Request');
WebOrder.RESET;
IF WebOrder.GET("OrdNo.") THEN
WebOrder.MARK(TRUE);
WebOrder.MARKEDONLY(TRUE);
WebOrder.Blob.CREATEINSTREAM(InStr);
WebOrder.Blob.CREATEOUTSTREAM(OutStr);
XP6.SETTABLEVIEW(WebOrder);
XP6.SETDESTINATION(OutStr);
XP6.EXPORT;
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc);
XMLDoc.load(InStr);
XMLDoc.save('C:\XMLRequest.xml');
IF ISCLEAR(XMLHttpConn) THEN
CREATE(XMLHttpConn);
DLG.UPDATE(2, 'Preparing Request');
XMLHttpConn.open('POST',WebServiceLink,FALSE);
XMLHttpConn.setRequestHeader('SOAPAction',WebServiceLink+'/'+AGIService);
XMLHttpConn.setRequestHeader('Content-Type','text/xml');
XMLHttpConn.send(XMLDoc);
DLG.UPDATE(2, 'Awaiting Response');
XMLDoc.load(XMLHttpConn.responseXML);
IF XMLHttpConn.status <> 200 THEN BEGIN
MESSAGE('Status %1 %2',XMLHttpConn.status,XMLHttpConn.statusText);
EXIT;
END;
XMLDoc.save('C:\XMLResponse1.xml');
DLG.UPDATE(2, 'Parsing Response');
RemoveNamespace(XMLDoc,XMLDoc);
XMLDoc.save('C:\XMLResponse2.xml');
XMLDoc.save(OutStr);
ReadxmlResponsePreConfirmOrder('C:\XMLResponse2.xml');
DLG.CLOSE;
==========CODE===============================
======ERROR================================
Microsoft Business Solutions-Navision
This message is for C/AL programmers:
The call to member save failed. MSXML3.DLL returned the following message:
System does not support the specified encoding.
OK
======ERROR================================
Regards,
Mirza.
The below code sends an xml request and picks the xml response perfectly when the Internet connection is up. Just suppose if the connection is down or Web service deosn't resond i get below error message at XMLHttpConn.send(XMLDoc);
I need to handle this exception by checking the connection before send the xml request.
I understand this error is due to connection failure, is there a way to handle this connection error exception.
Please advice..
Below are Code and Error message
==========CODE===============================
WebServiceLink:='http://aldoagi.icongodev.com/aldoagiws/instore.cfc?wsdl';
CLEAR(XP6);
DLG.OPEN('#1########################\\'+
'#2########################\');
DLG.UPDATE(1, 'Order Pre-Confirm');
DLG.UPDATE(2, 'Preparing Request');
WebOrder.RESET;
IF WebOrder.GET("OrdNo.") THEN
WebOrder.MARK(TRUE);
WebOrder.MARKEDONLY(TRUE);
WebOrder.Blob.CREATEINSTREAM(InStr);
WebOrder.Blob.CREATEOUTSTREAM(OutStr);
XP6.SETTABLEVIEW(WebOrder);
XP6.SETDESTINATION(OutStr);
XP6.EXPORT;
IF ISCLEAR(XMLDoc) THEN
CREATE(XMLDoc);
XMLDoc.load(InStr);
XMLDoc.save('C:\XMLRequest.xml');
IF ISCLEAR(XMLHttpConn) THEN
CREATE(XMLHttpConn);
DLG.UPDATE(2, 'Preparing Request');
XMLHttpConn.open('POST',WebServiceLink,FALSE);
XMLHttpConn.setRequestHeader('SOAPAction',WebServiceLink+'/'+AGIService);
XMLHttpConn.setRequestHeader('Content-Type','text/xml');
XMLHttpConn.send(XMLDoc);
DLG.UPDATE(2, 'Awaiting Response');
XMLDoc.load(XMLHttpConn.responseXML);
IF XMLHttpConn.status <> 200 THEN BEGIN
MESSAGE('Status %1 %2',XMLHttpConn.status,XMLHttpConn.statusText);
EXIT;
END;
XMLDoc.save('C:\XMLResponse1.xml');
DLG.UPDATE(2, 'Parsing Response');
RemoveNamespace(XMLDoc,XMLDoc);
XMLDoc.save('C:\XMLResponse2.xml');
XMLDoc.save(OutStr);
ReadxmlResponsePreConfirmOrder('C:\XMLResponse2.xml');
DLG.CLOSE;
==========CODE===============================
======ERROR================================
Microsoft Business Solutions-Navision
This message is for C/AL programmers:
The call to member save failed. MSXML3.DLL returned the following message:
System does not support the specified encoding.
OK
======ERROR================================
Regards,
Mirza.
0
Comments
-
Have you solved the issue?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