
I need to call the interface URL as below.
When i call that URL from a browser, the following 3rd party web page is popuped.
-my code is simple.
Webresponse ended without any reaction from the area.
webresponse = webreq.GetResponse();
--- Job Class --
static void CreateWebAPI(Args _args)
{
System.Net.WebRequest webreq = System.Net.WebRequest::Create("">devgw.OOOO.co.kr/.../goFormLink.do
System.IO.Stream streamstr,responsestr;
System.IO.StreamWriter streamWriter;
System.Net.WebResponse webresponse;
System.IO.StreamReader reader;
webreq.set_Method("Get");
webreq.set_ContentType('application/Json');
// webreq.set_ContentType('application/x-www-form-urlencoded');
// streamstr = webreq.GetRequestStream();
// streamWriter = new System.IO.StreamWriter(streamstr);
//streamWriter.Write("CountryName=New+Zealand");
// streamWriter.Flush();
// streamWriter.Close();
// streamWriter.Dispose();
webresponse = webreq.GetResponse();
// responsestr = webresponse.GetResponseStream();
// reader = new System.IO.StreamReader(responsestr);
// info(reader.ReadToEnd());
}
First of all, let me re-post your code in the right way and throw away unused code. Next time, please use Insert > Code to paste source code to this forum.
static void CreateWebAPI(Args _args)
{
System.Net.WebRequest webreq = System.Net.WebRequest::Create(...):
System.Net.WebResponse webresponse;
webreq.set_Method("Get");
webreq.set_ContentType('application/Json');
webresponse = webreq.GetResponse();
}
My guess is that your code throws an exception, but you aren't aware of it, because you forgot to add exception handling. The key is catching CLRError. Then there are different ways how to extract informaton from the exception; let's use a simple one:
static void createWebAPI(Args _args)
{
System.Net.WebRequest webReq = System.Net.WebRequest::Create(...):
System.Net.WebResponse webResponse;
try
{
webReq.set_Method("Get");
webReq.set_ContentType('application/Json');
webResponse = webReq.GetResponse();
}
catch (Exception::CLRError)
{
throw error(AifUtil::getClrErrorMessage());
}
}
Run the code and you'll likely learn more about what happened.