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 7717367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:52:47+00:00 2026-06-01T02:52:47+00:00

I am writing an ios app that talks to the asp.net server by using

  • 0

I am writing an ios app that talks to the asp.net server by using SOAP web services. one of my web service need to take array of objects. The object definitions are exactly the same on both sides.

Here is what I tried: When I passed just one object as the parameter, the web service worked fine. But as soon as I passed an array of the objects, I got nothing returned. I know the code inside the web service never get called which means the server failed to read the parameters. The wired thing is that the web service returned nothing so I cannot tell what’s wrong(I used to get error message from server showing me the stack trace when I did something wrong in the past).

I am not that familiar with SOAP web services so even though I spent a lot of time on MSDN, I still didn’t understand what’s wrong. After publish the web service, I accessed it through browser. I copied the whole thing to my iOS app so it should work in theory but it never did.

Anyway, this is the server side code:

[System.Web.Services.Protocols.SoapRPCMethod]
[WebMethod(EnableSession = true)]
[XMLInclude(typeof(Team))]
[XMLInclude(typeof(Team[]))]
[SoapInclude(typeof(Team))]
[SoapInclude(typeof(Team[]))]
public string testTeamWebService(Team[] teams) 
{
    // do something here
}

// class definition of Team
[Serializable]
public class Team
{
    public int TeamID;
    public string TeamName;
} 

According to the web service page(.asmx file), here is what I should do to call it:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://abc.com/" xmlns:types="https://abc.com/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

    <tns:testTeamWebService>
        <teams href="#id1" />
    </tns:testTeamWebService>

    <soapenc:Array id="id1" soapenc:arrayType="types:Team[2]">
         <Item href="#id2" />
         <Item href="#id3" />
    </soapenc:Array>

   <types:Team id="id2" xsi:type="types:Team">
       <TeamID xsi:type="xsd:int">int</TeamID>
       <TeamName xsi:type="xsd:string">string</TeamName>
   </types:Team>

   <types:Team id="id3" xsi:type="types:Team">
       <TeamID xsi:type="xsd:int">int</TeamID>
       <TeamName xsi:type="xsd:string">string</TeamName>
   </types:Team>
</soap:Body>
</soap:Envelope>

As I said, I constructed the xml and send it in iOS. I used NSMutableURLRequest object and the constructed xml is exactly the way I mentioned above.

In my other web services, I get object arrays from the server so I know .net can serialize the array. This is the first time that my service need to take an array as a parameter, so I think there must be a way of doing it.

Thanks for your reading and please give me some advice if you can.


I finally got the error message from server:

faultcode: soap:Server
 faultstring: System.Web.Services.Protocols.SoapException: Server was unable to process request.---> System.ArgumentException: Object of type 'System.Xml.XmlNode[]' cannot be converted to type 'abc.WebServices.Team[]'.
 at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
 at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
 at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
 at System.Web.Services.Protocols.WebServiceHandler.Invoke()
 --- End of inner exception stack trace ---
detail: 
  • 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-01T02:52:49+00:00Added an answer on June 1, 2026 at 2:52 am

    Here is the solution to my problem. Even though I don’t know exactly why my code didn’t work, what I know is when the parameter passed to .net server, it tried to guess what’s the object I passed. And somehow it got confused of the array of custom objects even though the custom class has been defined and declared at the beginning of the web method.

    To solve the real problem, I have a few options:
    <1> Pass the xml as a string and deserialize it at the server side manually.
    <2> Pass a dataset of data to the server.
    <3> Define my class as a XMLNode and pass it to the server.

    No matter which way I choose, I have to do some work to deserialize the xml properly.

    There is another way to do it.

    Since the server was only confused when I used RPC format for my SOAP message, what about another format? I tried the code below, and bingo, the server picked it up right away.

     [WebMethod]
     public string testTeamWebService(Team[] teams) 
    {
        // do something here
    }
    
    
    // class definition of Team
    [Serializable]
    public class Team
    {
        public int TeamID;
        public string TeamName;
    } 
    

    and then the xml request is formatted in this way:

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
    <testTeamWebService xmlns="http://tempuri.org/">
      <teams>
        <Team>
          <TeamID>int</TeamID>
          <TeamName>string</TeamName>
        </Team>
        <Team>
          <TeamID>int</TeamID>
          <TeamName>string</TeamName>
        </Team>
      </teams>
    </testTeamWebService>
    

    Here I wanna specially thanks Peter pi – MSFT from Microsoft for helping me with this problem and here is the link on asp.net:

    http://forums.asp.net/t/1784291.aspx/1?asp+net+SOAP+RPC+web+method+could+not+read+object+array+parameter

    Hope my post can help some people who meets the same problem.

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

Sidebar

Related Questions

I am writing an app that publishes pictures on Facebook using facebook-ios-sdk, but everytime
I tried writing an app that samples the microphone using code from http://code.google.com/p/ios-coreaudio-example/ (Core
I'm writing an iOS 5 app (in Xcode 4.3, using Storyboards and ARC) that
I am writing an iOS app that uses live audio analysis. It has an
I'm currently writing an iOS app and I have many records that I'm writing
I need to add a method to an app I am writing that only
I've just started writing tests for my iOS app, I'm using Xcode4 and OCUnit.
I'm currently writing a mobile app (hopefully iOS or android) using the jquery mobile
In an iOS app, I'm writing a class that will be messaged, go do
I'm currently writing an iOS app that uses a UIWebView for surfing around pages.

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.