Create a AIF Service
1. create a DataContract Class PaymentStatusViewContract
3. Add a service "GetInvoicePaymentStatus" under AOT
Then add Operation "RetreivePaymentStatus" by rightclick on Operations
4. Add A Service Group, and add the "GetInvoicePaymentStatus" new Service Group
5. Deploy Service group by right click and Deploy service Group
Your service is available from AX. Get the WSDL and copy to clipboard
6. Open VisualStudio
1. create a DataContract Class PaymentStatusViewContract
[DataContractAttribute]class PaymentStatusViewContract{InvoiceId invoiceId;str status;}
[DataMemberAttribute]public InvoiceId invoiceId(invoiceId id = invoiceId){invoiceId = id;return invoiceId;}
[DataMemberAttribute]
public str paymentJournal(str state = status)
{
status = state;
return status;
}
public static PaymentStatusViewContract construct()
{
return new PaymentStatusViewContract();
}2. Create a Service Contract class
class PaymentStatusViewServiceClass
{
}
[SysEntryPointAttribute(true)]public PaymentStatusViewContract RetreivePaymentStatus(InvoiceId id){PaymentStatusViewContract contract = PaymentStatusViewContract::construct();KG_GetAllInvoicesView v; // this is a view in my projwhile select * from v where v.Invoice == id{ contract.invoiceId(id);contract.paymentJournal(v.Status1);return contract; }contract.invoiceId(id);contract.paymentJournal("No Record Found");return contract;}
3. Add a service "GetInvoicePaymentStatus" under AOT
Then add Operation "RetreivePaymentStatus" by rightclick on Operations
4. Add A Service Group, and add the "GetInvoicePaymentStatus" new Service Group
5. Deploy Service group by right click and Deploy service Group
Your service is available from AX. Get the WSDL and copy to clipboard
6. Open VisualStudio
- Create Console application
- Add Service reference(with copied WSDL)
- Now you can access the service
7. Add below code