Java calls. net webservice,. netwebservice
The JAVA code is as follows:
Static void testTextString (){
Try {
String methodSayTo = "test ";
// Define the service
Service service = new Service ();
Call call2 = (Call) service. createCall ();
Call2.setTargetEndpointAddress (new java.net. URL ("http: // localhost: 21972/Service1.asmx"); //. net websevice address
Call2.setUseSOAPAction (true );
Call2.setReturnType (new QName ("http://www.w3.org/2001/XMLSchema", "string "));
// Method 2 for setting the return value type to String
Call2.setOperationName (new QName ("http://192.168.40.133.org/", methodSayTo); // namespace
Call2.setSOAPActionURI ("http://192.168.40.133.org/test"); // namespace + function name
Call2.addParameter (new QName ("http://192.168.40.133.org/", "name"), // The parameter name of. 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
}
}
Reference: http://blog.csdn.net/xw13106209/article/details/7067495