Wednesday, February 5, 2014

Call axis2 webservices problem?


            
I call webservices Service Times the following error:
12-06 14:49:09.381: W / System.err (10491): java.net.SocketException: socket failed: EACCES (Permission denied)
12-06 14:49:09.381: W / System.err (10491): at libcore.io.IoBridge.socket (IoBridge.java: 583)
12-06 14:49:09.381: W / System.err (10491): at java.net.PlainSocketImpl.create (PlainSocketImpl.java: 201)
12-06 14:49:09.381: W / System.err (10491): at java.net.Socket.checkOpenAndCreate (Socket.java: 663)
12-06 14:49:09.381: W / System.err (10491): at java.net.Socket.connect (Socket.java: 807)
12-06 14:49:09.381: W / System.err (10491): at libcore.net.http.HttpConnection (HttpConnection.java: 76).
12-06 14:49:09.381: W / System.err (10491): at libcore.net.http.HttpConnection . (HttpConnection.java: 50)
12-06 14:49:09.381: W / System.err (10491): at libcore.net.http.HttpConnection $ Address.connect (HttpConnection.java: 340)
12-06 14:49:09.381: W / System.err (10491): at libcore.net.http.HttpConnectionPool.get (HttpConnectionPool.java: 87)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpConnection.connect (HttpConnection.java: 128)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpEngine.openSocketConnection (HttpEngine.java: 316)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpEngine.connect (HttpEngine.java: 311)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpEngine.sendSocketRequest (HttpEngine.java: 290)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpEngine.sendRequest (HttpEngine.java: 240)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpURLConnectionImpl.connect (HttpURLConnectionImpl.java: 81)
12-06 14:49:09.386: W / System.err (10491): at libcore.net.http.HttpURLConnectionImpl.getOutputStream (HttpURLConnectionImpl.java: 197)
12-06 14:49:09.386: W / System.err (10491): at org.ksoap2.transport.ServiceConnectionSE.openOutputStream (ServiceConnectionSE.java: 126)
12-06 14:49:09.386: W / System.err (10491): at org.ksoap2.transport.HttpTransportSE.call (HttpTransportSE.java: 179)
12-06 14:49:09.386: W / System.err (10491): at org.ksoap2.transport.HttpTransportSE.call (HttpTransportSE.java: 116)
12-06 14:49:09.386: W / System.err (10491): at org.ksoap2.transport.HttpTransportSE.call (HttpTransportSE.java: 111)
12-06 14:49:09.386: W / System.err (10491): at com.example.wstest2.MainActivity $ 2.run (MainActivity.java: 79)
12-06 14:49:09.386: W / System.err (10491): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
12-06 14:49:09.386: W / System.err (10491): at libcore.io.Posix.socket (Native Method)
12-06 14:49:09.386: W / System.err (10491): at libcore.io.BlockGuardOs.socket (BlockGuardOs.java: 181)
12-06 14:49:09.386: W / System.err (10491): at libcore.io.IoBridge.socket (IoBridge.java: 568)
12-06 14:49:09.386: W / System.err (10491): ... 19 more
calling code as follows:
 package com.example.wstest2; 

import java.io.IOException;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.SoapFault;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;


import org.xmlpull.v1.XmlPullParserException;

import android.os.Bundle;

import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {
private static final String NAME_SPACE = "http://Hi" ;/ / http://ws.apache.org/axis2
private static final String WDSL_LINK = "http://203.171.229.187:8080/axis2/services/sayHello?wsdl";
private static final String METHOD_NAME = "sayHello";

private Button call_soap;
private TextView textView;

private String resultStr;

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

this.call_soap.setOnClickListener (new View.OnClickListener () {

@ Override
public void onClick (View v) {
callWebService ();
}
});
}

@ Override
public boolean onCreateOptionsMenu (Menu menu) {
/ / Inflate the menu; this adds items to the action bar if it is present
.getMenuInflater () inflate (R.menu.main, menu);.
return true;
}

private void initUI () {
call_soap = (Button) this.findViewById (R.id.button1);

textView = (TextView) this.findViewById (R.id.textView1);
}

private void callWebService () {


Thread thr = new Thread () {
public void run () {
try {
String name = "ssss";

/ / Soap Object is an important part of
SoapSerializationEnvelopeSoapObject request = new SoapObject (NAME_SPACE, METHOD_NAME);
request.addProperty ("user", name);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope (SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = true;
envelope.setOutputSoapObject (request);
HttpTransportSE ht = new HttpTransportSE (WDSL_LINK);

ht.call ("", envelope);

String ret = String.valueOf (envelope.getResponse ());

Log.d ("resultStr =", ret);
setResultStr (ret);


} Catch (SoapFault e) {
e.printStackTrace ();
Log.v ("random", e.getMessage ());
} Catch (IOException e) {
e.printStackTrace ();
Log.v ("random", e.getMessage ());

} Catch (XmlPullParserException e) {
e.printStackTrace ();
Log.v ("random", e.getMessage ());
}
}
};

thr.start ();
textView.setText (resultStr);

}

public String getResultStr () {
return resultStr;
}

public void setResultStr (String resultStr) {
this.resultStr = resultStr;
}


}

Reply:
Statement No permission?
Reply:
cited a floor sinom reply:
statement permission is not?

Where a statement permissions ah ~
Reply:
androidmanifest.xml:

Reply:
reference to the third floor sinom reply:
androidmanifest.xml:

Thank you ~ ~ Why add it after I clean'll is lost it?
Reply:
clean should not automatically clear the
Reply:
In the android client calls axis2 webservices
Really want to say that your program is a wonderful,
I call the other servers in the server axis2, need at least 20 jar package,
android access the server, usually with url http protocol on it, I do not know why you need so the whole

No comments:

Post a Comment