Export Table Data in XML through AIF Document Services

Hi,

 

I am working on Ax 2012 R3

I have one custom table with two fields Id and Name.

Now I have to export the data through AIF services kindly suggest any idea I am new to services.

 

Thanks

Haribabu

  • You can use the document service wizard to create a service, you need a query for that.
    technet.microsoft.com/.../aa609947.aspx
  • In reply to Kranthi:

    Hi Kranthi,

    Thanks for your reply.

    I have created query and document service through the wizard for the query.

    I could generate the xml schema by running the generated job.

    Could you please let me know how to export the data into xml by using this service.

    Thanks
    Haribabu
  • In reply to Hariyadav:

    Create an outbound port by using file system adapter.
    technet.microsoft.com/.../hh352313.aspx
  • In reply to Kranthi:

    In the above link only mentioned about sending the xml data(they have used create service in inbound port) to create sales order.I want to export the data from my custom table as an xml file to create in particular folder from out bound port ..

    Please let me know which service I need to use is it customservice.read or customservice.create in outbound port..

    Please explain..

    Thanks
    Hari
  • In reply to Hariyadav:

    service.read, service.find
  • In reply to Kranthi:

    do you mean I need to create to out bound ports?
  • In reply to Kranthi:

    do you mean I need to create two outbound ports?
  • In reply to Hariyadav:

    One outbound port with two service operations in it. A port can have more than one service operation.
  • In reply to Kranthi:

    Hi Kranthi,

    Understand and created an outbound port with service.find and service.read service operations.

    In the data policies I have selected all fields but xml file hasn't generated in the specified folder.

    My custom table dont have any indexes is it mandatory to have index for the table?

    Please let me know.

    Thanks
    Haribabu
  • In reply to Hariyadav:

    If there are no index the system will create RecID index.
    msdn.microsoft.com/.../bb278358.aspx
  • In reply to Hariyadav:

    How you are triggering the out bound port? Did you added the batch jobs that are required to send the document?

    You can trigger by using the below code,

    protected void senByAIF()
    {
    AifConstraint aifConstraint = new AifConstraint() ;
    AifConstraintList aifConstraintList = new AifConstraintList();
    AifActionId actionId;
    AifEndpointList endpointList = new AifEndpointList();
    Query query;

    query = new Query(queryStr(YourQuery));

    actionId = AifSendService::getDefaultSendAction(classnum(YourServiceClass), AifSendActionType::SendByQuery);

    aifConstraint.parmType(AifConstraintType::NoConstraint);
    aifConstraintList.addConstraint(aifConstraint);

    endpointList = AifSendService::getEligibleEndpoints(actionId, aifConstraintList);

    AifSendService::submitFromQuery(actionId, endpointList, query, AifSendMode::Async);
    }

  • In reply to Kranthi:

    I have created batch jobs for two classes those are AifGatewaySendService and AifOutboundProcessingService

    is it enough or do I need to run the above job that you suggested?

    Thanks
    Hari
  • In reply to Kranthi:

    Have you put anything into the outbound queue? No file will be generated if there is nothing to export.
  • In reply to Hariyadav:

    You need similar code to create send requests.
    AifGatewaySendService and AifOutboundProcessingService - these classes processes the send requests
  • In reply to Kranthi:

    Now Do I need to create record in queue manager ?if yes could you please suggest code ?
Related
Recommended