1

我是 mule ESB 的新手,我正在尝试实现一个简单的应用程序流程:

<mule ...>
    <flow name="extrator_gep_spedFlow1" doc:name="extrator_gep_spedFlow1">
        <file:inbound-endpoint path="/home/brevleq/inicio_extrator" responseTimeout="10000" doc:name="Inicio"/>
        <file:file-to-string-transformer doc:name="File to String"/>
        <echo-component doc:name="Echo"/>
        <cxf:jaxws-client operation="empresaExiste" clientClass="com.hrgi.gepsped.ServicoDeCadastroEAgendamento_Service" port="hrgi" enableMuleSoapHeaders="true" doc:name="empresa esta cadastrada"/>
        <echo-component doc:name="Echo"/>
    </flow>
</mule>

基本上,当用户将文件放入扫描的目录中时,此流程开始,并使用文件的内容调用 web 服务。

不幸的是,执行流程时出现此错误:

Exception stack is:
1. Unexpected wrapper element {http://endpoints.ws.gepsped.hrgi.com/}empresaExiste found.   Expected {http://endpoints.ws.gepsped.hrgi.com/}empresaExisteResponse. (org.apache.cxf.interceptor.Fault)
org.apache.cxf.interceptor.DocLiteralInInterceptor:106 (null)
2. Unexpected wrapper element {http://endpoints.ws.gepsped.hrgi.com/}empresaExiste found.   Expected {http://endpoints.ws.gepsped.hrgi.com/}empresaExisteResponse. (javax.xml.ws.soap.SOAPFaultException)
org.apache.cxf.jaxws.JaxWsClientProxy:156 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/ws/soap/SOAPFaultException.html)
3. Unexpected wrapper element {http://endpoints.ws.gepsped.hrgi.com/}empresaExiste found.   Expected {http://endpoints.ws.gepsped.hrgi.com/}empresaExisteResponse.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PushbackInputStream (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:148 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://endpoints.ws.gepsped.hrgi.com/}empresaExiste found.   Expected {http://endpoints.ws.gepsped.hrgi.com/}empresaExisteResponse.
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

这是 wsdl2java 生成的类:

@WebServiceClient(name = "ServicoDeCadastroEAgendamento", 
              wsdlLocation = "http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento?wsdl",
              targetNamespace = "http://endpoints.ws.gepsped.hrgi.com/") 
public class ServicoDeCadastroEAgendamento extends Service {
public final static URL WSDL_LOCATION;

public final static QName SERVICE = new QName("http://endpoints.ws.gepsped.hrgi.com/", "ServicoDeCadastroEAgendamento");
public final static QName Hrgi = new QName("http://endpoints.ws.gepsped.hrgi.com/", "hrgi");
static {
    URL url = null;
    try {
        url = new URL("http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento?wsdl");
    } catch (MalformedURLException e) {
        java.util.logging.Logger.getLogger(ServicoDeCadastroEAgendamento.class.getName())
            .log(java.util.logging.Level.INFO, 
                 "Can not initialize the default wsdl from {0}", "http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento?wsdl");
    }
    WSDL_LOCATION = url;
}

public ServicoDeCadastroEAgendamento(URL wsdlLocation) {
    super(wsdlLocation, SERVICE);
}

public ServicoDeCadastroEAgendamento(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}

public ServicoDeCadastroEAgendamento() {
    super(WSDL_LOCATION, SERVICE);
}

public ServicoDeCadastroEAgendamento(WebServiceFeature ... features) {
    super(WSDL_LOCATION, SERVICE, features);
}

public ServicoDeCadastroEAgendamento(URL wsdlLocation, WebServiceFeature ... features) {
    super(wsdlLocation, SERVICE, features);
}

public ServicoDeCadastroEAgendamento(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
    super(wsdlLocation, serviceName, features);
}

@WebEndpoint(name = "hrgi")
public ServicoDeCadastroEAgendamentoEndPoint getHrgi() {
    return super.getPort(Hrgi, ServicoDeCadastroEAgendamentoEndPoint.class);
}

@WebEndpoint(name = "hrgi")
public ServicoDeCadastroEAgendamentoEndPoint getHrgi(WebServiceFeature... features) {
    return super.getPort(Hrgi, ServicoDeCadastroEAgendamentoEndPoint.class, features);
}
}

这是我的服务生成的 wsdl:

<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://endpoints.ws.gepsped.hrgi.com/"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"
         targetNamespace="http://endpoints.ws.gepsped.hrgi.com/" name="ServicoDeCadastroEAgendamento">
<types>
    <xsd:schema>
        <xsd:import namespace="http://endpoints.ws.gepsped.hrgi.com/"
                    schemaLocation="http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento?xsd=1"/>
    </xsd:schema>
</types>
<message name="empresaExiste">
    <part name="parameters" element="tns:empresaExiste"/>
</message>
<message name="empresaExisteResponse">
    <part name="parameters" element="tns:empresaExisteResponse"/>
</message>
<message name="cadastrarEmpresa">
    <part name="parameters" element="tns:cadastrarEmpresa"/>
</message>
<message name="cadastrarEmpresaResponse">
    <part name="parameters" element="tns:cadastrarEmpresaResponse"/>
</message>
<message name="recuperarHorarioAgendamento">
    <part name="parameters" element="tns:recuperarHorarioAgendamento"/>
</message>
<message name="recuperarHorarioAgendamentoResponse">
    <part name="parameters" element="tns:recuperarHorarioAgendamentoResponse"/>
</message>
<portType name="ServicoDeCadastroEAgendamentoEndPoint">
    <operation name="empresaExiste">
        <input message="tns:empresaExiste"/>
        <output message="tns:empresaExisteResponse"/>
    </operation>
    <operation name="cadastrarEmpresa">
        <input message="tns:cadastrarEmpresa"/>
        <output message="tns:cadastrarEmpresaResponse"/>
    </operation>
    <operation name="recuperarHorarioAgendamento">
        <input message="tns:recuperarHorarioAgendamento"/>
        <output message="tns:recuperarHorarioAgendamentoResponse"/>
    </operation>
</portType>
<binding name="hrgiBinding" type="tns:ServicoDeCadastroEAgendamentoEndPoint">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="empresaExiste">
        <soap:operation soapAction=""/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
    <operation name="cadastrarEmpresa">
        <soap:operation soapAction=""/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
    <operation name="recuperarHorarioAgendamento">
        <soap:operation soapAction=""/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>
<service name="ServicoDeCadastroEAgendamento">
    <port name="hrgi" binding="tns:hrgiBinding">
        <soap:address location="http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento"/>
    </port>
</service>
</definitions>

有人可以解释一下我做错了什么吗?

4

1 回答 1

3

我的错误,我不知道在 cxf 组件之后需要一个端点:

<mule ...>
    <flow name="extrator_gep_spedFlow1" doc:name="extrator_gep_spedFlow1">
        <file:inbound-endpoint path="/home/brevleq/inicio_extrator" responseTimeout="10000" doc:name="Inicio"/>
        <file:file-to-string-transformer doc:name="File to String"/>
        <echo-component doc:name="Echo"/>
        <cxf:jaxws-client operation="empresaExiste" clientClass="com.hrgi.gepsped.ws.endpoints.ServicoDeCadastroEAgendamento" port="hrgi" enableMuleSoapHeaders="true" doc:name="empresa esta cadastrada">
            <cxf:jaxb-databinding/>
        </cxf:jaxws-client>
        <outbound-endpoint address="http://localhost:8080/gep-sped/servicos/ServicoDeCadastroEAgendamento" doc:name="Generic" exchange-pattern="request-response"/>
        <echo-component doc:name="Echo"/>
    </flow>
</mule>
于 2012-11-15T20:46:52.823 回答