Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Get data when Web Service returns array

$
0
0
Hey Gang,

I'm consuming a web service and all seems to be working well. However, I came across one element that returns an array of objects instead of a single object. I'm not quite grasping what I need to do to get all those objects into an array that I can do something with. Here's the code I'm using:

        public void GetVectorInfoFromCm()
        {
            sms.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["CMUsername"], ConfigurationManager.AppSettings["CMPassword"]);
            submitRequestType request = new submitRequestType();
            request.operation = "display";

            modelChoices choices = new modelChoices();
            ArrayList fields = new ArrayList();

            VectorType myVector = new VectorType();
            myVector.VectorNumber = "";
            myVector.VectorName = "";

            fields.Add(myVector);

            choices.Items = fields.ToArray();
            request.modelFields = choices;
            request.qualifier = "10";

            try
            {
                returnType result = sms.submitRequest(request);
                ExtractAgentLoginIdExtensionsFromCMResult(result);
            }
            catch (Exception e)
            {
                string myExcept = e.Message;
            }

            //GridView2.AutoGenerateColumns = true;
            //GridView2.DataSource = dt;
            //GridView2.DataBind();

            sms.release(sms.sessionID.ToString());
        }


This is connecting to a web service on an AVAYA AES server. To return an object, you have to assign it an empty string...hence the reason for this:

            VectorType myVector = new VectorType();
            myVector.VectorNumber = "";
            myVector.VectorName = "";


since both the VectorNumber and VectorName are single objects, my code works. However, when I try to introduce this:

myVector.VectorStep = "";


I get an error: "Error 1 Cannot implicitly convert type 'string' to 'ConnectToAES.AesSmsService.arrayType[]'"

Can anyone point me in the right direction as to what I need to do?

Thanks for any help!

Dave

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>