在Talend esb中使用tHashOutput和tHashInput

时间:2016-03-31 08:46:44

标签: esb talend

我正在尝试使用tHashOutput合并两个响应 - > tHashInput,所以我首先尝试将它用于简单,直接的工作,但它不起作用。我通过带有ID的Soap UI请求发送,然后根据来自DB的此ID反向名称发送,并将其显示为结果。数据被插入到hashOutput中,但不在hashInput中。

WSDL:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<wsdl:definitions name="customerSoap"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.talend.org/service/"
    targetNamespace="http://www.talend.org/service/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://www.talend.org/service/">
      <s:element name="getCustomer">
        <s:complexType>
          <s:sequence>
            <s:element name="customerId" type="s:integer"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getCustomerResponse">
        <s:complexType>
          <s:sequence>
            <s:element name="getCustomerResult" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getCustomerName">
        <s:complexType>
            <s:sequence>
                <s:element name="customerId" type="s:integer"></s:element>
            </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getCustomerNameResponse">
        <s:complexType>
            <s:sequence>
                <s:element name="customerNameResult" type="s:string"></s:element>
            </s:sequence>
        </s:complexType>
      </s:element>
  <s:element name="getCustomerAddress">
        <s:complexType>
          <s:sequence>
            <s:element name="customerId" type="s:integer"></s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getCustomerAddressResponse">
        <s:complexType>
          <s:sequence>
            <s:element name="customerAddressResult" type="s:string"></s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="getCustomerRequest">
    <wsdl:part element="tns:getCustomer" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="getCustomerResponse">
    <wsdl:part element="tns:getCustomerResponse" name="parameters"/>
  </wsdl:message>
  <wsdl:message name="getCustomerNameRequest">
    <wsdl:part name="parameters" element="tns:getCustomerName"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getCustomerNameResponse">
    <wsdl:part name="parameters" element="tns:getCustomerNameResponse"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getCustomerAddressRequest">
    <wsdl:part name="parameters" element="tns:getCustomerAddress"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="getCustomerAddressResponse">
    <wsdl:part name="parameters" element="tns:getCustomerAddressResponse"></wsdl:part>
  </wsdl:message>
  <wsdl:portType name="customerSoap">
    <wsdl:operation name="getCustomer">
      <wsdl:input message="tns:getCustomerRequest"/>
      <wsdl:output message="tns:getCustomerResponse"/>
    </wsdl:operation>
    <wsdl:operation name="getCustomerName">
      <wsdl:input message="tns:getCustomerNameRequest"/>
      <wsdl:output message="tns:getCustomerNameResponse"/>
    </wsdl:operation>
    <wsdl:operation name="getCustomerAddress">
      <wsdl:input message="tns:getCustomerAddressRequest"/>
      <wsdl:output message="tns:getCustomerAddressResponse"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="customerSoap" type="tns:customerSoap">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="getCustomer">
        <soap:operation soapAction="http://www.talend.org/service/getCustomer" />
        <wsdl:input>
            <soap:body use="literal" />
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal" />
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getCustomerName">
      <soap:operation soapAction="http://www.talend.org/service/getCustomer" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getCustomerAddress">
      <soap:operation soapAction="http://www.talend.org/service/getCustomer" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="airport">
    <wsdl:port binding="tns:customerSoap" name="customerSoap">
      <soap:address location="http://localhost:8090/esb/customerSoap"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

例外:

Starting job customerSoap_getCustomerName at 10:31 31/03/2016.

[statistics] connecting to socket on port 3524
[statistics] connected
mar 31, 2016 10:31:04 AM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://www.talend.org/service/}airport from WSDL: C:/Users/VKAROL/Downloads/TESB/Studio/workspace/FINAL10/services/customerSoap_0.1.wsdl
mar 31, 2016 10:31:05 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:8090/esb/customerSoap
2016-03-31 10:31:05.163:INFO:oejs.Server:jetty-8.1.14.v20131031
2016-03-31 10:31:05.221:INFO:oejs.AbstractConnector:Started SelectChannelConnector@localhost:8090
web service [endpoint: http://localhost:8090/esb/customerSoap] published
mar 31, 2016 10:31:08 AM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://www.talend.org/service/}airport#{http://www.talend.org/service/}getCustomerName has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [2,0].
    at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:94)
    at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54)
    at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:48)
    at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:136)
    at org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:234)
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [2,0]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:685)
    at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2141)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131)
    at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:771)
    at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:701)
    at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:625)
    at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:91)
    ... 28 more

以下是我的工作方式: enter image description here

我的tXMLMap: enter image description here

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

来自Talend Team的Shong在官方论坛上的回答:

您好 我认为这是因为在tESBRequestProvider上检查了'keep listening'框,与onsubjobOK链接的tHashInput永远不会工作。要解决此问题,请将作业设计更改为: tESBRequestProvider ..... tHashOutput - oncomponentok-tHashInput - 主 - tESBResponseProvider 问候 龙祥