Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:26:26+00:00 2026-06-11T16:26:26+00:00

I have a .NET web service which I would like to have accept either

  • 0

I have a .NET web service which I would like to have accept either List<int> foo or int[] foo. I’ve tried declaring the paramater as each of those types, but it is converted to an ArrayOfInt after being ran through the serializer.

I have another web service which is implemented differently (old, moving to new structure) and, as such, it does not use System.Runtime.Serialization to generate its reference. This has the beneficial side-effect of not turning an int[] parameter into ArrayOfInt.

Interestingly enough, my web service’s method happily returns int[]. It just will not accept int[] as parameter:

[WebMethod(Description = "Gets a list of Tasks from a list of Order IDs.")]
public List<TaskDto> GetTasksByIDList(int[] idList)
{
    return new List<TaskDto>();
}

[Test]
public void GetTasksByIDList()
{
    Task taskDto = WorkflowServices.CreateInstallTask(OrderID, TaskTemplateID, SiteID, DataCenterID,
                                                         DeviceTemplateID, DeviceName, Username);

    Task secondTaskDto = WorkflowServices.CreateInstallTask(OrderID, TaskTemplateID, SiteID, DataCenterID,
                                             DeviceTemplateID, DeviceName, Username);

    ArrayOfInt idList = new ArrayOfInt{ taskDto.ID, secondTaskDto.ID };

    List<Task> tasks = WorkflowServices.GetTasksByIDList(idList).ToList();

    if (tasks.Count() != idList.Count())
        throw new Exception(string.Format("Failed to find {0} tasks by ID. Received: {1}", idList.Count(), tasks.Count()));
}

Any ideas on how I can convince my service to accept int[] instead of ArrayOfInt? I do not want an end user to have to understand what/why an ArrayOfInt collection is necessary for only some scenarios and not others.

UPDATE:

Here’s some more information regarding this issue. First, a screenshot of a web service I consider to be generated properly. Note that the WSDL declaration indicates ArrayOfInt, but it is still interpreted as int[]:

enter image description here
Now, by contrast:

enter image description here

And here’s the top of each of their Reference.cs files. Note that the ‘good’ service reference is generated using ServiceModel, but the ‘bad’ service reference does not.

namespace CableSolve.Web.Api.Tests.ComponentServicesProxy {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.cormant.com/cswebapi", ConfigurationName="ComponentServicesProxy.ComponentServicesSoap")]
public interface ComponentServicesSoap {

namespace CableSolve.Web.Api.Tests.WorkflowServicesProxy {
    using System.Runtime.Serialization;
    using System;
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    [System.Runtime.Serialization.DataContractAttribute(Name="Order", Namespace="http://www.cormant.com/cswebapi")]
    [System.SerializableAttribute()]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:26:27+00:00Added an answer on June 11, 2026 at 4:26 pm

    The solution was to ensure that at least one complex type inside of my WebService derived from a class or was a class which is abstract. Failure to have a class which is abstract causes the serializer to opt for System.Runtime.Serialization as the serialization engine of choice, but by including an abstract class it is forced to use System.ServiceModel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ASP.NET web apps and 1 wcf web service. I would like to
I have a .net web application which has a reference to a web service.
I have an ASP.net web service that I'm using for a web application which
I have a Silverlight 3 application which calls a traditional .NET Web Service (asmx)
We have an ASMX web service which we invoke from our ASP.NET application using
I have a .net JSON web service which returns a json string when queried.
I have an ASP.Net MVC site, which connects to a web service. The site's
I have a .NET Web Service running in VS2005 and a client that consumes
I have a .NET web service (using asmx...have not upgraded to WCF yet) that
i have an ASP.NET web service that returning a custom entity object (Staff): [WebMethod]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.