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
- Create HTTP request and send
- Catch the response, which will be XML
- 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.