Cloud Application Integration (On-Premises) : Service Development : Submitting and Receiving XML Documents : Submitting and Receiving XML in a String Variable : Sample Client Code to Submit an XML Document in a String Variable
Sample Client Code to Submit an XML Document in a String Variable
The following sample code fragment for a Java client illustrates how to submit an XML document in a String variable named orders to the target service, purch:postOrder, on Integration Server. This code fragment performs the following steps:
1. Loads the XML document into a String.
2. Puts the String into a variable named orders in an IData object named inputs.
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 ArbitraryXMLClient
.
.
.
//--Load XML into a String named orders
         String orders = YourLoadXMLMethod(orderFile);
 
//--Put input values into the IData object
IData inputs = IDataFactory.create();
IDataCursor inputsCursor = inputs.getCursor();
        inputsCursor.insertAfter("orders", orders);
inputsCursor.insertAfter("authcode", authcode);
 
//--Submit request to the server at localhost:5555
c.connect("localhost:5555", "null", null);
        IData outputs = c.invoke("purch", "postOrder", inputs);
c.disconnect();
.
.
.
Copyright © 2015- 2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback