首页 > 学院 > 开发设计 > 正文

webservice 应用实例

2019-11-08 00:04:59
字体:
来源:转载
供稿:网友

wsdl2java -p com.PRoject.update-d D://wsdl//try//new -all  http://127.0.0.1:8080/ProjectName/ServiceName?wsdl

根据wsdl文件生成java代码。

public class WebserviceTest{private static final QName SERVICE_NAME = new QName("targetNamespace", "ServiceName");private static final String PayQueryServiceURL="http://127.0.0.1:8080/ProjectName/ServiceName?wsdl"; public OrderInfoDetail getDetail(String order)  {try {            URL wsdlURL = new URL(PayQueryServiceURL);            Service service = Service.create(wsdlURL, SERVICE_NAME);            service.addPort(null, SOAPBinding.SOAP11HTTP_BINDING, null);           PayService  payService= service.getPort(PayService.class);     Source source = new Source();   OrderInfoDetail orderInfoDetail = payService.getDetail(source, order);        } catch (Exception e) {            loger.error("异常:"+e.getMessage());        }}}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表