Van Minh11
Junior Member
Chào mọi người,
Em/mình đang code giao tiếp SOAP Webserver với Adnroid tuy nhiên khi chạy thì nó lại không nhận lại được response từ webserver. Em/mình check Logcat thì nó có báo lỗi sau. Mong mọi người chỉ dẫn, em sẽ hậu tạ ạ.
Ảnh:
1. TestASMX với Chrome
2. Result khi thao tác trên localhost
3. Màn hình Android
Code em ở đây:
Đây là Logcat:
Đây là phần code giao tiếp với SOAP webserver:
Còn đây là phần SOAP trên webserver:
Em/mình đang code giao tiếp SOAP Webserver với Adnroid tuy nhiên khi chạy thì nó lại không nhận lại được response từ webserver. Em/mình check Logcat thì nó có báo lỗi sau. Mong mọi người chỉ dẫn, em sẽ hậu tạ ạ.
Ảnh:
1. TestASMX với Chrome
2. Result khi thao tác trên localhost
3. Màn hình Android
Code em ở đây:
Đây là Logcat:
2020-11-23 15:39:23.573 8469-8469/com.minhphuong.soapwithmultithread D/ViewRootImpl@a6da57e[MainActivity]: ViewPostIme pointer 0
2020-11-23 15:39:23.648 8469-8469/com.minhphuong.soapwithmultithread D/ViewRootImpl@a6da57e[MainActivity]: ViewPostIme pointer 1
2020-11-23 15:39:23.673 8469-8469/com.minhphuong.soapwithmultithread D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-11-23 15:39:23.678 8469-8469/com.minhphuong.soapwithmultithread I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2020-11-23 15:39:23.678 8469-8469/com.minhphuong.soapwithmultithread D/RECIEVING: ERROR WHILE RECIEVING DATA
Đây là phần code giao tiếp với SOAP webserver:
btnInvoke.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Initialize SOAP request + add parameter
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
//add parameter
PropertyInfo propertyInfo = new PropertyInfo();
propertyInfo.setName("maGoiHang");
propertyInfo.setValue(Integer.parseInt(edtMagoihang.getText().toString()));
propertyInfo.setType(Integer.class);
request.addProperty(propertyInfo);
//Declare the version of SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try{
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
}catch(Exception e){
Log.d("RECIEVING","ERROR WHILE RECIEVING DATA");
}
Còn đây là phần SOAP trên webserver:
POST /TestSOAP.asmx HTTP/1.1
Host: giaminh-001-site1.itempurl.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/DanhSachSanPham"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<DanhSachSanPham xmlns="http://tempuri.org/">
<maGoiHang>int</maGoiHang>
</DanhSachSanPham>
</soap:Body>
</soap:Envelope>