0
KSOAP2를 사용하여 웹 서비스 연결을 만들고 싶습니다. 이미 코드를 작성하고 오류가 발생했습니다. 그래서 나에게 내가 wrong.also를하고 있는지 제안 해주십시오. 또한 웹에서 도움이 필요합니다. 네임 스페이스는 무엇인가 - 서비스 관련하여, 또한 우리가 부르는 방법, soap_action, URL과 우리가 웹 services.I에서 사용하는 방법에 대한 몇 가지가 많이 검색했지만 웹 서비스에 대한 완전한 설명을 발견하지 않았습니다KSOAP을 사용하는 안드로이드의 웹 서비스
public class Web_ServicesActivity extends Activity {
private static String SOAP_ACTION = "http://service.fun2shoot.com/getLive";
private static String NAMESPACE = "http://service.fun2shoot.com/";
private static String METHOD_NAME = "getLive";
private static String URL = "http://119.82.75.91:8084/Fun2Shoot-WebService/Fun2ShootAndroid?wsdl";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
System.out
.println("After mail******************************************");
// Initialize soap request + add parameters
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
System.out.println("****************After Request call");
// Use this to add parameters
// request.addProperty("Parameter","Value");
// Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
// Needed to make the internet call
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
// this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
}
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) envelope.bodyIn;
if (result != null) {
TextView t = (TextView) this.findViewById(R.id.tv);
System.out
.println("***************************************Inside null condition");
// Get the first property and change the label text
t.setText("SOAP response:\n\n" + result.getProperty(0).toString());
}
}
}
14 행 8 열 내 뜻을 아는 경우 잘못된 방법을 사용합니다. – Hauleth
의미는 간단하게 말해 줄 수 있습니다 ............ – Jay
무엇이 오류입니까? – AndroGeek