Getting Error when calling NAV web service.

SuD
Member Posts: 102
Helloo Experts!!
Good Day!!
Here is a scenario which I m on working. I have a function in a NAV codeunit , in that function I m calling a external API with the help of Automation Variables.
Variables are
Name DataType Subtype Length
locautXmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument60
XmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP60
I have published this codeunit , and then I m consuming it in a .NET web site, but when the function inside the web service going to execute I getting below error.
{"Microsoft Dynamics NAV Business Web Services attempted to issue a client callback to create an Automation object: 88d96a05-f192-11d4-a65f-0040963251e5 (CodeUnit 50001 Payment Gateway). Client callbacks are not supported on Microsoft Dynamics NAV Business Web Services."}
Some where (https://community.dynamics.com/nav/f/34/t/153096) I found related issue, but couldn't resolved the issue by suggested solutions.
I cant use DotNet variable with this solution as I m having issue with DotNet var also kind of SSL\TLS and ACCESS DENIED error.
CODE is below
RunTime := TRUE;
CLEAR(ResponseCode);
CLEAR(ResponseText);
IF NOT GUIALLOWED THEN
BEGIN
IF NOT ISCLEAR(locautXmlDoc) THEN
CLEAR(locautXmlDoc);
IF ISCLEAR(locautXmlDoc) THEN
CREATE(locautXmlDoc,FALSE,RunTime);
END;
locautXmlDoc.async:=TRUE;
locautXmlDoc.save('D:\NAV\createTransactionRequestChargeCard.xml');
IF NOT GUIALLOWED THEN
BEGIN
IF NOT ISCLEAR(XmlHttp) THEN
CLEAR(XmlHttp);
IF ISCLEAR(XmlHttp) THEN
CREATE(XmlHttp,FALSE,RunTime);
END;
XmlHttp.open('POST','https://apitest.authorize.net/xml/v1/request.api',FALSE);
XmlHttp.setRequestHeader('Content-type', 'text/xml');
XmlHttp.setRequestHeader('SOAPAction','https://apitest.authorize.net/xml/v1/request.api');
XmlHttp.send(locautXmlDoc);
ResponseText := COPYSTR(STRSUBSTNO(XmlHttp.responseText),1,1024);
locautXmlDoc.load(XmlHttp.responseBody);
locautXmlDoc.save('D:\createTransactionResponseChargeCard.xml');
IF XmlHttp.status <> 200 THEN
BEGIN
LastError := XmlHttp.statusText;
EXIT(FALSE);
END
ELSE
EXIT(TRUE);
Please have a look on this error, and help me out if any one have idea to resolve this.
Kind Regards
Sudarshan
Good Day!!
Here is a scenario which I m on working. I have a function in a NAV codeunit , in that function I m calling a external API with the help of Automation Variables.
Variables are
Name DataType Subtype Length
locautXmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument60
XmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP60
I have published this codeunit , and then I m consuming it in a .NET web site, but when the function inside the web service going to execute I getting below error.
{"Microsoft Dynamics NAV Business Web Services attempted to issue a client callback to create an Automation object: 88d96a05-f192-11d4-a65f-0040963251e5 (CodeUnit 50001 Payment Gateway). Client callbacks are not supported on Microsoft Dynamics NAV Business Web Services."}
Some where (https://community.dynamics.com/nav/f/34/t/153096) I found related issue, but couldn't resolved the issue by suggested solutions.
I cant use DotNet variable with this solution as I m having issue with DotNet var also kind of SSL\TLS and ACCESS DENIED error.
CODE is below
RunTime := TRUE;
CLEAR(ResponseCode);
CLEAR(ResponseText);
IF NOT GUIALLOWED THEN
BEGIN
IF NOT ISCLEAR(locautXmlDoc) THEN
CLEAR(locautXmlDoc);
IF ISCLEAR(locautXmlDoc) THEN
CREATE(locautXmlDoc,FALSE,RunTime);
END;
locautXmlDoc.async:=TRUE;
locautXmlDoc.save('D:\NAV\createTransactionRequestChargeCard.xml');
IF NOT GUIALLOWED THEN
BEGIN
IF NOT ISCLEAR(XmlHttp) THEN
CLEAR(XmlHttp);
IF ISCLEAR(XmlHttp) THEN
CREATE(XmlHttp,FALSE,RunTime);
END;
XmlHttp.open('POST','https://apitest.authorize.net/xml/v1/request.api',FALSE);
XmlHttp.setRequestHeader('Content-type', 'text/xml');
XmlHttp.setRequestHeader('SOAPAction','https://apitest.authorize.net/xml/v1/request.api');
XmlHttp.send(locautXmlDoc);
ResponseText := COPYSTR(STRSUBSTNO(XmlHttp.responseText),1,1024);
locautXmlDoc.load(XmlHttp.responseBody);
locautXmlDoc.save('D:\createTransactionResponseChargeCard.xml');
IF XmlHttp.status <> 200 THEN
BEGIN
LastError := XmlHttp.statusText;
EXIT(FALSE);
END
ELSE
EXIT(TRUE);
Please have a look on this error, and help me out if any one have idea to resolve this.
Kind Regards
Sudarshan
0
Comments
-
Use DotNet variable instead of Automation.
Automation gives a callback which needs a manual intervention.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
You can take help from this
https://rockwithnav.wordpress.com/tag/consume-net-webservice-dotnet-data-type/
You will find the example with Automation too, but use DotNet over webservices.Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/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