Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Call a web service with String[] argument

2 views
Skip to first unread message

Snoop01

unread,
Nov 12, 2008, 1:02:05 PM11/12/08
to
Hi,

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

Axel Kühn

unread,
Nov 12, 2008, 2:30:09 PM11/12/08
to
Hi,

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)

Adam

unread,
Nov 12, 2008, 3:20:34 PM11/12/08
to
Hi,

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

Vladi

unread,
Nov 13, 2008, 2:36:01 AM11/13/08
to
Hi,
try to use ArrayList collection, that should produce dataset in Soap
message, but cann work with net web service

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

aclift

unread,
Dec 16, 2009, 10:26:01 AM12/16/09
to
0 new messages