0

i am doing a Object to string conversion, but when i am doing it is adding one extra question mark at the very begin of string.

below is my flow code

<flow name="jatoSmartWriteFromFTP" doc:name="jatoSmartWriteFromFTP" processingStrategy="synchronous"> 
        <ftp:inbound-endpoint host="delvmpllreap03.sapient.com" port="21" path="/home/jatopoc" user="jatopoc" password="jatopoc" responseTimeout="10000" doc:name="FTP" mimeType="text/xml"> 
            <file:filename-wildcard-filter pattern="filter_data.xml"></file:filename-wildcard-filter>  
        </ftp:inbound-endpoint>  
        <logger message="#[message.payload]" level="INFO" doc:name="Logger"></logger>
        <object-to-string-transformer doc:name="Object to String" mimeType="text/xml"/>      
        <mulexml:jaxb-xml-to-object-transformer name="XmlToPerson" jaxbContext-ref="jatoJaxbContext" returnClass="com.jato.speedwing.common.vo.JATOXML"/>  
        <component doc:name="Java"> 
           <method-entry-point-resolver> 
                <include-entry-point method="insert"></include-entry-point>  
            </method-entry-point-resolver>
            <spring-object bean="jatoDAO"> </spring-object>  
        </component>
        <jms:outbound-endpoint topic="com.jato.smart.updateInfo" connector-ref="VM_Active_MQ" doc:name="JMS"/>
    </flow>

below is my xml file content at ftp

<?xml version="1.0" encoding="UTF-8"?>
<code>
data
</code>

below is the string output after doing object-to-string transformer

 ?<?xml version="1.0" encoding="UTF-8"?>
     <code>
      data
     </code>

now because of this extra question mark, my jaxb-xml-to-object transformer is not working.. can anybody suggest my what do here. since my task is to read a xml file from ftp > convert that file content to jaxb object(as file content is xml data).

vashishth
  • 2,751
  • 4
  • 38
  • 68
  • 1
    If you open the XML file with an hex editor, do you see characters before the XML prolog? – David Dossot Nov 21 '13 at 16:29
  • I dont understand why we need to check in hex edition. anyway i have tested the same file Content with xml prolong with soap service instead of using ftp. and it is working fine – vashishth Nov 22 '13 at 09:16
  • I was wondering if there was any hidden character before the prolog. Windows sometimes write an encoding mark which creates issues and that you can only see with an hex editor. – David Dossot Nov 22 '13 at 17:03

1 Answers1

0

Place a debug breakpoint on Object->String component. Debug your application and determine exactly what you are asking to convert to String (mimeType=text/XML). Mule is interpreting something in the object given and somehow producing the question mark. Some people have seen three question marks before the XML doc declaration and also other character combinations. The 3 question marks represent a byte order mark (BOM) that's a special UNICODE character dealing with endian-ness and byte order. Your case may be related to the character encoding as well. Debug the flow and identify the incoming object. Understand the operation and it's parameters.

David Whitehurst
  • 352
  • 4
  • 21