CreateAutoOrder
Create a new Recurring Order template for an existing customer or a new customer as part of a transaction. Client provides schedule, item codes, quantity, and shipping info. Server calculates and commits data, then pricing, tax, shipping and volume info. You can also update/overwrite an existing autoorder by using the OverwriteExistingAutoOrder and ExistingAutoOrderID properties.Input Properties
CreateAutoOrderRequest
OrderDetailRequest
Output Properties
CreateAutoOrderResponse
OrderDetailResponse
Http Request
POST https://yourcompany-api.exigo.com/3.0/autoorder HTTP/1.1 Content-Type: application/json Authorization: Basic base64Encoded(yourlogin@yourcompany:yourpassword){ "frequency": null, "startDate": "2024-11-21T00:00:00-06:00", "stopDate": "2024-11-21T00:00:00-06:00", "specificDayInterval": 1, "currencyCode": "usd", "warehouseID": 1, "shipMethodID": 1, "priceType": 1, "paymentType": null, "processType": null, "firstName": "", "lastName": "", "company": "", "address1": "", "address2": "", "address3": "", "city": "", "zip": "", "county": "", "email": "", "phone": "", "notes": "", "overwriteExistingAutoOrder": true, "existingAutoOrderID": 1, "details": null, "customerKey": "1", "customFrequencyTy": 1 }
Http Response
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Content-Length: length{ "autoOrderID": 1, "description": "", "total": null, "subTotal": null, "taxTotal": null, "shippingTotal": null, "discountTotal": null, "weightTotal": null, "businessVolumeTotal": null, "commissionableVolumeTotal": null, "other1Total": null, "other2Total": null, "other3Total": null, "other4Total": null, "other5Total": null, "other6Total": null, "other7Total": null, "other8Total": null, "other9Total": null, "other10Total": null, "shippingTax": null, "orderTax": null, "details": null, "result": null }
Soap Request
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /3.0/ExigoApi.asmx HTTP/1.1 Host: totallife-api.exigo.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "https://api.exigo.com/CreateAutoOrder" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <ApiAuthentication xmlns="http://api.exigo.com/"> <LoginName>string</LoginName> <Password>string</Password> <Company>string</Company> <Identity>string</Identity> <RequestTimeUtc>dateTime</RequestTimeUtc> <Signature>string</Signature> </ApiAuthentication> </soap:Header> <soap:Body> <CreateAutoOrderRequest xmlns="http://api.exigo.com/"> <CustomerID>int</CustomerID> <Frequency>Weekly or BiWeekly or Monthly or BiMonthly or Quarterly or SemiYearly or Yearly or EveryFourWeeks or EverySixWeeks or EveryEightWeeks or EveryTwelveWeeks or SpecificDays or Custom</Frequency> <StartDate>dateTime</StartDate> <StopDate>dateTime</StopDate> <SpecificDayInterval>int</SpecificDayInterval> <CurrencyCode>string</CurrencyCode> <WarehouseID>int</WarehouseID> <ShipMethodID>int</ShipMethodID> <PriceType>int</PriceType> <PaymentType>PrimaryCreditCard or SecondaryCreditCard or CheckingAccount or WillSendPayment or BankDraft or PrimaryWalletAccount or SecondaryWalletAccount or ThirdWalletAccount or FourthWalletAccount or FifthWalletAccount</PaymentType> <ProcessType>AlwaysProcess or Conditional</ProcessType> <FirstName>string</FirstName> <MiddleName>string</MiddleName> <LastName>string</LastName> <NameSuffix>string</NameSuffix> <Company>string</Company> <Address1>string</Address1> <Address2>string</Address2> <Address3>string</Address3> <City>string</City> <State>string</State> <Zip>string</Zip> <Country>string</Country> <County>string</County> <Email>string</Email> <Phone>string</Phone> <Notes>string</Notes> <Other11>string</Other11> <Other12>string</Other12> <Other13>string</Other13> <Other14>string</Other14> <Other15>string</Other15> <Other16>string</Other16> <Other17>string</Other17> <Other18>string</Other18> <Other19>string</Other19> <Other20>string</Other20> <Description>string</Description> <OverwriteExistingAutoOrder>boolean</OverwriteExistingAutoOrder> <ExistingAutoOrderID>int</ExistingAutoOrderID> <Details> <OrderDetailRequest> <ItemCode>string</ItemCode> <OrderDetailID>guid</OrderDetailID> <ParentOrderDetailID>guid</ParentOrderDetailID> <Quantity>decimal</Quantity> <ParentItemCode>string</ParentItemCode> <PriceEachOverride>decimal</PriceEachOverride> <TaxableEachOverride>decimal</TaxableEachOverride> <ShippingPriceEachOverride>decimal</ShippingPriceEachOverride> <BusinessVolumeEachOverride>decimal</BusinessVolumeEachOverride> <CommissionableVolumeEachOverride>decimal</CommissionableVolumeEachOverride> <Other1EachOverride>decimal</Other1EachOverride> <Other2EachOverride>decimal</Other2EachOverride> <Other3EachOverride>decimal</Other3EachOverride> <Other4EachOverride>decimal</Other4EachOverride> <Other5EachOverride>decimal</Other5EachOverride> <Other6EachOverride>decimal</Other6EachOverride> <Other7EachOverride>decimal</Other7EachOverride> <Other8EachOverride>decimal</Other8EachOverride> <Other9EachOverride>decimal</Other9EachOverride> <Other10EachOverride>decimal</Other10EachOverride> <DescriptionOverride>string</DescriptionOverride> <Reference1>string</Reference1> <AdvancedAutoOptions> <ProcessWhileDate>dateTime</ProcessWhileDate> <SkipUntilDate>dateTime</SkipUntilDate> <DetailStartDate>dateTime</DetailStartDate> <DetailEndDate>dateTime</DetailEndDate> <DetailInterval>int</DetailInterval> </AdvancedAutoOptions> <OrderLine>int</OrderLine> </OrderDetailRequest> </Details> <CustomerKey>string</CustomerKey> <CustomFrequencyTy>int</CustomFrequencyTy> </CreateAutoOrderRequest> </soap:Body> </soap:Envelope>
Soap Response
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CreateAutoOrderResult xmlns="http://api.exigo.com/"> <AutoOrderID>int</AutoOrderID> <Description>string</Description> <Total>decimal</Total> <SubTotal>decimal</SubTotal> <TaxTotal>decimal</TaxTotal> <ShippingTotal>decimal</ShippingTotal> <DiscountTotal>decimal</DiscountTotal> <WeightTotal>decimal</WeightTotal> <BusinessVolumeTotal>decimal</BusinessVolumeTotal> <CommissionableVolumeTotal>decimal</CommissionableVolumeTotal> <Other1Total>decimal</Other1Total> <Other2Total>decimal</Other2Total> <Other3Total>decimal</Other3Total> <Other4Total>decimal</Other4Total> <Other5Total>decimal</Other5Total> <Other6Total>decimal</Other6Total> <Other7Total>decimal</Other7Total> <Other8Total>decimal</Other8Total> <Other9Total>decimal</Other9Total> <Other10Total>decimal</Other10Total> <ShippingTax>decimal</ShippingTax> <OrderTax>decimal</OrderTax> <Details> <OrderDetailResponse> <OrderDetailID>guid</OrderDetailID> <ParentOrderDetailID>guid</ParentOrderDetailID> <ItemCode>string</ItemCode> <Description>string</Description> <Quantity>decimal</Quantity> <PriceEach>decimal</PriceEach> <PriceTotal>decimal</PriceTotal> <Tax>decimal</Tax> <WeightEach>decimal</WeightEach> <Weight>decimal</Weight> <BusinessVolumeEach>decimal</BusinessVolumeEach> <BusinesVolume>decimal</BusinesVolume> <CommissionableVolumeEach>decimal</CommissionableVolumeEach> <CommissionableVolume>decimal</CommissionableVolume> <Other1Each>decimal</Other1Each> <Other1>decimal</Other1> <Other2Each>decimal</Other2Each> <Other2>decimal</Other2> <Other3Each>decimal</Other3Each> <Other3>decimal</Other3> <Other4Each>decimal</Other4Each> <Other4>decimal</Other4> <Other5Each>decimal</Other5Each> <Other5>decimal</Other5> <Other6Each>decimal</Other6Each> <Other6>decimal</Other6> <Other7Each>decimal</Other7Each> <Other7>decimal</Other7> <Other8Each>decimal</Other8Each> <Other8>decimal</Other8> <Other9Each>decimal</Other9Each> <Other9>decimal</Other9> <Other10Each>decimal</Other10Each> <Other10>decimal</Other10> <ParentItemCode>string</ParentItemCode> <Taxable>decimal</Taxable> <FedTax>decimal</FedTax> <StateTax>decimal</StateTax> <CityTax>decimal</CityTax> <CityLocalTax>decimal</CityLocalTax> <CountyTax>decimal</CountyTax> <CountyLocalTax>decimal</CountyLocalTax> <ManualTax>decimal</ManualTax> <IsStateTaxOverride>boolean</IsStateTaxOverride> <OrderLine>int</OrderLine> <Reference1>string</Reference1> <ShippingPriceEach>decimal</ShippingPriceEach> <HandlingFee>decimal</HandlingFee> </OrderDetailResponse> </Details> </CreateAutoOrderResult> </soap:Body> </soap:Envelope>
C# Rest Client
Install Nuget package Exigo.Api.Client
try
{
//Create Api Client
var api = new ExigoApiClient("yourcmpany", "yourlogin", "yourpassword");
//Create Request
var req = new CreateAutoOrderRequest();
req.Frequency = FrequencyType.Weekly;
req.StartDate = DateTime.Today;
req.StopDate = DateTime.Today; //Leave null if there is no stop date.
req.SpecificDayInterval = 1; //To be used with Frequency Type SpecificDays
req.CurrencyCode = "usd";
req.WarehouseID = 1; //Unique location for orders
req.ShipMethodID = 1;
req.PriceType = 1; //Controls which price band to use
req.PaymentType = AutoOrderPaymentType.PrimaryCreditCard; //Payment type.
req.ProcessType = AutoOrderProcessType.AlwaysProcess;
req.FirstName = "1";
req.LastName = "1";
req.Company = "1";
req.Address1 = "1";
req.Address2 = "1";
req.Address3 = "1";
req.City = "1";
req.Zip = "1";
req.County = "1";
req.Email = "1";
req.Phone = "1";
req.Notes = "1";
req.OverwriteExistingAutoOrder = true;
req.ExistingAutoOrderID = 1;
//Add Details
var details = new List<OrderDetailRequest>();
var detail1 = new OrderDetailRequest();
detail1.ItemCode = "1";
detail1.Quantity = 1;
details.Add(detail1);
var detail2 = new OrderDetailRequest();
detail2.ItemCode = "2";
detail2.Quantity = 2;
details.Add(detail2);
//Now attach the list to the request
req.Details = details.ToArray();
req.CustomerKey = "1"; //Unique alpha numeric identifier for customer record. Exeption will occur if CustomerID & CustomerKey are provided.
req.CustomFrequencyTy = 1; //To be used with Frequency Type Custom
//Send Request to Server and Get Response
var res = await api.CreateAutoOrderAsync(req);
//Now examine the results:
Console.WriteLine("AutoOrderID: {0}", res.AutoOrderID);
Console.WriteLine("Description: {0}", res.Description);
Console.WriteLine("Total: {0}", res.Total);
Console.WriteLine("SubTotal: {0}", res.SubTotal);
Console.WriteLine("TaxTotal: {0}", res.TaxTotal);
Console.WriteLine("ShippingTotal: {0}", res.ShippingTotal);
Console.WriteLine("DiscountTotal: {0}", res.DiscountTotal);
Console.WriteLine("WeightTotal: {0}", res.WeightTotal);
Console.WriteLine("BusinessVolumeTotal: {0}", res.BusinessVolumeTotal);
Console.WriteLine("CommissionableVolumeTotal: {0}", res.CommissionableVolumeTotal);
Console.WriteLine("ShippingTax: {0}", res.ShippingTax);
Console.WriteLine("OrderTax: {0}", res.OrderTax);
foreach (var orderDetail in res.Details)
{
Console.WriteLine("OrderDetailID: {0}", orderDetail.OrderDetailID);
Console.WriteLine("ParentOrderDetailID: {0}", orderDetail.ParentOrderDetailID);
Console.WriteLine("ItemCode: {0}", orderDetail.ItemCode);
Console.WriteLine("Description: {0}", orderDetail.Description);
Console.WriteLine("Quantity: {0}", orderDetail.Quantity);
Console.WriteLine("OrderLine: {0}", orderDetail.OrderLine);
Console.WriteLine("Reference1: {0}", orderDetail.Reference1);
Console.WriteLine("ShippingPriceEach: {0}", orderDetail.ShippingPriceEach);
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
C# Soap Client
try
{
//Create Main API Context Object
ExigoApi api = new ExigoApi();
//Create Authentication Header
ApiAuthentication auth = new ApiAuthentication();
auth.LoginName = "yourLoginName";
auth.Password = "yourPassword";
auth.Company = "yourCompany";
api.ApiAuthenticationValue = auth;
//Create Request
CreateAutoOrderRequest req = new CreateAutoOrderRequest();
req.Frequency = FrequencyType.Weekly;
req.StartDate = DateTime.Today;
req.StopDate = DateTime.Today; //Leave null if there is no stop date.
req.SpecificDayInterval = 1; //To be used with Frequency Type SpecificDays
req.CurrencyCode = "usd";
req.WarehouseID = 1; //Unique location for orders
req.ShipMethodID = 1;
req.PriceType = 1; //Controls which price band to use
req.PaymentType = AutoOrderPaymentType.PrimaryCreditCard; //Payment type.
req.ProcessType = AutoOrderProcessType.AlwaysProcess;
req.FirstName = "1";
req.LastName = "1";
req.Company = "1";
req.Address1 = "1";
req.Address2 = "1";
req.Address3 = "1";
req.City = "1";
req.Zip = "1";
req.County = "1";
req.Email = "1";
req.Phone = "1";
req.Notes = "1";
req.OverwriteExistingAutoOrder = true;
req.ExistingAutoOrderID = 1;
//Add Details
List<OrderDetailRequest> details = new List<OrderDetailRequest>();
OrderDetailRequest detail1 = new OrderDetailRequest();
detail1.ItemCode = "1";
detail1.Quantity = 1;
details.Add(detail1);
OrderDetailRequest detail2 = new OrderDetailRequest();
detail2.ItemCode = "2";
detail2.Quantity = 2;
details.Add(detail2);
//Now attach the list to the request
req.Details = details.ToArray();
req.CustomerKey = "1"; //Unique alpha numeric identifier for customer record. Exeption will occur if CustomerID & CustomerKey are provided.
req.CustomFrequencyTy = 1; //To be used with Frequency Type Custom
//Send Request to Server and Get Response
CreateAutoOrderResponse res = api.CreateAutoOrder(req);
//Now examine the results:
Console.WriteLine("AutoOrderID: {0}", res.AutoOrderID);
Console.WriteLine("Description: {0}", res.Description);
Console.WriteLine("Total: {0}", res.Total);
Console.WriteLine("SubTotal: {0}", res.SubTotal);
Console.WriteLine("TaxTotal: {0}", res.TaxTotal);
Console.WriteLine("ShippingTotal: {0}", res.ShippingTotal);
Console.WriteLine("DiscountTotal: {0}", res.DiscountTotal);
Console.WriteLine("WeightTotal: {0}", res.WeightTotal);
Console.WriteLine("BusinessVolumeTotal: {0}", res.BusinessVolumeTotal);
Console.WriteLine("CommissionableVolumeTotal: {0}", res.CommissionableVolumeTotal);
Console.WriteLine("ShippingTax: {0}", res.ShippingTax);
Console.WriteLine("OrderTax: {0}", res.OrderTax);
foreach (OrderDetailResponse orderDetail in res.Details)
{
Console.WriteLine("OrderDetailID: {0}", orderDetail.OrderDetailID);
Console.WriteLine("ParentOrderDetailID: {0}", orderDetail.ParentOrderDetailID);
Console.WriteLine("ItemCode: {0}", orderDetail.ItemCode);
Console.WriteLine("Description: {0}", orderDetail.Description);
Console.WriteLine("Quantity: {0}", orderDetail.Quantity);
Console.WriteLine("OrderLine: {0}", orderDetail.OrderLine);
Console.WriteLine("Reference1: {0}", orderDetail.Reference1);
Console.WriteLine("ShippingPriceEach: {0}", orderDetail.ShippingPriceEach);
}
}
catch (Exception ex)
{
Console.WriteLine("Error: " + ex.Message);
}
VB.Net
Try
'Create Main API Context Object
Dim api as new ExigoApi()
'Create Authentication Header
Dim auth as new ApiAuthentication()
auth.LoginName = "yourLoginName"
auth.Password = "yourPassword"
auth.Company = "yourCompany"
api.ApiAuthenticationValue = auth
'Create Request
Dim req as new CreateAutoOrderRequest()
req.Frequency = FrequencyType.Weekly
req.StartDate = DateTime.Today
req.StopDate = DateTime.Today
req.SpecificDayInterval = 1
req.CurrencyCode = "usd"
req.WarehouseID = 1
req.ShipMethodID = 1
req.PriceType = 1
req.PaymentType = AutoOrderPaymentType.PrimaryCreditCard
req.ProcessType = AutoOrderProcessType.AlwaysProcess
req.FirstName = "1"
req.LastName = "1"
req.Company = "1"
req.Address1 = "1"
req.Address2 = "1"
req.Address3 = "1"
req.City = "1"
req.Zip = "1"
req.County = "1"
req.Email = "1"
req.Phone = "1"
req.Notes = "1"
req.OverwriteExistingAutoOrder = true
req.ExistingAutoOrderID = 1
'Add Details
Dim details As New List(Of OrderDetailRequest)()
Dim detail1 as new OrderDetailRequest()
detail1.ItemCode = "1"
detail1.Quantity = 1
details.Add(detail1)
Dim detail2 as new OrderDetailRequest()
detail2.ItemCode = "2"
detail2.Quantity = 2
details.Add(detail2)
'Now attach the list to the request
req.Details = details.ToArray()
req.CustomerKey = "1"
req.CustomFrequencyTy = 1
'Send Request to Server and Get Response
Dim res As CreateAutoOrderResponse = api.CreateAutoOrder(req)
'Now examine the results:
Console.WriteLine("AutoOrderID: {0}", res.AutoOrderID)
Console.WriteLine("Description: {0}", res.Description)
Console.WriteLine("Total: {0}", res.Total)
Console.WriteLine("SubTotal: {0}", res.SubTotal)
Console.WriteLine("TaxTotal: {0}", res.TaxTotal)
Console.WriteLine("ShippingTotal: {0}", res.ShippingTotal)
Console.WriteLine("DiscountTotal: {0}", res.DiscountTotal)
Console.WriteLine("WeightTotal: {0}", res.WeightTotal)
Console.WriteLine("BusinessVolumeTotal: {0}", res.BusinessVolumeTotal)
Console.WriteLine("CommissionableVolumeTotal: {0}", res.CommissionableVolumeTotal)
Console.WriteLine("ShippingTax: {0}", res.ShippingTax)
Console.WriteLine("OrderTax: {0}", res.OrderTax)
For Each orderDetail As OrderDetailResponse In res.Details
Console.WriteLine("OrderDetailID: {0}", orderDetail.OrderDetailID)
Console.WriteLine("ParentOrderDetailID: {0}", orderDetail.ParentOrderDetailID)
Console.WriteLine("ItemCode: {0}", orderDetail.ItemCode)
Console.WriteLine("Description: {0}", orderDetail.Description)
Console.WriteLine("Quantity: {0}", orderDetail.Quantity)
Console.WriteLine("OrderLine: {0}", orderDetail.OrderLine)
Console.WriteLine("Reference1: {0}", orderDetail.Reference1)
Console.WriteLine("ShippingPriceEach: {0}", orderDetail.ShippingPriceEach)
Next
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
End Try
PHP
Note: PHP is not officially supported.<?php
try
{
//Setup the SoapClient and Authentication
$api = new SoapClient("http://api.exigo.com/3.0/ExigoApi.asmx?WSDL");
$ns = "http://api.exigo.com/";
$auth = array()
$auth["LoginName"] = new SoapVar("yourLoginName",XSD_STRING,null,null,null,$ns);
$auth["Password"] = new SoapVar("yourPassword",XSD_STRING,null,null,null,$ns);
$auth["Company"] = new SoapVar("yourCompany",XSD_STRING,null,null,null,$ns);
$headerBody = new SoapVar($auth, SOAP_ENC_OBJECT);
$header = new SoapHeader($ns, 'ApiAuthentication', $headerBody);
$api->__setSoapHeaders(array($header));
//Create Request
$req->Frequency = 1;
$req->StartDate = 1;
$req->StopDate = 1;
$req->SpecificDayInterval = 1;
$req->CurrencyCode = "usd";
$req->WarehouseID = 1;
$req->ShipMethodID = 1;
$req->PriceType = 1;
$req->PaymentType = 1;
$req->ProcessType = 1;
$req->FirstName = "1";
$req->LastName = "1";
$req->Company = "1";
$req->Address1 = "1";
$req->Address2 = "1";
$req->Address3 = "1";
$req->City = "1";
$req->Zip = "1";
$req->County = "1";
$req->Email = "1";
$req->Phone = "1";
$req->Notes = "1";
$req->OverwriteExistingAutoOrder = 1;
$req->ExistingAutoOrderID = 1;
//Add Details
$detail1->ItemCode = "1";
$detail1->Quantity = 1;
$detail2->ItemCode = "2";
$detail2->Quantity = 2;
//Now attach the list to the request
req.Details = array(detail1,detail2);
$req->CustomerKey = "1";
$req->CustomFrequencyTy = 1;
//Send Request to Server and Get Response
$res = $api.CreateAutoOrder($req);
//Now examine the results:
}
catch (SoapFault $ex)
{
echo "Error: ", $ex->getMessage();
}
?>
Java
Note: Java is not officially supported.try
{
//Create Main API Context Object
ExigoApi api = new ExigoApi();
//Create Authentication Header
ApiAuthentication auth = new ApiAuthentication();
auth.setLoginName("yourLoginName");
auth.setPassword("yourPassword");
auth.setCompany("yourCompany");
api.setApiAuthenticationValue(auth);
//Create Request
CreateAutoOrderRequest req = new CreateAutoOrderRequest();
req.setFrequency(1);
req.setStartDate(1);
req.setStopDate(1);
req.setSpecificDayInterval(1);
req.setCurrencyCode("usd");
req.setWarehouseID(1);
req.setShipMethodID(1);
req.setPriceType(1);
req.setPaymentType(1);
req.setProcessType(1);
req.setFirstName("1");
req.setLastName("1");
req.setCompany("1");
req.setAddress1("1");
req.setAddress2("1");
req.setAddress3("1");
req.setCity("1");
req.setZip("1");
req.setCounty("1");
req.setEmail("1");
req.setPhone("1");
req.setNotes("1");
req.setOverwriteExistingAutoOrder(1);
req.setExistingAutoOrderID(1);
//Add Details
ArrayOfOrderDetailRequest details = new ArrayOfOrderDetailRequest();
OrderDetailRequest detail1 = new OrderDetailRequest();
detail1.setItemCode("1");
detail1.setQuantity(1);
details.Add(detail1);
OrderDetailRequest detail2 = new OrderDetailRequest();
detail2.setItemCode("2");
detail2.setQuantity(2);
details.Add(detail2);
//Now attach the list to the request
req.setDetails(details);
req.setCustomerKey("1");
req.setCustomFrequencyTy(1);
//Send Request to Server and Get Response
CreateAutoOrderResponse res = api.getExigoApiSoap().createAutoOrder(req, auth);
//Now examine the results:
}
catch (Exception ex)
{
System.out.println("Error: " + ex.getMessage());
}