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

  • Home
  • SEARCH
  • 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 512587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:20:06+00:00 2026-05-13T07:20:06+00:00

i’ve got the following simple webservice : [WebMethod()] public int Add(int a) { return

  • 0

i’ve got the following simple webservice :

     [WebMethod()]
public int Add(int a)
{
    return a + 1;
}

i’ve created a class to call it (without creating a wsdl and then a proxy).
something like:

 [System.Web.Services.WebServiceBindingAttribute(
Name = "Addrequest",
Namespace = "GenieSoft")]
public class Addrequest :
System.Web.Services.Protocols.SoapHttpClientProtocol
{
public Addrequest()
{
    this.Url = "http://localhost:3880/SoapService/Service.asmx";
}
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
"GenieSoft/Add",
RequestNamespace = "GenieSoft",
ResponseNamespace = "GenieSoft",
Use = System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public  object[] Add(int a )
{
    object[] results = this.Invoke("Add",new object[] { a });
    return results;
}
}

i create an object of the class and then try to call the webservice as follows:

  Addrequest request = new Addrequest();
    object[] returnedArray =  request.Add(1);

     //object i = returnedArray[0]; // i is equal to  {object[0]} !
    lblresult.InnerText = returnedArray[0].ToString();

i’ve tested it with debug locally and the webservice is getting called and receiving the sent int “1” and returning “2” , however when i try to check the returnedArray all i find is {object[0]} which as i understand is another array of size 0 .

Can someone help me, by pointing out the problem ?

Note: i got this example of the book Programming Web Applications with Soap by O’Reilly , i only changed it from string to int , and i’ve tested it both ways -as a string and as an int- and got the same result for both tests.

  • 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-05-13T07:20:06+00:00Added an answer on May 13, 2026 at 7:20 am

    I figured out the problem, Obviously the return dataType of the calling function causes the problem ( object[] ) ,while it is (int) in the webservice . to solve the problem i modified the webservice to return an object[] instead of an int (could’ve also modified the Add in the calling class to return int) something like this :

    public object[] Add(int a)
    {
        object[] objects = { a + 1 };
        return objects;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 241k
  • Answers 241k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First of all, I think you might be confusing a… May 13, 2026 at 7:20 am
  • Editorial Team
    Editorial Team added an answer So add max(TrackRecord.date_record)? Be careful with that NOT IN, btw.… May 13, 2026 at 7:20 am
  • Editorial Team
    Editorial Team added an answer Technically, this would be possible, but difficult, since the only… May 13, 2026 at 7:20 am

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.