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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:23+00:00 2026-05-28T03:58:23+00:00

am trying to connect to a web service in order to retrieve some data

  • 0

am trying to connect to a web service in order to retrieve some data with an android device with ksoap2. i assume that i have make the configuration correct and the result that i get back from the web service is anyType{} the code that i use is the below

private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String URL = "http://IP/CardiacPortalWS/VitalInfoWS.asmx";
private static final String HelloWorld_SOAP_ACTION = "http://tempuri.org/getPatient";
private static final String METHOD_NAME1 = "getPatient";

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);

    request.addProperty("patientID",8);

    SoapSerializationEnvelope envelope =new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true; 
    envelope.setOutputSoapObject(request);
    AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
    androidHttpTransport.debug=true;
    SoapObject receivedString=null;
    try
    {
       androidHttpTransport.call(HelloWorld_SOAP_ACTION, envelope);
       receivedString = (SoapObject)envelope.getResponse();
       Log.v("Server", "server data1 "+receivedString.getPropertyCount());
       Log.i("Server", "server data2 "+receivedString.getProperty(0));
    }
    catch(Exception e)
    { }  

The SOAP file is

SOAPAction: “http://tempuri.org/getPatient”

<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>
    <getPatient xmlns="http://tempuri.org/">
      <patientID>int</patientID>
      <name>string</name>
      <SID>string</SID>
      <sex>boolean</sex>
      <birthday>dateTime</birthday>
      <nationality>string</nationality>
      <telephone>string</telephone>
      <telephone1>string</telephone1>
      <email>string</email>
      <maritalStatusName>string</maritalStatusName>
      <educationName>string</educationName>
      <ejectionFraction>int</ejectionFraction>
      <profession>string</profession>
      <deathDateTime>dateTime</deathDateTime>
      <deathReason>string</deathReason>
      <isDead>boolean</isDead>
    </getPatient>
  </soap:Body>
</soap:Envelope>

<?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>
    <getPatientResponse xmlns="http://tempuri.org/">
      <getPatientResult>
        <message>string</message>
        <code>int</code>
      </getPatientResult>
      <name>string</name>
      <SID>string</SID>
      <sex>boolean</sex>
      <birthday>dateTime</birthday>
      <nationality>string</nationality>
      <telephone>string</telephone>
      <telephone1>string</telephone1>
      <email>string</email>
      <maritalStatusName>string</maritalStatusName>
      <educationName>string</educationName>
      <ejectionFraction>int</ejectionFraction>
      <profession>string</profession>
      <deathDateTime>dateTime</deathDateTime>
      <deathReason>string</deathReason>
      <isDead>boolean</isDead>
    </getPatientResponse>
  </soap:Body>
</soap:Envelope>

i assume that the problem is in this line request.addProperty(“patientID”,8); but am not sure. data on the server exist because am able to see them.
i would appreciate some help, an idea or a more detail tutorial

  • 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-28T03:58:23+00:00Added an answer on May 28, 2026 at 3:58 am

    Correct code

    private static final String NAMESPACE = "http://tempuri.org/" ;
    private static final String URL = " http://IP/CardiacPortalWS/VitalInfoWS.asmx";
    private static final String SOAP_ACTION = "http://tempuri.org/userLogin";
    private static final String METHOD_NAME = "userLogin";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        try {
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            request.addProperty("PatientID", "10");
            request.addProperty("Weight", "72");
            String currentDateTimeString = new SimpleDateFormat("yyyy-MM-dd").
                format(new Date());
            request.addProperty("DateTimeStamp",currentDateTimeString);//"2012-01-13");
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
            envelope.dotNet=true;
            envelope.setOutputSoapObject(request);
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.call(SOAP_ACTION, envelope);
            Log.i("Server", "server data2 "+((Object)envelope.getResponse()));  
        } catch(Exception e) {
            Log.e("Server", "Error on server "+e.getMessage());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to connect to a web service that uses a secure connection.
I'm building a web-service for an Android application that needs to connect to a
I am trying to create an android app that will connect to various web
I am trying to make an Android/ Java application that needs to connect to
The author of a web-service that I am trying to connect to, tells me
I'm trying to connect to a web service using IO::Socket::INET (yes, I know that
I have been trying to connect to some web services using WCF but I
I am trying to connect to Yudu's web service via soap/php. When I send
I am trying to write an Android app to connect to an existing web
I am trying to write some unit tests for a small web service written

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.