Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Deepti
2015-10-06T06:47:45Z
Hello,

I am using Web API to retrieve the list of jobs in my .Net application.(aspx pages).
Could anyone help me with the code as I am new to VisualCron.

Thank you,
Deepti.
Sponsor
Forum information
Support
2015-10-06T08:23:36Z
Hi,

here is the documentation for this with some samples:

http://www.visualcron.com/doc/HTML/web_api.htm 


Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Deepti
2015-10-06T08:28:47Z
Hello,
I have gone through the document.
In this line
var client = new WebServiceClient();
I dont get WebServiceClient() i can only see WebService.
How do i get WebServiceClient();
Please help.

Support
2015-10-06T08:43:24Z
Add a web service reference to: http://localhost:8001/VisualCron?wsdl
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Deepti
2015-10-06T09:16:14Z
Support
2015-10-06T09:56:16Z
What error do you get when adding the web service reference?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Deepti
2015-10-06T10:08:01Z
Hello,
I have added the web service reference successfully. but the problem is when i start writing the code from your sample

var client = new WebServiceClient(binding, new EndpointAddress("http://localhost:8001/VisualCron"));
//or just:
//
//var client = new WebServiceClient();
//
//but better setup binding
if (client.ChannelFactory.Credentials != null)
{
//set Credentials
client.ChannelFactory.Credentials.UserName.UserName = txtUserName.Text;
client.ChannelFactory.Credentials.UserName.Password = txtPassWord.Text;
}


}
i am not able to write WebServiceClient()
I don't understand if I am missing any dll?
Support
2015-10-06T11:27:21Z
WebServiceClient is an object in the service reference. You need to import or direct reference to that.

For example if the name of the service reference is "ServiceReference1" you need to use ServiceReference1.WebClient
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Deepti
2015-10-07T10:35:18Z
Our current code looks like this:

VisualCron.WebService client = new VisualCron.WebService();
client.UnsafeAuthenticatedConnectionSharing = true;
client.Url = "http://localhost:8000/VisualCron";
client.UseDefaultCredentials = true;

ICredentials credentials = new NetworkCredential("<username>", "<password>");
client.Credentials = credentials;

LogonResult loginresult = client.Logon("<cronusername>", "<password>");

JobClass[] jobs= client.Job_List();

This code return a valid authentication token but shows in the last line´s code execution this error:
Client found response content type of '', but expected 'text/xml'.
The request failed with an empty response.

Please Suggest
Deepti
2015-10-07T12:35:02Z
Hi,

we tried this and get empty jobclasses

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:8000/visualcron/xml/job/List?username=admin&password=");
request.Method = "GET";
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
var ser = new XmlSerializer(typeof(JobClass[]));
JobClass[] jobs = (JobClass[])ser.Deserialize(webStream);

thanks!
Support
2015-10-07T13:42:40Z
Originally Posted by: Deepti 

Hi,

we tried this and get empty jobclasses

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:8000/visualcron/xml/job/List?username=admin&password=");
request.Method = "GET";
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
var ser = new XmlSerializer(typeof(JobClass[]));
JobClass[] jobs = (JobClass[])ser.Deserialize(webStream);

thanks!



What exactly do you get when trying this in a normal browser (if you view source):

http://localhost:8001/visualcron/xml/job/List?username=admin&password=


Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2015-10-07T20:54:06Z
Please try the web service API again by downloading this version: http://www.visualcron.co....aspx?g=posts&t=5208 

Then extract the attached sample project for connecting.

  TestClient.zip (3,733kb) downloaded 105 time(s).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top