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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:22:35+00:00 2026-06-13T09:22:35+00:00

I have build a wcf web service. When I consume this service in a

  • 0

I have build a wcf web service. When I consume this service in a java project build using eclipse it runs fine but when i try to consume it in android project it gives an exception.

Here is how I am consuming it in java project.

Step 1: Create directory org and com using wsimport and include it in src folder of java project.

Step 2: Add the external jars present in sub-folder “lib” of folder “metro”(This folder is actually referring to the folder where I have installed the metro framework). For this goto project->properties->Java Build Path->Libraries->Add external jars and then browse and select these jar files.

Step 3: Create a new class to communicate with the web service. Here is the class that I am using.

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import org.tempuri.IService1;
import org.tempuri.Service1;


public class JavaClient {
    public static void main(String[] strArgs)
    {

    try
    {
        Service1 service1 = new Service1(new URL("http://192.168.1.18/WcfService/Service1.svc?wsdl"), new QName("http://tempuri.org/", "Service1"));
        IService1 port = service1.getBasicHttpBindingIService1();
        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://192.168.1.18/WcfService/Service1.svc");
        int input = 100;
        String strOutput = port.getData(input);
        System.out.println(strOutput);
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }

    }
}

Now when I run this java project it ran successfully.

Now I want to do the same for an android project. So in the same manner as above I create an android project which is using android platform 2.2 as the build target and then I follow step 1 and step 2 as described above. Thereafter I create a class having the following code.

package android.client;

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import org.tempuri.IService1;
import org.tempuri.Service1;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class AndroidClientJavaServerActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        try
        {

            Service1 service1 = new Service1(new URL("http://192.168.1.18/WcfService/Service1.svc?wsdl"), new QName("http://tempuri.org/", "Service1"));
            IService1 port = service1.getBasicHttpBindingIService1();
            ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://192.168.1.18/WcfService/Service1.svc");
            int input = 100;
            String strOutput = port.getData(input);
            Toast msg = Toast.makeText(getBaseContext(),
                    strOutput, Toast.LENGTH_LONG);
            msg.show();
       }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

After it when I run this android project the application fails in executing successfully.
Here is the detailed output of running this android application.

07-05 19:50:24.864: W/dalvikvm(279): Unable to resolve superclass of Lorg/tempuri/Service1; (68)
07-05 19:50:24.864: W/dalvikvm(279): Link of class 'Lorg/tempuri/Service1;' failed
07-05 19:50:24.864: E/dalvikvm(279): Could not find class 'org.tempuri.Service1', referenced from method android.client.AndroidClientJavaServerActivity.onCreate
07-05 19:50:24.864: W/dalvikvm(279): VFY: unable to resolve new-instance 85 (Lorg/tempuri/Service1;) in Landroid/client/AndroidClientJavaServerActivity;
07-05 19:50:24.864: D/dalvikvm(279): VFY: replacing opcode 0x22 at 0x0008
07-05 19:50:24.864: D/dalvikvm(279): VFY: dead code 0x000a-0045 in Landroid/client/AndroidClientJavaServerActivity;.onCreate (Landroid/os/Bundle;)V
07-05 19:50:25.044: D/AndroidRuntime(279): Shutting down VM
07-05 19:50:25.081: W/dalvikvm(279): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-05 19:50:25.124: E/AndroidRuntime(279): FATAL EXCEPTION: main
07-05 19:50:25.124: E/AndroidRuntime(279): java.lang.NoClassDefFoundError: org.tempuri.Service1
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.client.AndroidClientJavaServerActivity.onCreate(AndroidClientJavaServerActivity.java:21)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.os.Looper.loop(Looper.java:123)
07-05 19:50:25.124: E/AndroidRuntime(279):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-05 19:50:25.124: E/AndroidRuntime(279):  at java.lang.reflect.Method.invokeNative(Native Method)
07-05 19:50:25.124: E/AndroidRuntime(279):  at java.lang.reflect.Method.invoke(Method.java:521)
07-05 19:50:25.124: E/AndroidRuntime(279):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-05 19:50:25.124: E/AndroidRuntime(279):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-05 19:50:25.124: E/AndroidRuntime(279):  at dalvik.system.NativeStart.main(Native Method)
  • 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-13T09:22:36+00:00Added an answer on June 13, 2026 at 9:22 am

    Probably you need to look at this post!!
    http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

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

Sidebar

Related Questions

I have a web site and build a wcf service in it. I can
I have an existing Java client that I need to build a web service
I have a WCF web service project, say FooService.vbproj with a FooService.svc endpoint. Its
I have build a wcf web service that simply provides MS Dynamics SQL data
I have build an APi which is a WCF Service. In the web.config for
I have created a REST web service using WCF and use HTTP Post Method.
I am using .net 3.5. and castle 2.5.2. I have a WCF web service.
I'm trying to build two webservices with WCF (VS2010). One webservice runs fine, but
I have built up the wcf web service in visual studio express 2010. I
I have build a c# class library verification.dll using OpenCVSharp. This references OpenCvSharp.dll in

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.