First of all, we can check in AIF Services Form the standar service called LedgerGeneralJournalService.
We can see the status NoError, that is good.
Now, we need to create a EndPoint, let us check the AIF EndPoint Form
In this case we are going to use a File System Adapter in the field Adapter.
Now, we can choose the service, so we need to click the Service Operations Button.
And then, we select de data polices button.
We will mark all the fields that we will need in the schema, and we will show the schema
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/dynamics/2008/01/documents/LedgerGeneralJournal" xmlns:st="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/documents/LedgerGeneralJournal" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="SharedTypes.xsd" namespace="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" />
<xs:element name="LedgerGeneralJournal" type="tns:AxdLedgerGeneralJournal" />
<xs:complexType name="AxdLedgerGeneralJournal">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="LedgerJournalTable" type="tns:AxdEntity_LedgerJournalTable" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="AxdEntity_LedgerJournalTable">
<xs:sequence>
<xs:element minOccurs="1" name="JournalName" type="st:AxdExtType_LedgerJournalNameId" />
<xs:element minOccurs="0" name="Name" nillable="true" type="st:AxdExtType_Name" />
<xs:element minOccurs="0" maxOccurs="unbounded" name="LedgerJournalTrans" type="tns:AxdEntity_LedgerJournalTrans" />
</xs:sequence>
<xs:attribute fixed="entity" name="class" use="required" />
<xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
</xs:complexType>
<xs:complexType name="AxdEntity_LedgerJournalTrans">
<xs:sequence>
<xs:element minOccurs="0" name="AccountType" nillable="true" type="st:AxdEnum_LedgerJournalACType" />
<xs:element minOccurs="0" name="AmountCurCredit" nillable="true" type="st:AxdExtType_AmountCurCredit" />
<xs:element minOccurs="0" name="AmountCurDebit" nillable="true" type="st:AxdExtType_AmountCurDebit" />
<xs:element minOccurs="0" name="Company" nillable="true" type="st:AxdExtType_SelectableDataArea" />
<xs:element minOccurs="0" name="DefaultDimension" nillable="true" type="st:AxdType_DimensionAttributeValueSet" />
<xs:element minOccurs="0" name="LedgerDimension" nillable="true" type="st:AxdType_MultiTypeAccount" />
<xs:element minOccurs="0" name="OffsetDefaultDimension" nillable="true" type="st:AxdType_DimensionAttributeValueSet" />
<xs:element minOccurs="0" name="TransDate" nillable="true" type="st:AxdExtType_TransDate" />
<xs:element minOccurs="0" name="Txt" nillable="true" type="st:AxdExtType_LedgerJournalTransTxt" />
</xs:sequence>
<xs:attribute fixed="entity" name="class" use="required" />
<xs:attribute name="action" type="st:AxdEnum_AxdEntityAction" />
</xs:complexType>
</xs:schema>
Schema PLZ...
We need to Active the EndPoint
(Some dude is making a bad job and the CIL knows it)
And now, we will build the XML FILE.
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<Header>
<MessageId>{429AA009-09D4-45A9-BB2B-14DF0DFD3D92}</MessageId>
<LogonAsUser>NETWORK\jarizmendi</LogonAsUser>
<Company>ara</Company>
<Action>http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/create</Action>
<RequestMessageId>
</RequestMessageId>
</Header>
<Body>
<MessageParts xmlns="http://schemas.microsoft.com/dynamics/2011/01/documents/Message">
<LedgerGeneralJournal xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/LedgerGeneralJournal">
<LedgerJournalTable class="entity">
<JournalName>CPFCob</JournalName>
<Name>COMISION DE COBRANZA </Name>
<LedgerJournalTrans class="entity">
<AccountType>Ledger</AccountType>
<AmountCurCredit>0.00</AmountCurCredit>
<AmountCurDebit>54779.00</AmountCurDebit>
<Company>ara</Company>
<DefaultDimension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
<LedgerDimension>
<DisplayValue xmlns="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes">20301000-01001-AC0001-1102020801-CATA</DisplayValue>
<Account xmlns="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes">20301000</Account>
<Values xmlns="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes">
<Value>
<Name>ACentrodeCosto</Name>
<Value>01001</Value>
</Value>
<Value>
<Name>BEmCoPoTr</Name>
<Value>AC0001</Value>
</Value>
<Value>
<Name>DRegion</Name>
<Value>1102020801</Value>
</Value>
<Value>
<Name>ECategoria</Name>
<Value>CATA</Value>
</Value>
</Values>
</LedgerDimension>
<TransDate>2015-03-18</TransDate>
<Txt>Bonificación a Prteador X Compr. Dep.</Txt>
</LedgerJournalTrans>
</LedgerJournalTable>
</LedgerGeneralJournal>
</MessageParts>
</Body>
</Envelope>
Check the structure, first we have Message header with the follow structure.
<Header>
<MessageId>{429AA009-09D4-45A9-BB2B-14DF0DFD3D92}</MessageId>
<LogonAsUser>NETWORK\jarizmendi</LogonAsUser>
<Company>ara</Company>
<Action>http://schemas.microsoft.com/dynamics/2008/01/services/GeneralJournalService/create</Action>
<RequestMessageId>
</RequestMessageId>
</Header>
Check the Action, it is formed by the namespace + external name of the service + the action of the service
The body has the Document tags in the same order of the schema.
The XML now is in the directory and the service is Active, just run the follow code:
void JCJob()
{
Args args;
AifGatewayReceiveService agrs = new AifGatewayReceiveService();
AifInboundProcessingService aip = new AifInboundProcessingService();
AifGatewaySendService agss = new AifGatewaySendService();
AifOutboundProcessingService aop = new AifOutboundProcessingService();
;
agrs.run();
aip.run();
agss.run();
aop.run();
}
And the result is:
WOW
I know... the Journal is uncompleted.
No comments:
Post a Comment