我正在从 android 代码访问 wcf 服务
Web 服务是http://www.nbrm.mk/klservice/kurs.asmx
我的问题是 SoapObject 构造函数和 HttpTransportSE 对象的调用方法中的参数是什么?
这是代码
public class ExchangeMoneyMKActivity extends Activity {
private static final String SOAP_ACTION = "http://nbrm.mk/callService";
private static final String METHOD_NAME = "callService";
private static final String NAMESPACE = "http://nbrm.mk/";
private static final String URL = "http://www.nbrm.mk/klservice";
TextView txt;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt=(TextView)findViewById(R.id.txtView1);
callService();
}
private void callService() {
// TODO Auto-generated method stub
try{
SoapObject request=new SoapObject(NAMESPACE,METHOD_NAME);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = (Object)envelope.getResponse();
txt.setText(result.toString());
}
}