Intellij的WSDL客户端生成代码

时间:2017-12-14 18:42:05

标签: java web-services intellij-idea wsdl jax-ws

我正在尝试使客户端连接到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方法?

1 个答案:

答案 0 :(得分:1)

此代码有效:

    SetFORequest request = new SetFORequest();
    SetFOResponse response = new SetFOResponse();
    request.setFO(flight);
    FOService foService = new FOService();
    IfoService ifoService = foService.getWSHttpBindingIFOService();
    ifoService.setFO(request);
相关问题