I am trying to call web service API from AX 2009.
API method accepts 2 parameters, 1. inputString (sting Type), 2. OutputString(reference type string parameter value )
When I am trying to call this method in Ax, by using of byref Keyword its returning blank, (but if the same service called from .Net its giving correct returning value)
Ax Code:
//Method runs in Server.
public void processService()
{
LinksWS.ViaWSSoapClient obj;
str strInputData, strRetData;
;
strInputData = “SampleData”;
new InteropPermission(InteropKind::ClrInterop).assert();
obj = new LinksWS.ViaWSSoapClient (“ConnectionEndPoint”);
obj.RequestCall(strInputData, byref strRetData);
/* Requestcall is the webservice API, which should return strRetData value as “SampleDataWithResult” */
info(strRetData); // value should return , currently its returning Blank
CodeAccessPermission::revertAssert();
}
Tried with Alternate approach:
Since Web service API is working fine in .NET, so I created Proxy DLL in .Net and calling the Proxy DLL in Ax.
(create COM Objects in .net and that COM obj referenced in Ax.)
x++ code
static void proxyCall(Args _args)
{
WSServiceDLL.WSServiceCLass proxyDLL;
str strInputData, strRetData;
;
strInputData = “SampleData”;
new InteropPermission(InteropKind::ClrInterop).assert();
proxyDLL = new WSServiceDLL.WSServiceCLass ();
strRetData = proxyDLL.RequestCall (strInputData); //stops the execution.
info(strfmt(" return data %1", strRetData));
}
Proxy DLL Method:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WSServiceDLL.WSService;
namespace WSServiceDLL
{
public class WSServiceCLass
{
public string RequestCall(string reqStr)
{
WSViaWSSoapClient obj = new WSViaWSSoapClient(“ConnectionEndPoint”);
string authString;
authString = “”;
obj.AuthRequest(reqXML, true, ref authString);
return authString;
}
}
}
But in this scenario ,
when i am trying to call the Proxy DLL. Ax stops the Execution of the method.
if anyone have solution please let me know .
Thanks