Eclipse无法使用AXIS2和CXF创建Web服务客户端

时间:2013-01-17 17:04:13

标签: cxf axis webservice-client eclipse-wtp

尝试从提供的WSDL开发WS客户端几天后,我发现我一直都在使用axis,而不是axis2 ......

好吧,我正在做的是右击wsdl>新>其他> Web服务客户端。

在向导窗口中,'Web服务运行时'一直设置为'Apache Axis',我没有看到。单击它我可以选择'Apache Axis2'和'Apache CXF 2.x',但两者都失败,而'Apache Axis'“工作”:客户端已创建,但不会向XML添加头用户名和密码请求。

这是我在尝试使用CXF时遇到的错误:

Unable to add the follwing facets to project SIAPP_WS_FORNECEDOR_CFX_01: CXF 2.x Web Services.
    org.eclipse.wst.common.project.facet.core.FacetedProjectFrameworkException: Failed while installing CXF 2.x Web Services 1.0.
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1507)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modifyInternal(FacetedProject.java:441)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.mergeChangesInternal(FacetedProject.java:1181)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.access$2(FacetedProject.java:1117)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject$1.run(FacetedProject.java:324)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.modify(FacetedProject.java:339)
    at org.eclipse.jst.ws.internal.consumption.ui.common.FacetOperationDelegate$1.run(FacetOperationDelegate.java:62)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: org.eclipse.core.runtime.CoreException: CXF Runtime location not set. Please set location in Preferences > Web Services > CXf 2.x Preferences
    at org.eclipse.jst.ws.internal.cxf.facet.CXFFacetInstallDelegate.execute(CXFFacetInstallDelegate.java:50)
    at org.eclipse.wst.common.project.facet.core.internal.FacetedProject.callDelegate(FacetedProject.java:1477)
    ... 8 more

1 个答案:

答案 0 :(得分:5)

对于CXF,您需要转到Preference - >网络服务 - > CXF 2.x首选项并添加CXF运行时(指向CXF安装)。这应该允许它找到CXF所需的wsdl2java工具(等等)。