码迷,mamicode.com
首页 > 移动开发 > 详细

安卓开发 调用java写的jax-ws 格式的webservices

时间:2014-05-11 14:56:53      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:android   style   java   ext   c   color   

public static final String NAME_SPACE = "http://webService.sxthnet/";
public static String URL = "http://100.123.68.166:8080/wbs1/Server1Port";
public static String Method2="sayhello2";
public final String Action2=NAME_SPACE+Method2; 

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ed1=(EditText)findViewById(R.id.editText1);
btn1=(Button)findViewById(R.id.button1);
btn1.setOnClickListener(new OnClickListener() {


@Override
public void onClick(View v)
{
ed1.setText("bkkd");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
SoapObject request = new SoapObject(NAME_SPACE,Method2);
//传递参数必须是arg开头,//写真实的变量名也没有用,必须是 arg0 ,arg1 一直排下去,好像只支持10个参数.//其他人说的都弱毙了
request.addProperty("arg0", "张木生" );

// request.addProperty("username", "我的" );
envelope.setOutputSoapObject(request);
envelope.bodyOut = request;
envelope.dotNet = false;
HttpTransportSE ht = new HttpTransportSE(URL);
// AndroidHttpTransport ht=new AndroidHttpTransport(URL);
try{
// ht.call(fullUrl, envelope);
ht.call(null,envelope);

if(envelope.getResponse()!=null){
ed1.setText(envelope.getResponse().toString());
}
else
ed1.setText("No");
} catch(Exception e){ 
System.out.println(e.toString());
e.printStackTrace();
ed1.setText(e.toString());

安卓开发 调用java写的jax-ws 格式的webservices,布布扣,bubuko.com

安卓开发 调用java写的jax-ws 格式的webservices

标签:android   style   java   ext   c   color   

原文地址:http://blog.csdn.net/holemole/article/details/25464973

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!