在wso2 ESB中如何发送TCP消息

时间:2018-09-25 11:58:35

标签: wso2 wso2esb

在wso2 ESB中,向TCP请求发送请求时,出现以下异常。

[2018-09-25 17:10:49,978] [] ERROR - TCPWorker Error while processing TCP request through the Axis2 engine
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'f' (code 102) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
        at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
        at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
        at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
        at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:65)
        at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:188)
        at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:146)
        at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:109)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'f' (code 102) in prolog; expected '<'
 at [row,col {unknown-source}]: [1,1]
        at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
        at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
        at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
        at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
        ... 13 more

我已经配置了axis2.xml

    <transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
        <parameter name="transport.tcp.port">6060</parameter>
    </transportReceiver>
<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

API代码:

<?xml version="1.0" encoding="UTF-8"?>
<api context="/testtcp" name="testtcp" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST">
        <inSequence>
            <log level="full"/>
            <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
            <property name="ContentType" scope="axis2" type="STRING" value="text/plain"/>
            <send>
                <endpoint>
                    <address uri="tcp://localhost:6060"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence>
            <log level="full"/>
            <send/>
        </outSequence>
        <faultSequence/>
    </resource>
</api>

根据他们提到的有关肥皂请求的文档,所以可以发送文本/纯文本。

0 个答案:

没有答案