Breadcrumbs

Manipulating Returns

Web Service

Description

PrintJobsData

View how to use the data returned by the Web Service

QuotasData

View how the data is sent and how to use it

PrintJobsData

Web Service Responses

The callback return structure returns a string containing the data in JSON format.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://ws-ndd.uri/">{ "object1": 1, "object2": "teste" }</string>

As you can view above, the response consists solely of a string in JSON format.

Reading the return content

To work with the return, below is an example of code written in C# that converts the return to a DataTable:

C#
    static class Program
    {
        static void Main()
        {
            PrintJobsService.PrintJobsDataSoapClient webservice = new PrintJobsService.PrintJobsDataSoapClient(); 

            try
            {
                string result = webservice.GetPrintJobs("enterpriseName", "enterpriseKey", "authDomainName", "authLogonName", "authPassword", "filterDate", "filterDateType", "fieldsList");
                DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(result);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
    }

QuotasData

Web Service Responses

The return structure follows the following default:

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://ws-ndd.uri/">{ "object1": 1, "object2": "teste" }</string>

As you can view above, the response consists only of a string in JSON format.

Response example:

{
 "CorporativeBalance": {
   "TotalPagesSpecified": false,
   "PagesMonoSpecified": false,
   "PagesColor": 10,
   "PagesColorSpecified": true,
   "MoneyValueSpecified": false
 },
 "PersonalBalance": {
   "TotalPages": 10,
   "TotalPagesSpecified": true,
   "PagesMonoSpecified": false,
   "PagesColorSpecified": false,
   "MoneyValueSpecified": false
 }
}

Reading the return content

To deserialize this return, below is an example of code written in C#:

C#
    static class Program
    {
        public class BalanceItem
        {
            public int TotalPages { get; set; }
            public int PagesMono { get; set; }
            public int PagesColor { get; set; }
            public string MoneyValue { get; set; }
        } 

        public class Balance
        {
            public BalanceItem CorporativeBalance { get; set; }
            public BalanceItem PersonalBalance { get; set; }
        } 
        static void Main()
        {
            QuotasService.QuotasDataSoapClient webservice = new QuotasService.QuotasDataSoapClient(); 

            try
            {
                string result = webservice.GetBalance("enterpriseName", "enterpriseKey", "authDomainName", "authLogonName", "authPassword", "userDomainName", "userLogonName");
                Balance balance = Newtonsoft.Json.JsonConvert.DeserializeObject<Balance>(result);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }
    }