POST请求代理服务WSO2

时间:2012-06-15 06:57:57

标签: post wso2 synapse wso2esb

我正在向代理服务发送一个帖子请求,但是它给出了错误...我怎样才能恢复这个

[2012-06-15 12:24:27,656]  INFO - BuilderUtil OMException in getSOAPBuilder
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    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.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
    at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:688)
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
    at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
    at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
    at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    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
[2012-06-15 12:24:27,675]  INFO - BuilderUtil Remaining input stream :[]
[2012-06-15 12:24:27,675] ERROR - ServerWorker Error processing POST request 
org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:180)
    at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:409)
    at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:261)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:173)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    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.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
    at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:688)
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
    ... 6 more
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:686)
    at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2134)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2040)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    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

我的代理cinfiguration是:

<proxy name="stripe" transports="https http" startOnLoad="true" trace="disable">
        <target>
            <endpoint>
                <address uri="https://api.stripe.com/v1"/>
            </endpoint>
            <inSequence>
                <log level="full" separator="SSSSSSSSSSSSSSSSSs">
                    <property name="HTTP_METHOD" value="post"/>
                </log>
                <send/>
            </inSequence>
            <outSequence>
                <log level="full" separator=", ooooooooooo"/>
                <send/>
            </outSequence>
        </target>
    </proxy>

执行请求的Curl命令:

curl https://localhost:8243/services/stripe/charges/ch_iQs4noWTm7J5Kk/refund  -u Ixj3FHIiQSFWrzb4VNSxoThKVk3IXpBF --insecure -X POST

我没有得到错误判断的确切原因

2 个答案:

答案 0 :(得分:0)

POST请求的内容类型是什么。如果您没有使用的内容类型的fomatter和builder消息,则会发生此错误。

答案 1 :(得分:0)

我花了7天的时间解决此错误。这个错误有很多不同的答案。

当您的Web服务返回到wso代理为空的主体或错误的内容长度或其他内容(有很多东西)时,就会发生这种情况。

但是在我的情况下,问题是我的路由“ /”(POST方法)上的Web服务如果内容长度等于0,则返回400代码。长度标头,也可以不包含此标头,而我的网络服务只是“阻止”此标头并返回400代码。