The Java code is as follows:
static void Testtextstring () {
try {
String methodsayto = "Test";
Defining services
Service service = new service ();
Call Call2 = (call) Service.createcall ();
Call2.settargetendpointaddress (New Java.net.URL ("Http://localhost:21972/Service1.asmx")); . NET Websevice Addresses
Call2.setusesoapaction (TRUE);
Call2.setreturntype (New QName ("Http://www.w3.org/2001/XMLSchema", "string"));
The second setting returns a method with a value type of string
Call2.setoperationname (New QName ("http://192.168.40.133.org/", Methodsayto)); Name space
Call2.setsoapactionuri ("Http://192.168.40.133.org/test"); namespace + function name
Call2.addparameter (New QName ("http://192.168.40.133.org/", "name"),//This is the formal parameter name of the. NET WebService
Xmltype.xsd_string, parametermode.in);
String retVal2 = (string) call2
. Invoke (New object[] {"ASP WebService"}); ASP WebService is the string to be passed
System.out.println (RETVAL2);
} catch (Exception e) {
Todo:handle exception
}
}
Refer to the article as follows: http://blog.csdn.net/xw13106209/article/details/7067495
Java calls. NET WebService