0

test という Web サービス (asmx) を呼び出す callSoap というクラスを作成しました。GetData という Web メソッドは整数をパラメーターとして取り、文字列のリストを返します。Web サービスの SOAP_ACTION OPERATION_NAME WSDL_TARGET_NAMESPACE SOAP_ADDRESS を定義しましたが、接続に失敗し、接続できませんでした。データを返す 誰もこれについて考えていますか?

public final String SOAP_ACTION = "http://tempuri.org/GetData";

public  final String OPERATION_NAME = "GetData"; 

public  final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

public  final String SOAP_ADDRESS = "http://10.0.2.2:8216/test.asmx";

public String Call(int id)
{
    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
    PropertyInfo pi=new PropertyInfo();
    pi.setName("id");
    pi.setValue(id);
    pi.setType(Integer.class);
    request.addProperty(pi);


 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
 envelope.dotNet = true;

 envelope.setOutputSoapObject(request);

 HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
 Object response=null;
try
{
    httpTransport.call(SOAP_ACTION, envelope);
    response = envelope.getResponse();
    }
catch (Exception exception)
{
response=exception.toString();
}

return response.toString();
}
}
4

0 に答える 0