Question

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

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?

Thank you!

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>
Was it helpful?

Solution

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.

Therefore I deduce that the error message

"Content is not allowed in prolog"

actually means

"Unexpected content type"

OTHER TIPS

When you have following outsequence configuration what your log prints?

<outSequence>
     <log level="full">
        <property name="MyTrace" value="--- RESPONSE ---"/>
     </log>


     <send/>
  </outSequence>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top