Recently, I often do interface integration, summed up two ways to call the WebService service using Java, the generation of local client class calls will not say.
The first type:
Public Staticstring Testoawebservice () {string result= ""; Try{Client C=NewClient (NewURL ("http://10.3.100.100/services/WorkflowService?wsdl")); Object[] Params=NewObject[5]; params[0]=NULL; params[1]=NewInteger (1497276);//Workflow Request IDparams[2]=NewInteger (26626);//NULL node operator IDParams[3]= "Submit";//The process is returned when the parameter is reject, and the process is submitted for submitparams[4]= "Manual Test OA Interface";//Object[] results = C.invoke ("Submitworkflowrequest", params); Result= Results[0].tostring (); } Catch(malformedurlexception e) {System.out.println (e); E.printstacktrace (); } Catch(Exception e) {System.out.println (e); E.printstacktrace (); } System.out.println ("Result:" +result); returnresult; }
The second type:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
public static String testOrg2(){
String endpoint=
"http://10.3.100.198:8080/ccqc/services/unitSynService?wsdl"
;
String result =
""
;
Service service =
new Service();
Call call;
try {
call=(Call)service.createCall();
call.setTargetEndpointAddress(endpoint);
//远程调用路径
call.setOperationName(
"untilSynXml"
);
//调用的方法名
//设置返回值类型:
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
//返回值类型:String
result = (String)call.invoke(
new Object[
0
]);
//远程调用
System.out.println(
"result:"
+result);
}
catch (Exception e) {
e.printStackTrace();
}
return result;
}
|