Web Service Connection Error Exception.

baigs_arshi2004baigs_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.

Comments

Sign In or Register to comment.