web service main function call

public class testWs {
public static <V> void main(String[] args) {
try {

// https://**/services/**?wsdl
String result = "";
String uri = "https://* ip or domain name */services/**";
String tagName = "https://**/";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(uri) ;// Remote call path

call.setOperationName(new QName(tagName, "method"));// Called method name

call.addParameter("parameter", // Parameter name
XMLType.XSD_STRING,// Parameter type: String XSD_STRING
ParameterMode.IN);// Parameter mode: 'IN' or 'OUT'
// Set return value type:
call.setReturnType(XMLType.XSD_STRING);// Return value type: String

String json1 = "{key:'value',key:'value'}";

result = (String) call.invoke(new Object[] { json1 });

System.out.println("Called successfully. Please refer to The output of the server!\n");
System.out.println(result);

} catch (Exception e) {
e.printStackTrace();
}
}
}

When calling https, you need to change jdk1.7 64-bit;
there are other online Solution
https://blog.csdn.net/qq_31189355/article/details/52551812
https://blog.csdn.net/bad00temper/article/details/72478302 Those

who need to download the jar package can download it in the attachment

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325335994&siteId=291194637