B2B Integration : Trading Networks Administrator's Guide : Creating Flat File Document Types : Creating a Document Gateway Service : Reading the Input Stream
Reading the Input Stream
If the document gateway service is a Java service, use the methods of the java.io.InputStream class to read bytes from the input stream contained in ffdata. See your Java documentation for descriptions of these methods.
Important:  
Remember to use InputStream's mark and reset methods so that Trading Networks will be able to read from the beginning of the stream. If InputStream does not support marking, make sure you transform InputStream to support marking. Otherwise, Trading Networks will lose the bytes read by the gateway service when it tries to save the document content to the BizDocEnvelope.
If the document gateway service is a flow service, use the services in the pub.io folder in the Integration Server WmPublic package. The WmPublic package must be enabled.
You can parse the input stream and convert it into an IS document from which you can map data to the TN_parms pipeline variable. In the document gateway service, invoke the pub.flatfile:convertToValues service in the WmFlatFile package. This service invokes the flat file parser to validate the document's structure and content, based on the flat file schema you identify as input to the service. Trading Networks can save or throw away the parsed contents. For information about the pub.flatfile:convertToValues service, see the Flat File Schema Developer’s Guide. Alternatively, you can convert the document using the Validate Structure pre-processing action. Do not convert a document in both the document gateway service and using the Validate Structure action. If you convert a document in the gateway service, it will remain in the pipeline.
Note:  
Parse the document only if absolutely necessary. Parsing can be time-consuming and return very large outputs that consume much memory.
Copyright © 2016- 2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback