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()); } } }