TN ascii file output

Hi,

How can I export the XML data from TN to a ascii file?

Thanks,

Thierry

Hi Thierry

You could use a B2B flow service to do this.
In this service use pub.flow:savePipelineToFile to save the complete pipeline to an ascii-XML file in directory <B2BServer4/pipeline.
Or save part of the pipeline by creating a node/record for the part you want to save. Then use pub.web:recordToDocument, pub.string:stringToBytes to create a content-object.
You then may use pub.client:ftp to send the string as a file to a location. You also could write a java-service to create a file from the content.
This Java code might be good for you:

Best regards
Huub

// Get the file path from the pipeline.
IDataHashCursor pipc = pipeline.getHashCursor();
pipc.first(“filePath”);
String filePath = (String) pipc.getValue();

// Get the contents of the file from the pipeline and write it to an object.
pipc.first(“fileContent”);
java.lang.Object fileContent = (java.lang.Object) pipc.getValue();

// Write the object to the file path.
try
{

FileOutputStream f = new FileOutputStream(filePath); 

f.write((byte[])(fileContent));

f.close();

}
catch (Exception e)
{
pipc.last();
pipc.insertAfter(“errormessage”, e.toString());;
}

Thanks for your help.
When I enter the code and compile it I get this message:

C:\Program Files\webMethods\IntegrationServer4\packages\DEMO\code\source\SpaceShipShop.java:47: cannot resolve symbol
symbol : class FileOutputStream
location: class SpaceShipShop
FileOutputStream f = new FileOutputStream(filePath);
^
C:\Program Files\webMethods\IntegrationServer4\packages\DEMO\code\source\SpaceShipShop.java:47: cannot resolve symbol
symbol : class FileOutputStream
location: class SpaceShipShop
FileOutputStream f = new FileOutputStream(filePath);
^
Note: C:\Program Files\webMethods\IntegrationServer4\packages\DEMO\code\source\SpaceShipShop.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
2 errors

Please advice,

Thank you,

Thierry van Mourik

Never mind that… my mistake.
I forgot to put the Shared Java services.

thanx again