//WSDL路径
String wsUrl = "http://localhost:8082/ws/services/bank?wsdl" ;
//方法名
String method = "getCaseProve";
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
Client client = factory.createClient(wsUrl);
Endpoint endpoint = client.getEndpoint();
QName opName = new QName(endpoint.getService().getName().getNamespaceURI(), method);
BindingInfo bindingInfo = endpoint.getEndpointInfo().getBinding();
System.out.println(client);
if (bindingInfo.getOperation(opName) == null) {
for (BindingOperationInfo operationInfo : bindingInfo.getOperations()) {
if (method.equals(operationInfo.getName().getLocalPart())) {
opName = operationInfo.getName();
break;
}
}
}
//请求报文
String xmlInput= " unit
+ "\" HouseID=\""
+ houseId
+ "\" RecHouseNum=\""
+ recHouseNum + "\">";
Object[] res = null;
try {
res = client.invoke(opName, xmlInput);
String xml = (String) res[0];
System.err.println("@@@@@@@@@@@@@@@@@"+xml);
} catch (Exception e) {
e.printStackTrace();
}