using FTP gateway i always get error 'content not allowed in

env: win2000p, mediator 731, JBOSS comming with this mediator
problem. i try to use the FTP gateway wit a GET command, but always i get error: ‘Exception: com.softwareag.xbridge.exceptions.DocumentParseException: [Fatal Error] :1:1: Content is not allowed in prolog.’
in the documenttation i don’t see anything.
what are some important settings for the FTP gatway. do we have any restriction for the file/file content read by the FTP gatway. by the way the file i try to read is located on LINUX

thanks

M

You are probably picking up a non-xml document, and thus by default replacing the current payload with non-xml.
If this is the case, what you need to do is specify a different/new message part to hold the document you are GETting. This way the (well-formed XML) payload that existed before the FTPGateway is not replaced after the FTPGatewy. To do this just set the xbd.target.contentID property on the FTPGateway.
Read the section on “processing multipart messages” in the XML Mediator documentation.

regards,
- arp

hi arp,
first of all thank you for the hint regarding the multi-part message. after doing some testing with this type of setup i am just wondering if i can read only xml documents using the ftp gateway. my problem is to read a typical csv file into a sequence. checking all the possible properties i found nothing close to
an inbound transformation or a basic wrapping with just a root element.

do you have any idea about this?
regards
MichaelK

Hi Michael;

Just to be clear, FTPGateway will allow you to retrieve any type of content, not just XML.

The issue you raise is how to process the non-XML (in this specific case, CSV) in Mediator.

Mediator itself must have well-formed XML as the current message part in the payload. This is why when you retrieve/create non-XML using any Mediator component you must make sure to direct the result to another message part.

If you need not only to get your CSV file but actually process it, you will need to use the JavaObjectGateway to pass the CSV to a custom Java Class that knows how to handle your CSV. This java class can for example turn your CSV into well-formed XML, and then you can use other mediator components (emergers, transforms etc…) to further process the data.

regards,
- arp

Hi Michael, Arp:

Testing for well-formed XML in Mediator payload is based on the content-type. If it specifies an XML type, the content is validated as XML. If not, no validation is done.

The content-type of the response defaults to the content-type of the payload before the FTPGateway call. It can be changed by specifying the xbd.ftp.content.type property. Or as Arp said, you can direct the response to another message part with xbd.target.contentType and xbd.target.contentID.

Hope this helps.

Best regards,
Mike

hi Arp, hi Mike,

i have set the properties as recommended.
meaning: …target.contentID
…target.contentType to text
but now i am getting the following error from the log:
com.softwareag.xbridge.exceptions.XException: Payload.setContentType: javax.mail.internet.ParseException
question:
what type of content definition is possible and can be set?
what type of content defintion shall be set for the following file content:
xxxxxxxm ‘new line’
dfdfdfd ‘new line’

documentation unfortunately is a little bit short on this topic.

regards
Michaelk

[This message was edited by Rolf Bahlke on 22 Jul 2004 at 15:14.]

Hi Michael,

Content types are defined by internet standards (RFC2045) and of the form “x/y” where x is the primary type and y is the sub-type. A common value for simple text files is “text/plain”.

Mediator treats “text/xml”, “application/xml”, and any type of the form “x/y+xml” as xml content. All others are not validated.

Best regards,
Mike

Thanks for the correction Mike - I was under the impression that if you put XML into a component you either have to get XML out of the component or redirect the output of the component to another/new message part.

I just tried a simple scenario with the following sequence and stylesheet:

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


<step component=“SagTransformer”
xbd.target.contentType=“text/plain”
xbd.transformer.pattern=“Trax” xbd.transformer.stylesheets=“http://localhost:8080/demo/stylesheets/test.xsl”/>



<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=“XSLT Namespace” version=“1.0”>
<xsl:output method=“text” omit-xml-declaration=“yes”/>
<xsl:template match=“/”>
this is a text transform
</xsl:template>
</xsl:stylesheet>

Now this works as you mention, however something is adding an XML prolog such that the response to the client looks like (including the newline between prolog and text):

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

this is a text transform

Now I tried another sequence using an FTP gateway:

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


<step component=“SagFtpGateway”
xbd.ftp.commands=“ascii;get test.txt”
xbd.ftp.error.continue=“no”
xbd.ftp.host.name=“localhost”
xbd.ftp.host.port=“21”
xbd.ftp.password="a@a.net"
xbd.ftp.user=“anonymous”
xbd.target.contentType=“text/plain”/>



and this worked as expected i.e. without an XML prolog added to the text.

best regards,
- arp



Tsk tsk tsk…
Validated? Surely you mean “tested for well-formedness”?

Hi Arp,

The stylesheet problem you mention is known. It appears to be an issue with the way Xalan converts from its internal to external form. We are looking into it.

Best regards,
Mike

Hi Arp,

You are correct. My answer was not quite “well formed”.

However, if the payload includes a DTD or schema reference, it will be “validated” against that reference.

Best regards,
Mike