Java Camel CXF抛出部分{example.com}参数的类型应为X而不是Y

Java Camel CXF抛出部分{example.com}参数的类型应为X而不是Y,java,soap,wsdl,apache-camel,cxf,Java,Soap,Wsdl,Apache Camel,Cxf,我不熟悉SOAP,不知道问题出在哪里。我已经看过了,但不幸的是它没有帮助。 错误消息是: WARNING: Interceptor for {http://bbbts/Service}Service#{http://bbbts/Service}ConfirmAStatus has thrown exception, unwinding now IllegalArgumentException: Part {http://bbbts/Service}parameters should be of

我不熟悉SOAP,不知道问题出在哪里。我已经看过了,但不幸的是它没有帮助。 错误消息是:

WARNING: Interceptor for {http://bbbts/Service}Service#{http://bbbts/Service}ConfirmAStatus has thrown exception, unwinding now
IllegalArgumentException: Part {http://bbbts/Service}parameters should be of type package.ConfirmAStatusResponse, not package.ConfirmAStatus
我在Camel中配置了端点,如下所示:

    CxfEndpoint cxfEndpoint = new CxfEndpoint();
    cxfEndpoint.setAddress("http://0.0.0.0:8888/aaans/services/Service");
    cxfEndpoint.setWsdlURL("Service.wsdl");
    cxfEndpoint.setCamelContext(camelContext);
    cxfEndpoint.setBus(bus);
    cxfEndpoint.setServiceNameString("bbbts:Service");
    cxfEndpoint.setDefaultOperationName("ConfirmAStatus"); 
    cxfEndpoint.setDefaultOperationNamespace("http://bbbts/Service");

    try { 
    cxfEndpoint.setServiceClass("package.Service"); 
    } catch (ClassNotFoundException e1) { 
    } 
    cxfEndpoint.setDataFormat(DataFormat.POJO);  
我已经通过cxf codegen生成了服务类,它如下所示:

@WebService(targetNamespace = "http://bbbts/Service", name = "Service")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface Service {

@WebMethod(operationName = "ConfirmAStatus", action = "http://aaans/2012/nsv1/ConfirmARecallStatus")
@Action(input = "http://aaans/2012/nsv1/ConfirmProductBatchRecallStatus", output = "http://aaans/2012/nsv1/ConfirmAStatusResponse")
@WebResult(name = "ConfirmAStatusResponse", targetNamespace = "http://aaans/2012/", partName = "parameters")
public ConfirmAStatusResponse confirmAStatus(
    @WebParam(partName = "parameters", name = "ConfirmAStatus", targetNamespace = "http://aaans/2012/")
    ConfirmAStatus parameters
);
.... ConfirmBStatusResponse ...
我继承了WSDL文件,没有任何使用WSDL文件的经验,所以请告诉我哪些部分会有用。 这是wsdl文件中的操作:

<wsdl:operation name="ConfirmAStatus">
  <wsdl:input wsaw:Action="http://aaans/2012/nsv1/ConfirmAStatus" message="tns:Service_ConfirmAStatus_InputMessage"/>
  <wsdl:output wsaw:Action="http://aaans/2012/nsv1/ConfirmAStatusResponse" message="tns:Service_ConfirmAStatus_OutputMessage"/>
</wsdl:operation>

我完全无法理解错误信息。函数的参数类型显然是ConfirmStatus类型,而不是错误消息中声称的…StatusResponse类型。我尝试添加默认操作名称空间,如另一篇文章中所述,但没有效果。我甚至不知道它是否与名称空间有关。如果有人能告诉我解决这个问题的方向,我会非常感激

编辑:添加wsdl:消息部分

<wsdl:message name="Service_ConfirmAStatus_InputMessage">
  <wsdl:part name="parameters" element="q1:ConfirmAStatus" xmlns:q1="hhttp://aaans/2012/"/>
</wsdl:message>
<wsdl:message name="Service_ConfirmAStatus_OutputMessage">
  <wsdl:part name="parameters" element="q2:ConfirmAStatusResponse" xmlns:q2="http://aaans/2012/"/>
</wsdl:message>

错误消息指出参数
参数
的类型为
ConfirmAStatus
,但应为
ConfirmAStatusResponse

因为您的实现需要类型
ConfirmAStatus

ConfirmAStatus parameters
我怀疑WSDL中输入消息的定义是错误的,但是您的问题中没有包含这一部分

您可能有这样的消息定义

<wsdl:message name="Service_ConfirmAStatus_InputMessage">
    <wsdl:part name="NameOfTheElement" element="ReferenceToTheSchemaElementThatRepresentsThisMessagePart"/>
</wsdl:message>


在本例中,
referencetotheschemaElement表示该消息部分的XML模式定义似乎是
ConfirmAStatus
类型,而不是
ConfirmAStatusResponse

添加整个WSDL是可能的。您的响应应该是ConfirmAStatusResponse而不是ConfirmAStatus,这是另一种类型对象。@Namphibian不幸的是,我不能发布整个wsdl,我可以发布必要的部分。谢谢!我想这就解决了。我将在原始问题中添加相关的wsdl部分。现在出现了另一个问题:解组错误:“意外元素(uri:,local:aaansEnvelope”)。预期要素为(无)”。您认为我应该发布其他问题或添加相关信息吗?我将进行更多测试,然后将答案标记为已解决,当我可以确认此问题已解决时,再次感谢您。不客气。我将创建另一个问题,因为标题会误导(新)问题。