Android Development calls Java write webservices in Jax-ws format

Source: Internet
Author: User

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);
//Pass parameter must be the beginning of ARG,//write the real variable name is not used, it must be arg0, Arg1 has been queued, as if only 10 parameters are supported. Everyone else said it was a weak one.
Request.addproperty ("arg0", "Zhang Mu Sheng");

Request.addproperty ("username", "my");
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 ());

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.