• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps unable to access my WSDL file on my android emulator

krishnaveni

Well-Known Member
Hi.,

I have developed one android application

this is my code:

[HIGH]
public class RetailerActivity extends Activity {
private static final String SOAP_ACTION = "http://ws.testprops.com/customerData";
private static final String METHOD_NAME = "customerData";
private static final String NAMESPACE = "http://ws.testprops.com";
private static final String URL = "http://87.76.29.180:8080/TestPrompts/services/Fetch?wsdl";


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
try {
ht.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
SoapPrimitive s = response;
String str = s.toString();
String resultArr[] = str.split("&");//Result string will split & store in an array

TextView tv = new TextView(this);
for(int i = 0; i<resultArr.length;i++){
tv.append(resultArr+"\n\n");
}
setContentView(tv);

} catch (Exception e) {
e.printStackTrace();
}
}
}
[/HIGH]This is my local tomcat apache server wsdl file:

http://localhost:8089/TestPrompts/services/Fetch?wsdl

means it is successfully worked for my emulator and android device.please see this screenshot:http://screencast.com/t/r4RISmZvL

The same TestPrompts project only i have exported and created war file and uploaded in my tomcat server.

This is my tomcat server wsdl file:

http://87.76.29.180:8080/TestPrompts/services/Fetch?wsdl

But here i have faced one problem:

I have to put these URL means doesn't getting any result on both emulator and android device.Simply am getting black blank screen only.please refer my screenshot:http://screencast.com/t/o5k1qEfQ0

My console window shows following error:
11-19 15:12:55.232: D/SntpClient(73): request time failed: java.net.SocketException: Address family not supported by protocol

please help me.how can i resolve this error.
 
Yes i have added internet permission already.

This is my manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.retailer.client"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".RetailerActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
please help me how can i resolve my error.

The webservice code is given below:
package com.testprops.ws;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.PreparedStatement;

public class Fetch {
public String customerData(){
String customerInfo = "";
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/android","andidur","fgffgd6");
//Find customer information where the customer ID is maximum
PreparedStatement statement = con.prepareStatement("SELECT * FROM xcart_customers");
ResultSet result = statement.executeQuery();
while(result.next()){
customerInfo = customerInfo + result.getString("login") + "&" + result.getString("password") + "&"+result.getString("firstname") + "&"+result.getString("email");
//Here "&"s are added to the return string. This is help to split the string in Android application
}
}
catch(Exception exc){
System.out.println(exc.getMessage());
}
return customerInfo;
}
}
please give me some solution.how can i resolve this problem.
 
Hi.,

I got the solution for this after i have gave permission globally on my mysql database.so all are allowed to access my mysql database.but i wish to allow to access my mysql database myself(alone) only.others doesn't allow to access my mysql database.so this situation how can i manage security.please give me solution for this.
 
Back
Top Bottom