Java Apache Camel CXF端点-如何指定soap操作?

Java Apache Camel CXF端点-如何指定soap操作?,java,soap,wsdl,apache-camel,cxf,Java,Soap,Wsdl,Apache Camel,Cxf,我有一个带有两个soap操作的wsdl。因此,我从中生成了java类,现在有了一个接口: @WebService(targetNamespace = "...", name = "...") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface RequestsService { @WebMethod @WebResult(name = "sendErrorReportRe

我有一个带有两个soap操作的wsdl。因此,我从中生成了java类,现在有了一个接口:

@WebService(targetNamespace = "...", name = "...")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface RequestsService {

    @WebMethod
    @WebResult(name = "sendErrorReportResponse", targetNamespace = "...", partName = "result")
    public SendErrorReportResponse sendErrorReport(
        @WebParam(partName = "parameters", name = "sendErrorReport", targetNamespace = "...")
        SendErrorReport parameters
    );

    @WebMethod
    @WebResult(name = "bookRequestResponse", targetNamespace = "...", partName = "result")
    public BookRequestResponse bookRequest(
        @WebParam(partName = "parameters", name = "bookRequest", targetNamespace = "...")
        ServiceRequestMessage parameters
    );
}
@Bean
public CxfEndpoint myEndpoint() {
    CxfEndpoint cxfEndpoint = new CxfEndpoint();
    cxfEndpoint.setAddress("...");
    cxfEndpoint.setServiceClass(RequestsService.class);
    cxfEndpoint.setDataFormat(DataFormat.POJO);
    cxfEndpoint.setLoggingFeatureEnabled(true);
    return cxfEndpoint;
}
然后,我为这个接口创建了CXF端点:

@WebService(targetNamespace = "...", name = "...")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface RequestsService {

    @WebMethod
    @WebResult(name = "sendErrorReportResponse", targetNamespace = "...", partName = "result")
    public SendErrorReportResponse sendErrorReport(
        @WebParam(partName = "parameters", name = "sendErrorReport", targetNamespace = "...")
        SendErrorReport parameters
    );

    @WebMethod
    @WebResult(name = "bookRequestResponse", targetNamespace = "...", partName = "result")
    public BookRequestResponse bookRequest(
        @WebParam(partName = "parameters", name = "bookRequest", targetNamespace = "...")
        ServiceRequestMessage parameters
    );
}
@Bean
public CxfEndpoint myEndpoint() {
    CxfEndpoint cxfEndpoint = new CxfEndpoint();
    cxfEndpoint.setAddress("...");
    cxfEndpoint.setServiceClass(RequestsService.class);
    cxfEndpoint.setDataFormat(DataFormat.POJO);
    cxfEndpoint.setLoggingFeatureEnabled(true);
    return cxfEndpoint;
}
路线:

public static final String ENDPOINT = "cxf:bean:myEndpoint";

    @Autowired
    private MyProcessor processor;

    @Override
    public void configure() throws Exception {
        from("quartz2://report?cron=0+*+*+*+*+?")
                .process(processor)
                .to(ENDPOINT);
    }
我的问题是,如何指定调用我的soap操作之一—sendErrorReport或bookRequest

附言 当我从wsdl和报告的类中删除sendErrorReport方法时,这段代码对于bookRequest方法非常有效。否则,会出现以下例外情况:

Caused by: java.lang.IllegalArgumentException: Part {http://...} parameters should be of type SendErrorReport, not ServiceRequestMessage
    at org.apache.cxf.jaxb.io.DataWriterImpl.checkPart(DataWriterImpl.java:292)
    at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:220)
...

您可以在端点URI中设置操作:

ENDPOINT=“cxf:bean:myEndpoint?defaultOperationName=sendErrorReport”

和/或您可以将
operationName
Camel头设置为所需的值

.process(处理器)
.setHeader(“operationName”,常量(“sendErrorReport”))
.至(终点);

请注意,在这两种情况下,处理器都需要为用于避免上述异常的操作创建相应参数类型的实例