Hi guys,
can you please guide me in testing of “netTcp” aif web service. I have created AIF inbound wsdl port.
we will pass data in xml to this aif web service, which will creates data in AX.
Scenario:
Input: data in xml
Action/output/response: This will creates data in AX. Gives no response.
Find below screenshot for reference.
For example, you can create a console application in Visual Studio, add a service reference and call the service.
Note that this allows object-oriented programming, therefore you should rather think about objects than the format used for serialization under the hood (XML).
Thanks Martin for your inputs. I am not familiar with this type of work.
Highly appreciable, if some one guide or share any blogs, which demonstrates testing
of this scenario, taking data in xml and creates records in AX
Where did you get stuck? For example, do you know how to create a project and add a service reference?
We can’t help you with your problem unless you tell us what it is.
Thanks Martin for continuous support.
(Just for information, earlier we are using file system adapter for this inbound operation where we will give xml as input. now created NetTcp inbound port by adding service class ‘create’ operation. this service class was created through aif wizard ‘create document service’ using query)
I have created console project and added service reference, now we need to test this service by passing data, Attaching below screenshots for reference
You’ll find a client class inside CreateStagingDataService namespace. It has a method representing your service operation. You didn’t give us details necessary to write the code, but it’ll look roughly like this:
using SalesOrderReportTeting.CreateStagingDataService;
namespace SalesOrderReportTeting
{
class Program
{
CreateStagingDataServiceClient client = new CreateStagingDataServiceClient();
MyServiceRequest request = new MyServiceRequest();
request.Property1 = "value 1";
client.myServiceOperation(request);
}
}
Here you have an example using the standard document service for sales orders: Creating sales orders via AIF in AX2012.
Thanks so much Martin.
I am calling client service operation (client.create) as you suggested, it was asking two parameters, callContext and AxdIDSInventTransferTable.
Struggling bit here in passing values, thinking and searching here and there.
Attaching below three screenshots for reference, (just for information, query used in service has three data sources)
Highly appreciate your inputs.
Thanks.
Could you elaborate your problem, please? The statement “I’m struggling” isn’t very specific. We can’t help you don’t explain your problem.
Hi Martin,
In request properties, i have 4,5 functions, I didn’t find where to pass all the values which you could see in xml screenshot of previous reply.
can you please help here.
Find screenshot below.
Your XML document contains a node called IDSInventTransferTable. And your screenshots shows a property of exactly the same name. So far so good, isn’t it?
Your screenshot also shows you the type - AxdIDSInventTransferTable. Create an instance of this class, populate it with values and set it to the property. It’s no magic here, just the usual object oriented programming.
For example:
AxdIDSInventTranferTable transferTable = new AxdIDSInventTranferTable();
transferTable.SenderId = 964;
request.IDSInventTranferTable = transferTable;
Now I am able to test and data created in AX, but real and Date type values are not taking what we passed from visual studio, getting default values. working for other types such as string…etc
Can you help here, not sure why values are not taking and getting default values 0.
Find the screenshot for reference.
Thank you…
Thank you…
Debug the document service in AX to see if it receives correct values from outside. Maybe it does but then it doesn’t process them as you expect.
By the way, there should be no need to use Convert class to assign a decimal value. Doesn’t bufferReceiptLine.LineRowNumber = 10 work for you? If you prefer, you don’t have to parse strings to datetime either. You can use new DateTime(2020, 11, 2), for instance.
I need one favour here, One table header may contains multiple lines like salestable and salesLine.
could you please help a bit, how we could write code in c# in this case.
Attaching screenshots for the reference.
Your service doesn’t seem to be related to either SalesTable or SalesLine. You have a AxdIDSInventTransferTable, which contains an array of MessageTable object. Each MessageTable objects then contains an array of BufferReceiptTable objects, and each of them contains and array of BufferReceiptLine objects.
Do you mean that you don’t know how to use arrays? You can learn basics here.
Here is a concrete example:
// Declare an array
var arrayOfLines = new AxdEntity_BufferReceiptLine[2];
// Set the first line
arrayOfLines[0] = new AxdEntity_BufferReceiptLine()
{
ItemId = "Item1";
};
// Set the second line
arrayOfLines[1] = new AxdEntity_BufferReceiptLine()
{
ItemId = "Item2";
};
// Assign the array of lines to the header
bufferReceiptTable.BufferReceiptLine = arrayOfLines;
Thanks so and highly appreciate your inputs.