API consumption in Ax 2009

hi all,

I am using dynamics ax 2009 i need to integrate the Paytrace APIs with ax. I want to work on credit card merger with ax.

I tried the following

  1. Create HTTP request and send
  2. Catch the response, which will be XML
  3. Interpret the XML to pull the necessary data

By using the below method

Static XML HttpWebRequest(XML _url, XML _parameter)

{

System.Net.WebRequest webrequest;

System.Net.HttpWebResponse httpresponse;

System.IO.Stream stream;

System.IO.StreamReader streamReader;

xml responseXML;

System.Byte[] arrayOfBytes;

System.Text.Encoding encoding;

;

try

{

new InteropPermission(InteropKind::ClrInterop).assert();

//Use .Net framework reflections to make HttpRequest and get the response back

encoding = System.Text.Encoding::get_UTF8();

arrayOfBytes = encoding.GetBytes(_parameter);

webrequest = System.Net.WebRequest::Create(_url);

webrequest.set_Method(“POST”);

webrequest.set_ContentType(“application/x-www-form-urlencoded”);

webrequest.set_ContentLength(arrayOfBytes.get_Length());

stream = webrequest.GetRequestStream();

stream.Write(arrayOfBytes,0,arrayOfBytes.get_Length());

stream.Close ();

httpresponse = webrequest.GetResponse();

stream = httpresponse.GetResponseStream ();

streamReader = new System.IO.StreamReader (stream);

responseXML = streamReader.ReadToEnd ();

streamReader.Close ();

stream.Close ();

httpResponse.Close ();

codeAccessPermission::revertAssert();

}

catch

{

throw error(strfmt(“Exception occured during payment process. Url: %1”, _url));

}

return responseXML;

}

Still getting the errors in response.

Please suggest some steps.

It will help if you tell us something more about the errors.

i am getting the following error

ERROR~990. Please provide a properly formatted parameter string.|

i have given the parameter string perfectly formatted as described in this book

https://paytrace.com/manuals/PayTraceAPIUserGuideXML.pdf

and checked the response from this link

http://help.paytrace.com/api-response-codes

the below is the main method

public static void main()

{

str 1000 strtest;

str 1000 strRequest;

//strRequest = “TERMS~Y|EMAIL~nirav.trivedi@indusa.com|”;

strRequest = ‘UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|’;

strtest = ConsumeAPI::HttpWebRequest(‘https://paytrace.com/api/default.pay’,strRequest);

info(strfmt("%1",strtest));

}

That the service refuses your parameters doesn’t seem to be related to Dynamics AX. Try the same from Visual Studio if you really want to be sure that it has nothing to do with AX.

You should discuss it with the Paytrac, not here.