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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:52:30+00:00 2026-06-07T21:52:30+00:00

I have problem to connect my Web Service from the android app. Maybe I

  • 0

I have problem to connect my Web Service from the android app. Maybe I use wrong Parameters?

Activity:

public class MainActivity extends Activity {

final private String METHOD_NAME = "getMenuePlan";
final private String NAMESPACE = "http://webservice.kantine.de/";
final private String SOAP_ACTION = "\"" + NAMESPACE + METHOD_NAME + "\"";
final private String URL = "http://10.0.2.2:8080/Kantine/MenuePlan?wsdl";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

    envelope.setOutputSoapObject(request);

    HttpTransportSE httpTransport = new HttpTransportSE(URL);
    SoapObject result = null;


    try {

        httpTransport.call(SOAP_ACTION, envelope);
        result = (SoapObject) envelope.getResponse();

    } catch (SoapFault e) {

        Log.e("error", "", e);

    } catch (IOException e) {

        Log.e("error", "", e);

    } catch (XmlPullParserException e) {

        Log.e("error", "", e);

    }

    if (result != null) {
        Log.i("Result", result.toString());
    } else {
        Log.i("Result", "null");
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}

}

WSDL:

<wsdl:definitions name="KantineWSImplService" targetNamespace="http://webservice.kantine.de/"><wsdl:types><xs:schema elementFormDefault="unqualified" targetNamespace="http://webservice.kantine.de/" version="1.0"><xs:element name="getMenuePlan" type="tns:getMenuePlan"/><xs:element name="getMenuePlanResponse" type="tns:getMenuePlanResponse"/><xs:complexType name="getMenuePlan"> [...]

Exception:

    7-19 10:58:10.287: E/AndroidRuntime(1008): FATAL EXCEPTION: main
07-19 10:58:10.287: E/AndroidRuntime(1008): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.wstest/com.example.wstest.MainActivity}: android.os.NetworkOnMainThreadException
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.os.Looper.loop(Looper.java:137)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread.main(ActivityThread.java:4745)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at java.lang.reflect.Method.invokeNative(Native Method)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at java.lang.reflect.Method.invoke(Method.java:511)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at dalvik.system.NativeStart.main(Native Method)
07-19 10:58:10.287: E/AndroidRuntime(1008): Caused by: android.os.NetworkOnMainThreadException
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1117)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:84)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.io.IoBridge.connectErrno(IoBridge.java:144)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.io.IoBridge.connect(IoBridge.java:112)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at java.net.Socket.connect(Socket.java:842)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpConnection.<init>(HttpConnection.java:76)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:341)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:188)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at org.ksoap2.transport.ServiceConnectionSE.openOutputStream(ServiceConnectionSE.java:109)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:157)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:96)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at com.example.wstest.MainActivity.onCreate(MainActivity.java:41)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.Activity.performCreate(Activity.java:5008)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-19 10:58:10.287: E/AndroidRuntime(1008):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
07-19 10:58:10.287: E/AndroidRuntime(1008):     ... 11 more

I have added to the manifest.

Any suggestions?

  • 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-07T21:52:33+00:00Added an answer on June 7, 2026 at 9:52 pm

    OMG…why same mistake is done by every devolper who is calling the WebService

    here is the answer..

    NETWORK REQUEST CAN ONLY BE MADE ON BACKGROUND THREAD IN ANDROID >= 3.0

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

Sidebar

Related Questions

I am trying to create an android app that will connect to various web
I have a web application which fetches information from a web service. It works
I have a few applications which use a single Web Service which resides on
I have an ASP.NET MVC web app whose controllers use WCF to call into
I've created a web service to connect my android device to a mysql database.
My Android app connects to a asp.net web service to register the user. When
I have a .NET web service I have to connect to, and unfortunately, I
Im trying to connect from PHP(Zend Framework) code to an aspx Web Service. I
I have an error where I am loading data from a web-service into the
I have been asked to write an android app to connect to a http

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.