Neuronworks Blog, WebMethods, Oracle, Bea, Java Dev2Dev, Arch2Arch Neuronworks Make IT Easy, Let's Play the Game » Call webMethods Flow Service with Java
Home > webMethods > Call webMethods Flow Service with Java

 

Call webMethods Flow Service with Java

December 29th, 2008

Berikut adalah contoh pemanggilan FLow Service di webMethods dari java. Asumsi dari environment yang digunakan adalah sebagai berikut :
Service yang dipanggil memiliki input nomor telepon dan output min dan iccid

berikut code :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package webmethods;
 
import com.wm.app.b2b.client.*;
import com.wm.data.IData;
import com.wm.data.IDataFactory;
import com.wm.data.IDataCursor;
import com.wm.data.IDataUtil;
 
/**
 *
 * @author gatotkaca
 */
public class Main {
 
    /** Creates a new instance of Main */
    public Main() {
         String server = "WMSERVER:WMPORT";
         String user = "WMUSER";
         String password = "WMPASSWORD";
         String mdn = "XXXXXXX";
         IData idata = IDataFactory.create();
         IDataCursor idc = idata.getCursor();
         IDataUtil.put(idc, "mdn", mdn);   
         idc.destroy();
 
 
    Context ctx = new Context();
        try {
            ctx.connect(server, user, password);
 
            idata = ctx.invoke("MDNQuery", "QueryMDN", idata);
            idc = idata.getCursor();
 
            String statusCode = IDataUtil.getString(idc,"statusCode");
            String fullStatusMsg = IDataUtil.getString(idc,"fullStatusMsg");
            String min = IDataUtil.getString(idc,"min");
            String iccid= IDataUtil.getString(idc,"iccid");
 
            System.out.println("Status Code = "+statusCode);
            System.out.println("fullStatusMsg = "+fullStatusMsg);
            System.out.println("MDN = "+mdn);
            System.out.println("MIN = "+min);
            System.out.println("ICCID = "+iccid);
 
 
 
        } catch (ServiceException ex) {
            ex.printStackTrace();
        }
 
 
       ctx.cleanUpConnection();
    }
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 
        Main m = new Main();
    }
 
}

package com.wm.* ada di client.jar dan bisa dicopy dari library di webMethods dan tempatkan di classpath dari program anda. silahkan mencoba komentar, saran sangat diharapkan.

webMethods ,

  1. No comments yet.
  1. No trackbacks yet.