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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:45:56+00:00 2026-06-02T01:45:56+00:00

I am struggling to send parameters to a VB.NET WS(web service) that is hosted

  • 0

I am struggling to send parameters to a VB.NET WS(web service) that is hosted on Windows Azure. Getting a simple hello world (no parameters) works fine, but for some reason my parameters on the web service side are null?

Web service function to be called (IService1.vb):

<OperationContract()>
Function GetAddition(ByVal number1 As Integer, ByVal number2 As Integer) As String

Function implementation (Service1.svc.vb):

Function GetAddition(ByVal number1 As Integer, ByVal number2 As Integer) As String  Implements IService1.GetAddition
    Return number1 + number2
End Function

Android client code:

import java.util.ArrayList;

import android.app.*;
import android.os.*;
import android.widget.TextView;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

public class Test2Activity extends Activity {
TextView tv;

private static final String SOAP_ACTION = "http://tempuri.org/IService1/";    
private static final String NAMESPACE = "http://tempuri.org/";    
private static final String URL = "http://a42c90a9e3e74fffa7b0093001f51de8.cloudapp.net/Service1.svc";    

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    System.setProperty("http.keepAlive", "false");
    tv=(TextView)findViewById(R.id.textView1);               

    ArrayList<Object> tmpParam = new ArrayList<Object>();
    tmpParam.add(1);
    tmpParam.add(4);

    String result = call("GetAddition", tmpParam, new String[]{"number1","number2"});
    //String result = call("GetHello", new ArrayList<Object>(), new String[]{""}); //works

    tv.setText(result);


    }

public String call(String methodName, ArrayList<Object> arrParameterValues, String arrParameterNames[])
{
    try {

        SoapObject request = new SoapObject(NAMESPACE, methodName);

        for (int k = 0;k < arrParameterValues.size() ; k++){
            PropertyInfo tmp = new PropertyInfo();
            tmp.setName(arrParameterNames[k]);
            tmp.setValue(arrParameterValues.get(k));
            tmp.setType(int.class); //hard coded for now
            request.addProperty(tmp);
        }
        //tried
        /*
        request.addProperty("number1",1);
        request.addProperty("number2",1);
        */

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.call(SOAP_ACTION.concat(methodName) , envelope);

        //If an XmlPullParserException occurs, retry once in order to workaround an Android emulator bug
        try {
            androidHttpTransport.call(SOAP_ACTION.concat(methodName), envelope);
        } 
        catch(XmlPullParserException ex) {
            ex.printStackTrace();

            androidHttpTransport.call(SOAP_ACTION.concat(methodName), envelope);
        }

        Object result = envelope.getResponse();                 
        return result.toString();
    }
    catch(Exception ex) {
        return ex.toString();
    }
}   
}//end of class    

The value returned is 0. With other string parameterized functions, no strings are received on the client.

I am using ksoap2-android-assembly-2.6.2-jar-with-dependencies, Android 2.1 and am developing in Eclipse 3.7.2. The web service was built in Visual Studios 2010

Some of you might be thinking: “Why VB and not C#?!” The reason is because I already have some experience in VB 🙂

Thanks

  • 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-02T01:45:58+00:00Added an answer on June 2, 2026 at 1:45 am

    Can you pass parameters using a method like in the following question:

    How to call a WCF service using ksoap2 on android?

    Like:

     try {
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
    
        request.addProperty("Name", "Qing"); 
    
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( 
                SoapEnvelope.VER11); 
        envelope.dotNet = true; 
        envelope.setOutputSoapObject(request); 
    
    
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); 
        androidHttpTransport.call(SOAP_ACTION, envelope); 
        SoapPrimitive result = (SoapPrimitive)envelope.getResponse(); 
    
        //to get the data 
        String resultData = result.toString(); 
        // 0 is the first object of data  
    
    
        sb.append(resultData + "\n"); 
     } catch (Exception e) { 
        sb.append("Error:\n" + e.getMessage() + "\n"); 
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been struggling with getting this syntax right to send mail using Godaddy. Any
Been struggling with this simple selector problem a couple of hours now and must
im struggling with syntax here: hopefully this question is v simple, im just miising
I have been struggling with trying to send an email with an attachment using
I'm struggling with encoding issues when i send an Ajax Post to a server
So I've been struggling with web-services for a couple of days now, and It
I am struggling with a bit of dojo that is needed to upload a
I have been struggling to send emails form within a Haskell program for a
I am struggling to send mails through PHP, running on IIS7. I have an
I'm building a system that will send verses of scripture to subscribers over e-mail.

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.