public static boolean getData(String param) {
//WebService Server address
String SERVICE_URL = "";
//URL Namespace
String SERVICE_NS = "";
// Access method
String methodName = "myMethod"; // establish SoapObject object ,
// When you create this object, you need to pass in what you want to call Wb Service The namespace of 、Web Service Method name ;
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
// If there are parameters to pass to Web Service The server ,
// call SoapObject Object's addProperty(String name,Object value) Method to set parameters ,
// The method of name Parameter specifies the parameter name ;
// value Parameter specifies the parameter value
soapObject.addProperty("p1", param);
// Use SOA1.1 Protocol creation Envelop object
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
envelope.bodyOut = soapObject;
// Whether to call DotNet Developed WebService , Set up with .net Provided Web Service Keep good compatibility
envelope.dotNet = true; // If not .net You can delete this line
try {
// adopt HttpTransportSE Transfer object , Pass in WebService Server address
HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
// call HttpTransportSE Object's call() Method , among call The first parameter of soapAction,
// The second is SoapSerializationEvelope object Call remote Web Service; + methodName, envelope);
if (envelope.getResponse() != null) {
// Get the response from the server SOAP news
* SoapObject result = (SoapObject) envelope.bodyIn;
* SoapObject detail = (SoapObject) result.getProperty(methodName+"Result");
* Get the returned data SoapObject object = (SoapObject) envelope.bodyIn;
* Get the returned result String result = object.getProperty(0).toString();
// Parse the server's corresponding SOAP news - character string
String result = envelope.getResponse().toString();
if (result.equals("success")) {
return true;
} catch (IOException e) {
} catch (XmlPullParserException e) {
System.out.println("******************** It's abnormal ");
return false;

WebService Is a cross programming language and cross operating system platform remote call technology .XML+XSD(XML Schema),SOAP(Simple Object Access Protocol) and WSDL(Web Services Description Language) It's the formation of WebService Three technologies of the platform .SOAP agreement = HTTP agreement + XML data format

Applicable occasions :1、 Cross firewall communication .2、 Application Integration .3、B2B Integrate .4、 Software and data reuse .

Not applicable :1、 Stand alone applications .2、 LAN isomorphic applications

In this paper, the reference webService Blog ksoap2 Using blogs

WebService call ( be based on KSOAP2) More articles about

  1. python Publishing and calling are based on SOAP Of webservice

    Now service oriented (SOA) The architecture design of has become the mainstream , Package public services one by one webservice It's a very common practice for all parties to call , And the most widely used is based on SOAP The protocol and wsdl Of webservice. This article explains ...

  2. Csharp Call based on Opencv Write the class library file

    You will now Csharp Call based on Opencv Write the class library file (Dll) The way to do it is decided , My name is GreenOpenCsharpWarper, abbreviation GOCW. One .CLR Compiling DLL part 1. Introduce in the normal way Ope ...

  3. webservice Call and generate

    webservice brief introduction : Web Service technology , It can make different applications run on different machines without the aid of additional . Specialized third-party software or hardware , You can exchange data or integrate with each other . basis Web Service Between the application of specification implementation ...

  4. pure Java Development WebService Call the test tool (wsCaller.jar)

    notes : This article is from Of < pure Java Development WebService Call the test tool (wsCaller.jar)> The article be based on Java Developed WebService ...

  5. Using custom signed https Of ssl Security problem solving and metro Of webservice call

    I've been working on new projects recently , Work overtime to 8 Some more , I haven't even blogged . The new project has a lot of problems , Now take advantage of the sudden blackout to record the call https The question of . Our service is mainly , We call the data source data , And then provide interface for external data call . I ...

  6. C# dynamic webservice Call interface (JAVA,C#)

    C# dynamic webservice Call interface using System; using System.Collections; using System.IO; using System.Net; using ...

  7. WebService call

    One .WebService call 1.webservice Four call modes are supported :SOAP 1.1,SOAP 1.2,GET,POST.           2. If you want to webservice Support GET,POST transfer ...

  8. Use XmlInclude solve WebService Cannot recognize subclass exception when calling

    One . Define abstract classes and subclasses ,WebMethod Actually return subclass parameters // Use XmlInclude solve WebService Cannot recognize subclass exception when calling [System.Xml.Serialization.XmlInc ...

  9. WebService Appears when calling a one to many association Dead cycle :A cycle is detected in...

    adopt WebService Problems caused by calling one to many relationships :A cycle is detected in the object graph Specific exception information : org.apache.cxf.intercept ...

Random recommendation

  1. stay iIBatis Use in MySql Configuration problems in

    1. First you need to download mySQL-connector-net Installation package . There are two ways , The first one needs to be installed , The second one can be downloaded directly . The first one is : ...

  2. centos Next postgresql Installation and configuration [ turn ]

    This article excerpts from : One . install ( With root Identity ) 1. Check out the latest postgresql Of yum Configure from ht ...

  3. Virtual machine software VMware Workstation Pro Installation and use of

    Focus on industry best practices ,BDTC 2016 The full agenda is announced       Java Introduction to programming ( series )       The programmer 11 Monthly news , It's a book to review        Free knowledge base , Your knowledge base Virtual machine software VMware Workst ...

  4. Unicode And UTF Character standard

    Unicode International character standards (UCS) It's a character encoding system , It is designed to support the data exchange between different languages and written styles around the world . Processing and display .        Unicode Use two bytes to represent a character . front 127 Characters and A ...

  5. mac install To configure ant

    from : 1. download ant Download from the official website ...

  6. Windows The configuration Tomcat The server

    Tomcat Server is Apache A project of the open source foundation ,tomcat Not only as a server for static files , It can also be used as JSP/Servlet Of web Containers , And it's widely used , Good performance, too , Now let's configure a basic system based on tom ...

  7. .NET Analysis of entrustment

    We are all familiar with the concept of entrustment , But when using it, many people still can't control it , Let's think about it , In normal coding , You create classes directly according to the business logic ,new To create an object for operation is to use a delegate to complete a task more efficiently ...

  8. Talk about... In my eyes ASP.NET MVC

    To be frank with you , Study MVC It was some time ago . however , Although I practiced it at that time , But I can't say why . therefore , also I didn't dare to write a summary . lately , Begin to learn EF, Also in use MVC To combine EF Add, delete, modify and check in practice . Take your time ...

  9. 【 turn 】lnmp_auto: Automatic installation lnmp Environment script

    Link to the original text : lnmp_auto: Automatic installation lnmp Environment script   This blog post is very good   Reprint and share The blog is reproduced as follows : The source code in github On : ...

  10. An article takes you to learn Linux One of the three swordsmen :awk

    awk It's a way to process text . Pattern matching programming language . And sed and grep, Be commonly called Linux The next three swordsmen . Learn to awk It's like you're here Linux Command line , There's another choice to deal with text . This article focuses on how to use , After reading this article ...