You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Camel CXF WS Producer(POJO格式)调用GetReport报参数数量错误

Let's work through this issue step by step to figure out why you're getting that parameter mismatch error.

First, Understand the Root Cause

The error Expect size 7, Parameter size 4 tells us that CXF is expecting 7 parameters to invoke the GetReport operation, but you're only passing 4. This number directly comes from the method signature of the ReportServiceSoap interface generated by wsdl2java—so our first stop should be checking that file.

Step 1: Check Your Generated SEI Method Signature

Open the tableau.ea.eventcore.api.reportservice.ReportServiceSoap.java file created by wsdl2java and look for the getReport method. It will look something like this (adjust based on your actual code):

public void getReport(
    GetReport request,
    AuthTokenHeader authTokenHeader,
    CredentialsHeader credentialsHeader,
    javax.xml.ws.Holder<GetReportResponse> responseHolder,
    javax.xml.ws.Holder<AuthTokenHeader> outAuthTokenHolder,
    // Additional parameters if your WSDL defines more output/input parts
    javax.xml.ws.Holder<SomeOtherHeader> extraOutHeader1,
    javax.xml.ws.Holder<AnotherHeader> extraOutHeader2
);

This is where the "7 parameters" expectation comes from—each input part (body + headers) is a parameter, and each output part (body + headers) is a javax.xml.ws.Holder parameter.

Step 2: Fix Parameter Order & Missing Values

Looking at your current code, there are two critical issues:

  1. Wrong input header order: Your WSDL defines input headers in the order AuthTokenHeader first, then CredentialsHeader, but you're passing credentials as the second parameter.
  2. Missing output body holder: You commented out the Holder<GetReportResponse> which is required for the operation's output body.

Corrected Code Example

Assuming your SEI expects 7 parameters (adjust based on your actual method signature), here's how to construct the parameter list correctly:

GetReport getReport = new GetReport();
// Populate getReport fields as before...

CredentialsHeader credentials = new CredentialsHeader();
// Populate credentials fields as before...

// Create AuthTokenHeader (even if empty, match the type)
AuthTokenHeader authTokenHeader = new AuthTokenHeader();
// If you don't need to set values, you can pass null instead, but keep the position

// Create holders for output values
javax.xml.ws.Holder<GetReportResponse> responseHolder = new javax.xml.ws.Holder<>();
javax.xml.ws.Holder<AuthTokenHeader> outAuthTokenHolder = new javax.xml.ws.Holder<>();
// Add any additional holders required for extra output parts (to reach 7 parameters)
javax.xml.ws.Holder<SomeOtherHeader> extraOutHolder1 = new javax.xml.ws.Holder<>();
javax.xml.ws.Holder<AnotherHeader> extraOutHolder2 = new javax.xml.ws.Holder<>();

List<Object> params = new ArrayList<>();
params.add(getReport);          // 1. Input body (GetReport)
params.add(authTokenHeader);    // 2. First input header (AuthTokenHeader)
params.add(credentials);        // 3. Second input header (CredentialsHeader)
params.add(responseHolder);     // 4. Output body holder (GetReportResponse)
params.add(outAuthTokenHolder); // 5. Output header holder (AuthTokenHeader)
params.add(extraOutHolder1);    // 6. Extra output holder 1 (match SEI type)
params.add(extraOutHolder2);    // 7. Extra output holder 2 (match SEI type)

exchange.getIn().setBody(params);

Key Checks to Verify

  • Match SEI exactly: Every parameter in your list must match the type and order defined in the getReport method of ReportServiceSoap. If you pass a null, make sure it's for a parameter that accepts null (most input parameters do).
  • Confirm CXF Endpoint config: Double-check that serviceClass, serviceName, and endpointName in your CxfEndpoint match the generated code and WSDL exactly. The dataFormat=POJO setting is correct for your use case.
  • Avoid skipping parameters: Even if you don't need a header or output value, you can't skip its position in the list—fill it with a null or empty object of the correct type.

内容的提问来源于stack exchange,提问作者Sowjanya Mudimala

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:55:21