2022

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 public class CustomerFilter{
     public CustomerFilter(){}
     public String key;
     public String No;
     public String Name;
}

12. Open Method 

This method is the place where all the authentication happens. Each AppCode can by default take the following three parameters as Adapter Properties

Code Block

userName = ctx.getPropertyAsString("username"); //User name for accessing service
password = ctx.getPropertyAsString("password"); //Password for accessing the service
baseURL = ctx.getPropertyAsString("baseURL"); //BaseUrl for making the soap call
In this method the actual authentication happens which is more of a one time in the reader and writer call
Authenticator.setDefault(new MyAuthenticator());
           try {
                log.finer("Customer Service: INIT");
                URL customerURL = new URL(baseURL + "/CustomerCard");
                QName customerQName = new QName(
                           "urn:microsoft-dynamics-schemas/page/customercard",
                           "CustomerCard_Service");
                CustomerCardService customerCardService = new CustomerCardService(customerURL, customerQName);
                customerCardPort = customerCardService.getCustomerCardPort();
                log.finer("SalesInvoice Service: INIT");
                URL salesInvoiceURL = new URL(baseURL + "/SalesInvoice");
                QName salesInvoiceQName = new QName("urn:microsoft-dynamics-schemas/page/salesinvoice","SalesInvoice_Service");
                SalesInvoiceService sis = new SalesInvoiceService(salesInvoiceURL,salesInvoiceQName);
                sip = sis.getSalesInvoicePort();
                batchSize = Integer.parseInt(ctx.getPropertyAsString("batchSize"));
           } catch (Exception e) {
                log.log(Level.SEVERE,
                           "Customer/SalesInvoice Service Initialization Failed", e);
                e.printStackTrace();
                throw new RemoteException("Customer/SalesInvoice Service Initialization Failed", e);
          }