Intellij的WSDL客户端生成代码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Intellij的WSDL客户端生成代码相关的知识,希望对你有一定的参考价值。
我试图让客户端连接到Web服务并在服务器上使用SetFlight方法。
环境是Intellij Ultimate,Java 7和JAXWS。从WSDL生成类已经完成。
在生成的类中,我有两个服务:
@WebServiceClient(name = "FOService", targetNamespace = "http://temporaryuri.org.au/", wsdlLocation = "http://fovanil.com/FOService.svc?wsdl")
public class FOService
extends Service
{
private final static URL FOSERVICE_WSDL_LOCATION;
private final static WebServiceException FOSERVICE_EXCEPTION;
private final static QName FOSERVICE_QNAME = new QName("http://temporaryuri.org.au/", "FOService");
static {
...
和IFO服务
@WebService(name = "IFOService", targetNamespace = "urn:fo.com.au/schema/common")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface IFOService {
/**
*
* @param parameters
* @return
* returns svc.SetFlightResponse
*/
@WebMethod(operationName = "SetFlight", action = "http://fo.com.au/SetFlight")
@WebResult(name = "SetFlightResponse", targetNamespace = "urn:fo.com.au/schema/common/types", partName = "parameters")
public SetFlightResponse SetFlight(
@WebParam(name = "SetFlightRequest", targetNamespace = "urn:fo.com.au/schema/common/types", partName = "parameters")
SetFlightRequest parameters);
}
我已经看了一些实现客户端https://docs.oracle.com/javaee/5/tutorial/doc/bnayn.html的例子,但这有所不同。
我原以为使用这个会是:
IFOSerice service = new IFOService();
service.SetFlight(someinstanceofflight); //setFlight is not a available method
如何创建客户端并使用SetFlight方法?
答案
这段代码有效:
SetFORequest request = new SetFORequest();
SetFOResponse response = new SetFOResponse();
request.setFO(flight);
FOService foService = new FOService();
IfoService ifoService = foService.getWSHttpBindingIFOService();
ifoService.setFO(request);
以上是关于Intellij的WSDL客户端生成代码的主要内容,如果未能解决你的问题,请参考以下文章
C#在做WSDL生成客户端代码,无法添加soapheader