I would like call the folowing method of a .NET web service from Dynamics AX
4:
runJob(String[] item);
Actually I m unable to define a String[] variable in Dynamics.
Somebody know how to define a String[] variable in AX?
Thanks
i not sure but i think there a two possible ways:
1.
The methods needs a string-array as parameter. Try to pass them a string
array.
To see how you can work with arrays in ax take a look at:
http://msdn.microsoft.com/en-us/library/aa653716.aspx
2.
Use some .NET functions/classes to call the method. Use "System.array" to
implement the array in AX (initialize an array and add data to it). Then pass
this ".NET" array to the webservice method.
Take a look at this article:
http://simon.butcher.name/archives/2007/02/22/Using-SOAP-via-a-.NET-in-Dynamics-AX
The article discribes the other way (working with webservie methods which
return an array) but i think it is a good point to start and to get an
overview on how it can work.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Please let us know if what Axel suggested works. I've tried similar ways in
the past and nothing worked.
Using System.Array worked fine for me to access arrays from the Web Service
but would not work passing the array to the Web Service.
In the end I created a .NET DLL which wrapped the web-service and added
methods that would accept one object at a time. In the DLL I would add that
object to an ArrayList. I created another method that converted the
ArrayList to an Array, so I called that method once I was done adding the
objects. Finally, I overloaded the web-service method which took the array
parameter and passed the Array that I was holding in the DLL.
If you find a better solution, I'd be interested to hear it because I
haven't been able to find one.
Good luck,
Adam
System.Collections.ArrayList arlist = new System.Collections.ArrayList();
arlist.Add('a');
/*you can try also arlist.ToArray*/
Generally for interoperabiltiy WS should be used generic types.
Regards Vladi