日期:2014-05-18  浏览次数:20706 次

关于webservice用soap调用怎么写
现在有需求做一个用户对接,我是第三方软件,对方提供了一个wsdl地址,让我写个soap接收数据。这个怎么写,从来没写过这类型的。来个大神告诉下怎么写。很急!!!!
------解决方案--------------------
用客户端生成的话会生成很大一堆垃圾JAVA类,你用这个方法直接调用会好点,前提是要导入axis2的包:

private String sendService(String param, String url, String method) {
log.info("InvoicePostService: now post to WMS param is :" + param);
String result="";
try {
RPCServiceClient serviceClient = new RPCServiceClient();

Options options = serviceClient.getOptions();

EndpointReference targetEPR = new EndpointReference(url);

options.setTo(targetEPR);

QName opAddEntry = new QName( SystemConfig.getProperty("service.invoice.qname"), method);

Object[] opAddEntryArgs = new Object[] { param };

Class<?>[] classes = new Class[] { String.class };

result = (String) serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes)[0];

log.info("The result is :" + result);
} catch (Exception e) {
log.error("post  was failed error is :" + ExceptionUtils.getFullStackTrace(e));
throw new RuntimeException(" post to  was failed error is :"+e.getMessage());
}
return result;
}

------解决方案--------------------
提供给你wsdl,是要你访问的,访问方式很多,能成功访问就行。
------解决方案--------------------
wsdl 就是 提供 了 一个 web service接口,,具体业务怎么实现,就看这个wsdl里面的数据了,。。他可以把用户更改的数据传过来了吧 ,,如果 说做同步的话