Cannot access java web service in Android - java

I try to create android login web service with java. I am using Axis2.
I am developing web service with Eclipse EE and android application with Eclipse Adt Bundle. I can access "http://localhost:8081/Login/services/Login?wsdl" page. When android application ran and clicked login button, i am not seeing any message (issued inside web services status="success" or status="login fail")on the screen.
I didn't solve this problem.Any help will be appreciated.
Web Service:
package com.userlogin.ws;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class Login {
public String authentication(String userName, String password) {
String retrievedUserName = "";
String retrievedPassword = "";
String status = "";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/places", "root",
"");
PreparedStatement statement = con
.prepareStatement("SELECT * FROM user WHERE username = '"
+ userName + "'");
ResultSet result = statement.executeQuery();
while (result.next()) {
retrievedUserName = result.getString("username");
retrievedPassword = result.getString("password");
}
if (retrievedUserName.equals(userName)
&& retrievedPassword.equals(password)) {
status = "Success!";
}
else {
status = "Login fail!!!";
}
} catch (Exception e) {
e.printStackTrace();
}
return status;
}
}
Android:
package com.androidlogin.ws;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class AndroidLoginExampleActivity extends Activity {
private final String NAMESPACE = "http://ws.userlogin.com";
private final String URL = "http://localhost:8081/Login/services/Login?wsdl";
private final String SOAP_ACTION = "http://ws.userlogin.com/authentication";
private final String METHOD_NAME = "authentication";
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button login = (Button) findViewById(R.id.btn_login);
login.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
loginAction();
}
});
}
private void loginAction(){
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
EditText userName = (EditText) findViewById(R.id.tf_userName);
String user_Name = userName.getText().toString();
EditText userPassword = (EditText) findViewById(R.id.tf_password);
String user_Password = userPassword.getText().toString();
//Pass value for userName variable of the web service
PropertyInfo unameProp =new PropertyInfo();
unameProp.setName("userName");//Define the variable name in the web service method
unameProp.setValue(user_Name);//set value for userName variable
unameProp.setType(String.class);//Define the type of the variable
request.addProperty(unameProp);//Pass properties to the variable
//Pass value for Password variable of the web service
PropertyInfo passwordProp =new PropertyInfo();
passwordProp.setName("password");
passwordProp.setValue(user_Password);
passwordProp.setType(String.class);
request.addProperty(passwordProp);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
TextView result = (TextView) findViewById(R.id.tv_status);
result.setText(response.toString());
}
catch(Exception e){
}
}
}

You are squashing exceptions in the android code:
catch(Exception e){
}
There's a good chance that that is discarding the evidence that would tell you what the underlying problem is. Either way, squashing Exception like that is very bad practice.

In android code you trying to connect to localhost, but it should a host name where the java service running. In the android device you obviously don't have any service available on port 8081.
This is quite a common mistake. Usually you develop server side and android application on the same machine so when running a service on localhost you believe that the same service should be available in the android application. However, in the emulator, the localhost is the address of the android device. The easiest way to develop and test such applications is to use ip address of the host machine.

Related

The php file is returning false instead of the bind values.How can I fix this?

I have an android studio project connected to a mysql online database, using php files.
The problem is I don't receive the parameters(idquestion, question, id) from the php file with a given idquestion and a category.
The class and the php file are a similar replica to ohers that works and yet is not working.
I tried the debugger and i find out that i pass the correct information (idquestion 1 and category "computers").
Also, i tried another php file with a different syntax just to print data and it worked, but that php file wasn't helpful in my class.
This is my php file
<?php
$con = mysqli_connect("localhost", "id8963226_user", "parola123", "id8963226_user");
$idquestion = #($_POST['idquestion']);
$category = #($_POST['category']);
$statement = mysqli_prepare($con, "select * from question where idquestion=? and category=?;");
mysqli_stmt_bind_param($statement, "is", $idquestion, $question);
mysqli_stmt_execute($statement);
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $success, $idquestion, $question, $id);
$response = array();
$response["success"] = false;
while(mysqli_stmt_fetch($statement)){
$response["success"] = true;
$response["idquestion"] = $idquestion;
$response["question"] = $question;
$response["id"] = $id;
}
echo json_encode($response);
?>
These are my java classes
package com.example.allrateform;
import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
public class Question extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_question);
//CREATING ALL INSTANCES FROM TEXTS
final TextView CategoryTextView = findViewById(R.id.CategoryTextView);
final TextView QuestionTextView = findViewById(R.id.QuestionTextView);
final TextView IdTextView = findViewById(R.id.IdTextView);
CategoryTextView.setText(Categories.Category);
final String category = CategoryTextView.getText().toString();
final int idquestion = 1;
Response.Listener<String> responseListener = new Response.Listener<String>() {
#Override
public void onResponse(String response) {
try {
JSONObject jsonResponse = new JSONObject(response);
boolean success = jsonResponse.getBoolean("success");
if (success) {
String question = jsonResponse.getString("question");
int id = jsonResponse.getInt("id");
QuestionTextView.setText(question);
IdTextView.setText(id);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(Question.this);
builder.setMessage("Failed")
.setNegativeButton("Ok", null)
.create()
.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
//CREATING RESPONSE
ListRequest listRequest = new ListRequest(idquestion, category, responseListener);
RequestQueue queue = Volley.newRequestQueue(Question.this);
queue.add(listRequest);
}
}
package com.example.allrateform;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class ListRequest extends StringRequest {
private static final String LIST_REQUEST_URL = "myUrl.com/myPhp.php";
private Map<String, String> params;
//METHOD TO PASS THE INFORMATION
public ListRequest(int idquestion, String category, Response.Listener<String> listener) {
super(Method.POST, LIST_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("idquestion", idquestion + "");
params.put("category", category);
}
#Override
public Map<String, String> getParams() {
return params;
}
}
So again the project result is "Failed", meaning the php returns false.
If you have other ways to approach this it's ok as long as I'm able to store all the question from the "computer" categories in a java string array.
Feel free to ask any other questions about my database or other classes or anything.
Thank you in advance!
I got the problem.. it was a logic error in my php, binding ($statement, "is", $idquestion, $question) instead of ($statement, "is", $idquestion, $category) .. the given variables. Still, I don't how but i have another error now.
Look at the output
{"success":true,"idquestion":"Top programming languages?","question":"computers","id":1}
it was suppose to be
{"success":true,"idquestion":1,"question":"Top programming languages?","id":1}

I cannot connect to my remote MySQL via Android SDK

I have two similar program. the First: Java for PC, the Second: Android. I have a MacOS Pro Server with ip 192.168.0.103 in my local network. MacOS Server has got MySQL-Server 5.0.1, with
CREATE DATABASE db_demo01;
CREATE USER 'user01'#'%' IDENTIFIED BY '1234567';
GRANT ALL ON db_demo01.* TO 'user01'#'%';
My PC App has following code:
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://192.168.0.103:3306/";
String dbName = "db_demo01";
String userName = "user01";
String userPass = "1234567";
try
{
Class.forName(driver);
Connection conn = DriverManager.getConnection(url+dbName,userName,userPass);
System.out.println("Connected!");
conn.close();
}
catch(Exception ex)
{
System.out.println("Error:" + ex.getMessage());
}
It's work!But when I try to do this with my android app, I'v got connection fail. I don't know why... I posted the full code of my app below:
package com.navi.newser;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class MainActivity extends ActionBarActivity {
/// VARIABLES
private TextView textWidget;
private TableLayout tableWidget;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
CreateOnClickConnect();
}
private void CreateOnClickConnect()
{
textWidget = (TextView)findViewById(R.id.textView1);
tableWidget = (TableLayout)findViewById(R.id.table1);
Button cmd = (Button)this.findViewById(R.id.button3);
cmd.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
ConnectToMySQL();
}
});
}
private class Connect extends AsyncTask<String, String, String> {
#Override
protected String doInBackground(String... urls)
{
String response = "";
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://192.168.0.103:3306/";
String dbName = "db_demo01";
String userName = "user01";
String userPass = "1234567";
Connection conn = null;
try
{
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,userPass);
response += "Connected!";
Log.e("MySQL", response);
conn.close();
}
catch(Exception ex)
{
ex.printStackTrace();
response += "Error:" + ex.getMessage();
Log.e("MySQL", response);
}
publishProgress("Almost...");
return response;
}
#Override
protected void onPostExecute(String result) {
textWidget.setText(result);
}
#Override
protected void onProgressUpdate(String... text) {
textWidget.setText(text[0]);
}
}
public void ConnectToMySQL()
{
new Connect().execute();
}
I use Eclipse Luna.
01-20 19:09:07.777: E/dalvikvm(1069): Could not find class 'javax.naming.StringRefAddr', referenced from method com.mysql.jdbc.ConnectionPropertiesImpl$ConnectionProperty.storeTo
I don't have other errors.
The emulator is always isolated from your machine's network, take a look at this Network Address Space
Start your emulator with this
emulator -avd avdname -http-proxy http://192.168.0.1:8080
Here replace avdname to name of avd you want to run your program, and http:192.168.1.1 to your proxy server.
original answer
Well you have to make some settings; first of all with emulator isn't always a good idea to use it, while there is internet connection in the middle. Also the library (jar) for the connector should be in a folder called lib in Android project. For MySQL interaction, I use JSON with PHP. I hope this help you !

Flickr Oauth Login using Scribe Library

I'm pretty new to android, please forgive any mistake.
package net.schwiz.oauth;
import org.json.JSONException;
import org.json.JSONObject;
import org.scribe.builder.ServiceBuilder;
import org.scribe.builder.api.TwitterApi;
import org.scribe.model.OAuthRequest;
import org.scribe.model.Response;
import org.scribe.model.Token;
import org.scribe.model.Verb;
import org.scribe.model.Verifier;
import org.scribe.oauth.OAuthService;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
public class Main extends Activity {
final static String APIKEY = "XXXXXXXXXXXXXXXXXXXX";
final static String APISECRET = "XXXXXXXXXXXXXXXXXXXX";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView textView = (TextView)findViewById(R.id.textview);
final WebView webview = (WebView) findViewById(R.id.webview);
if(APIKEY == null || APISECRET == null){
textView.setText("You must enter your own APIKEY and SECRET to use this demo. dev.twitter.com");
webview.setVisibility(View.GONE);
return;
}
//set up service and get request token as seen on scribe website
//https://github.com/fernandezpablo85/scribe-java/wiki/Getting-Started
final OAuthService s = new ServiceBuilder()
.provider(TwitterApi.class)
.apiKey(APIKEY)
.apiSecret(APISECRET)
.callback(CALLBACK)
.build();
final Token requestToken = s.getRequestToken();
final String authURL = s.getAuthorizationUrl(requestToken);
//attach WebViewClient to intercept the callback url
webview.setWebViewClient(new WebViewClient(){
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
//check for our custom callback protocol otherwise use default behavior
if(url.startsWith("oauth")){
//authorization complete hide webview for now.
webview.setVisibility(View.GONE);
Uri uri = Uri.parse(url);
String verifier = uri.getQueryParameter("oauth_verifier");
Verifier v = new Verifier(verifier);
//save this token for practical use.
Token accessToken = s.getAccessToken(requestToken, v);
if(uri.getHost().equals("twitter")){
OAuthRequest req = new OAuthRequest(Verb.GET, "URL here");
s.signRequest(accessToken, req);
Response response = req.send();
try {
JSONObject json = new JSONObject(response.getBody());
textView.setText(json.toString(3));
} catch (JSONException e) {
e.printStackTrace();
}
}
return true;
}
return super.shouldOverrideUrlLoading(view, url);
}
});
//send user to authorization page
webview.loadUrl(authURL);
}
}
I tried this code, its working fine with twitter, but now i want to authenticate user using Flickr, The above code is not working in that case, the if condition if(url.startsWith("oauth")) is not working the way I supposed. Please help.
I've figured out the problem! When I call the method webview.loadUrl(authURL); the url of flickr www.flickr.com changes to m.flickr.com which triggers the event shouldOverrideUrlLoading before any user login/authentication.
if(authURL.charAt(7)=='w')
{
authURL=authURL.replaceFirst("www", "m");
}
solved my problem.
Anyone who's struggling to get this to work with more recent version of Android, I have a gist that can be found here. This uses Scribe and Flickr4J because Scribe does not have a facility AFAIK to create a requestToken for auth with a callback. One of the things to note here is that the code above will not work as is with more recent version of Android since it no longer allow network tasks in the UI thread...and I addressed this in the gist through the use of (the recently deprecated AsyncTask)

Creating new SoapObject Blows up android app

I'm new to ksoap2 and I'm trying to get example w3 schools example working. For some reason it always fails on this line.
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
I dont know what is causing the fail. The android app just blows up. I have set internet permisions in Manifest. Im not really sure what is going on. Thanks
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;
public class WebServiceTurorialActivity extends Activity implements OnClickListener{
private static final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
private static final String METHOD_NAME = "CelsiusToFahrenheit";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
(findViewById(R.id.button1)).setOnClickListener(this);
}
public void onClick(View v) {
int a;
int b;
try
{
// EditText ed1=(EditText)findViewById(R.id.editText1);
// EditText ed2=(EditText)findViewById(R.id.editText2);
// a = Integer.parseInt(ed1.getText().toString());
// b = Integer.parseInt(ed2.getText().toString());
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
//Request.addProperty("a", a);
// Request.addProperty("b", b);
Request.addProperty("Celsius", "32");
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
HttpTransportSE transport= new HttpTransportSE(URL);
transport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
Toast.makeText(this,"200 " + resultString,Toast.LENGTH_SHORT).show();
}catch(Exception ex) {
Toast.makeText(this,"FALSE",Toast.LENGTH_SHORT).show();
}
}
}
I had the same problem. That works for me:
As the prev answer said:
In your build path clear all libraries (jar files).
In project's main directory create a folder and named it "libs" (not "lib").
Now Eclipse ADT Plugin will add your jar files to build path
Not realy for me. My way:
In your build path remove the "ksoap2-android-assembly-2.x.x-jar-with-dependencies.jar"
Click OK (Ignore Errors shown)
In project's main directory create a folder "libs"
Copy the JAR-File into this directory (!)
In your build path add the JAR file with this directory
For everyone having also this problem... I was trying to solve this problem for many many hours, but then I detected what my fault was: I did not correctly download the ksoap2 library, so there was only a jar file which was 21 KB, but the correct jar file is about 150KB. So make sure that you download the file correctly!
In your build path clear all libraries (jar files).
In project's main directory create a folder and named it "libs" (not
"lib").
Now Eclipse ADT Plugin will add your jar files to build path.
Happy coding
If you still get the same problem, try these classes (works for me):
public class Main extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String fahrenheit = CelsiusToFahrenheitWs.celsiusToFahrenheit("32");
Toast.makeText(getApplicationContext(), fahrenheit, Toast.LENGTH_SHORT).show();
}
}
And
public class CelsiusToFahrenheitWs {
private static final String METHOD_NAME = "CelsiusToFahrenheit";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
private static final String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
public static String celsiusToFahrenheit(String celsius) {
String fahrenheit = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Celsius", celsius);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
fahrenheit = response.toString();
} catch (Exception e) {
e.printStackTrace();
fahrenheit = null;
}
return fahrenheit;
}
}
I've created an another SOAP library to call SOAP services on Android, the name of the project is AndroidSOAP ( http://wiki.javaforum.hu/display/ANDROIDSOAP/Home ).
I've released a version 0.0.5 today, check it out: http://wiki.javaforum.hu/display/ANDROIDSOAP/2012/05/01/Version+0.0.5+released
W3Schools.com is no more accepting NAMESPACE as tempuri.org which caused SOAP exception in the code. You need to use "http://www.w3schools.com/webservices/" for NAMESPACE and "http://www.w3schools.com/webservices/CelsiusToFahrenheit" for SOAP_ACTION.
Hope this is help!

Connecting to WCF with KSOAP2 - XmlPullParserException position END_DOCUMENT

I have developed a WCF Service .NET4 and I am trying to connect to it from Android(1.6). But when i try to connect all i get is "org.xmlpull v1 xmlpullparserexception unexpected type (position: END_DOCUMENT null#1:0 in java.io.InputStreamReader#4396aa90)" error.. I've already checked METHOD_NAME , NameSpace, URL , Soap_Action and look fine for me. Also i tried with System.setProperty("http.keepAlive", "false") and changing SoapEnvelope.VER from 10 to 12 but still nothing.. Any suggestions?
My code:
package web.service;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;
import org.w3c.dom.Text;
public class WebServiceConnActivity extends Activity {
private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String URL = "http://10.0.2.2:51599/Service.svc";
//private static final String URL = "http://10.0.2.2:51599/MyWCFApp/Service.svc";
private static final String Add_SOAP_ACTION = "http://tempuri.org/IService/HelloWorld";
private static final String METHOD_NAME1 = "HelloWorld";
public TextView tView;
public Button btn;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tView = (TextView)findViewById(R.id.tView);
btn = (Button)findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
GetAdd();
}
});
}
public void GetAdd()
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
//request.addProperty("value1", "2");
//request.addProperty("value2", "3");
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
System.setProperty("http.keepAlive", "false");
try
{
androidHttpTransport.call(Add_SOAP_ACTION, envelope);
//java.lang.String receivedInt = (String)envelope.getResponse();
Object result = (Object)envelope.getResponse();
tView.setText(result.toString());
}
catch(Exception e)
{
tView.setText(e.toString());
}
}
}
I've spent little more time on this problem and here's what come into my mind:
The problem is probably in URL - I've developed WS .NET3.5 and all works just fine, and only difference is URL:
private static final String URL = "http://10.0.2.2:50915/aspWebService/Service.asmx";
But I have no clue where i could make mistake in WCF's URL. I took URL from WDSL and i just change "localhost" to "10.0.2.2", the address http://10.0.2.2:51599/Service.svc is visible from emulators browser.
Here is part of my WDSL file with URL(i suppose):
<wsdl:service name="Service">
<wsdl:port name="WSHttpBinding_IService" binding="tns:WSHttpBinding_IService">
<soap12:address location="http://localhost:51599/Service.svc"/>
<wsa10:EndpointReference>
<wsa10:Address>http://localhost:51599/Service.svc</wsa10:Address>
<Identity>
<Dns>localhost</Dns>
</Identity>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
Any hints?
If your web service is returning a complex object (maybe a String) then try this:
SoapObject response = (SoapObject)envelope.getResponse();
String string = response.toString();
instead of this:
Object result = (Object)envelope.getResponse();
Problem solved.
If you are using Visual Studio's Development Server to test the WCF service, you may need to deploy the service to IIS. How to do it you will find at: http://msdn.microsoft.com/en-us/library/aa751792.aspx
Then make changes in NAMESPACE, URL
private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String URL = "http://MyWCFApp/Service.svc";

Categories