我有一个WSDL文件位于src\main\resources\wsdl\文件夹下,它在其中定义了多个操作。我的应用程序在 Weblogic 12C 服务器上运行。我正在尝试使用Apache Cammel(版本:2.18.3(和Java DSL公开SOAP网络服务 -
我在路由构建器类的配置方法下编写了以下代码 -
CxfComponent cxfComponent = new CxfComponent(getContext());
CxfEndpoint serviceEndpoint = new CxfEndpoint("/soap/Manage_Order", cxfComponent);
serviceEndpoint.setAddress("http://<IP>:<PORT>/myproject/soap/ManageOrder_Details");
serviceEndpoint.setServiceClass(
"Fully qualified service interface name generated from WSDL file using maven with @WebService annotation");
serviceEndpoint.setEndpointName(<end point name defined in the service class with @WebEndpoint annotation>);
serviceEndpoint.setDataFormat(DataFormat.MESSAGE);
serviceEndpoint.setDefaultOperationName("manageOrder");
getContext().addEndpoint("myServiceEndPoint1", serviceEndpoint);
from("cxf:myServiceEndPoint1").log("Hi, I am here").end();
当我部署应用程序时,它抛出以下异常 -
weblogic.application.ModuleException: java.lang.IllegalArgumentException: serviceClass must be specified
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:233)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:228)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException: serviceClass must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:311)
at org.apache.camel.component.cxf.CxfEndpoint.createServerFactoryBean(CxfEndpoint.java:663)
at org.apache.camel.component.cxf.CxfConsumer.createServer(CxfConsumer.java:70)
at org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:66)
at org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:252)
Truncated. see log file for complete stacktrace
绒球.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-soap</artifactId>
<version>2.18.3</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.18.3</version>
<!-- use the same version as your Camel core version -->
</dependency>
正如错误所说,您没有提到服务类和端点名称。serviceEndpoint.setServiceClass("Fully qualified service interface name generated from WSDL file using maven with @WebService annotation");
serviceEndpoint.setEndpointName(<end point name defined in the service class with @WebEndpoint annotation>);
步骤 1:使用 wsdl2java 命令或您选择的 IDE 从 wsdl 生成服务。 步骤 2:将其包含在代码类路径中 步骤 3:在上面的代码段中提及类名和终结点名