简体   繁体   English

使用在wsimport JAX-WS中创建的Web服务

[英]Using webservice created in wsimport JAX-WS

This is a pretty basic question but I don't really see an answer anywhere. 这是一个非常基本的问题,但我在任何地方都看不到答案。 I created a webservice using wsimport and a wsdl. 我使用wsimport和wsdl创建了一个Web服务。

It created a large number of files. 它创建了大量文件。 Most of them appear to be beans representing the methods of the webservice. 它们中的大多数似乎是代表Web服务方法的bean。 There are also classes called Gateway, Gateway SOAP, and ObjectFactory. 也有称为网关,网关SOAP和ObjectFactory的类。 How exactly do you go about actually calling the web-service with these methods? 您究竟如何使用这些方法实际调用Web服务?

You should do something like this: 您应该执行以下操作:

Gateway svc = new Gateway();
GatewaySOAP port = svc.getGatewaySOAP();
MyRequestClass rq = new MyRequestClass();
rq.setSomething(2);
MyResponseClass rs = port.doMyVeryOwnJob(rq);
System.out.println("Result is: " + rs.getSomethingElse());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM