中的序言异常中不允许

中的序言异常中不允许

本文介绍了OutSecuence 中的序言异常中不允许 WSO2 ESB 内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有soap webservice的代理服务,该服务执行soap到rest转换,消息被发送到一个servlet,该servlet响应一个平面格式(不是xml)的字符串,只是像

I am developing a proxy service with a soap webservice that performs soap to rest conversion, the message is sent to a servlet that response with a string in flat format (not xml), just a secuence of characters like

 OIUW|ECHNOWE|RFHQWIUE|FBPQW|EFHAO|IEFH

我正在使用 SOAP UI 进行调用并且我得到了很好的响应,现在我想以SOAP 格式"接收它,将消息包装到一个 soap:body 中,我已经尝试使用 XSLT 和 PayloadFactory Mediator,但是一旦我使用其中任何一个(甚至什么都不做),我就会得到一个

I am invoking with SOAP UI and I get this response fine, now I would like to receive it in "SOAP format", wrapping the message into a soap:body, I've tried with a XSLT and with a PayloadFactory Mediator, but as soon as I use any of them (even doing nothing) I get a

[2014-07-31 09:30:41,847] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at     [row,col]:[1,1]
Message: Content is not allowed in prolog.

我做错了什么?如果没有这个异常,我如何实现消息转换?

What do I do wrong ? How can I achieve a message transformation without this exception?

谢谢!

更新: Ratha 要求我的代理

UPDATE: My proxy as requested by Ratha

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
   name="SCL3"
   transports="http"
   startOnLoad="true"
   trace="disable">
<description/>
<target>
  <inSequence>
     <log level="custom">
        <property name="MyTrace" value="--- REQUEST ---"/>
     </log>
     <log level="full"/>
     <property name="REST_URL_POSTFIX"
               value="x4?msg=x4|0003|0000000021|0|0|0400002081020224849"
               scope="axis2"
               type="STRING"/>
     <property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
     <property name="SOAPAction" scope="default" action="remove"/>
     <header name="Action" scope="default" action="remove"/>
     <send>
        <endpoint>
           <address uri="http://localhost:8087/X4" format="pox"/>
        </endpoint>
     </send>
  </inSequence>
  <outSequence>
     <log level="custom">
        <property name="MyTrace" value="--- RESPONSE ---"/>
     </log>
     <property name="ContentType"
               value="application/soap+xml"
               scope="transport"
               type="STRING"/>
     <property name="messageType"
               value="application/soap+xml"
               scope="transport"
               type="STRING"/>
     <payloadFactory media-type="xml">
        <format>
           <a xmlns="">$1</a>
        </format>
        <args>
           <arg value="my value"/>
        </args>
     </payloadFactory>
     <send/>
  </outSequence>
  </target>
  <publishWSDL uri="file:/C:/wso2/wso2esb-4.8.1/repository/workspaces/myproject/SCL3.wsdl"/>
</proxy>

推荐答案

我看到我的 servlet 将内容类型设置为text/xml"而不是text/plain",我已将其更改为text/plain",现在一切正常.

I've seen that my servlet was setting content type to "text/xml" instead of "text/plain", I've changed it to "text/plain" and everything is working fine now.

因此我推断出错误信息

序言中不允许有内容"

其实就是

意外内容类型"

这篇关于OutSecuence 中的序言异常中不允许 WSO2 ESB 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:08