Application Integration (On-Premises) : Processing Flat Files : Sending and Receiving Flat Files : Submitting a Flat File to Integration Server in a String Variable
Submitting a Flat File to Integration Server in a String Variable
One way to submit a flat file to the Integration Server is to pass the entire document to a service in a String variable. This approach does not use the flat file content handler, so the restrictions outlined in the previous section do not apply. Instead, the invoked service must expect the contents of the flat file to be in a specific pipeline variable. The Java client must place the source file in the pipeline as a String. The invoked service then processes the input data and can place parameters in the pipeline that will be returned to the Java client as determined by the specific scenario.
When you use this approach, you should code the target service to execute pub.flatFile:convertToValues to convert the String variable (i.e., the flat file) to an IS document (IData object). For more information about using convertToValues, see webMethods Integration Server Built-In Services Reference.
The following code fragment illustrates how a Java client might submit a flat file to the purch:postOrder service on the Integration Server. In this example, the client 1) loads the flat file into a String, 2) puts the String into the element orders in an IS document (IData object) named “inputs,” and 3) invokes purch:postOrder on the server at localhost:5555.
import com.wm.app.b2b.client.*;
import com.wm.util.*;
import com.wm.data.*;
import java.io.*;
public class ArbitraryFlatFileClient
.
.
//—Load FF into orders string
String orders = YourLoadFlatFileMethod(orderFile);
//—Put input values into IData object
IData inputs = IDataFactory.create();
IDataCursor inputsCursor = inputs.getcursor();
inputsCursor.last();
inputsCursor.insertAfter("orders", orders);
inputsCursor.insertAfter("authCode", authCode);
//—Submit request to server
c.connect("localhost:5555", "null", null);
IData outputs = c.invoke("purch", "postOrder", inputs);
c.disconnect();
if (inputsCursor.first("response"))
{
//...process response
}
The Integration Server invokes postOrder to pass the flat file to convertToValues. This will produce an “orders” string that can be mapped to the ffdata input variable in the convertToValues service. As discussed in Processing Flat Files Overview, this service will produce an IS document (IData object).
Copyright © 2015- 2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback