首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在j8583中生成ISO消息

如何在j8583中生成ISO消息
EN

Stack Overflow用户
提问于 2016-10-20 06:57:51
回答 1查看 10.3K关注 0票数 1

我有文字资料,

代码语言:javascript
复制
PROCESSINGCODE: 000000
SYSTEMTRACEAUDITNUMBER: 000001
Cardacceptorterminalidentification:3239313130303031
Reservednational:001054455354204D45535347
Networkmanagementinformationcode:0301

我需要使用j8583项目生成带有位图字段的ISO消息。

我尝试过解析一个等价物,但我不知道如何生成ISO消息。

注意:我知道这可以用jpos来完成,但是我需要用j8583.来完成。

我创建了下面的程序。

代码语言:javascript
复制
public static void main(String[] args) {


MessageFactory<IsoMessage> mf = new MessageFactory<IsoMessage>();
    try {
        //mfact = ConfigParser.createFromClasspathConfig("C:\\Users\\DHEERAJ\\workspace\\j8583.xml");

        String path="C:\\Users\\DHEERAJ\\workspace\\j8583.xml";
        ConfigParser.configureFromUrl(mf, new File(path).toURI().toURL());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }  
        mf.setForceSecondaryBitmap(true);
        mf.setUseBinaryBitmap(true);
        mf.setAssignDate(true);  
        mf.setTraceNumberGenerator(new SimpleTraceGenerator((int)  (System.currentTimeMillis() % 100000)));  
        System.out.println("NEW MESSAGE");  
        IsoMessage m = mf.newMessage(0200); 

       m.setValue(3, "000000", IsoType.ALPHA, 6);  
       m.setValue(11, "000001", IsoType.ALPHA, 6);  
        m.setValue(41, "3239313130303031", IsoType.ALPHA, 16);  
        m.setValue(60, "001054455354204D45535347", IsoType.ALPHA, 24);  
           m.setValue(70, "0301", IsoType.ALPHA, 4);

           m.setForceSecondaryBitmap(true);

}

我的输出低于.

V 0080欧元00000010201245030000013239313130303031001054455354204D455353470301

这个输出没有位图值,并且在开始时有一些不需要的值。

有人能帮忙吗?

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-24 03:17:39

下面的Java代码打印0200A220000000800010040000000000000000000010240507450000013239313130303031001054455354204D455353470301,在其中您可以看到位图信息。

代码语言:javascript
复制
import com.solab.iso8583.MessageFactory;
import com.solab.iso8583.IsoMessage;
import com.solab.iso8583.IsoType;
import com.solab.iso8583.parse.ConfigParser;
import com.solab.iso8583.impl.SimpleTraceGenerator;
import java.io.File;
import java.io.IOException;

class Sample {
    public static void main(String[] args) {
        // Check http://j8583.sourceforge.net/javadoc/index.html

        MessageFactory<IsoMessage> mf = new MessageFactory<IsoMessage>();

        try {
            String path="j8583.xml";
            ConfigParser.configureFromUrl(mf, new File(path).toURI().toURL());
        } catch (IOException e) {
            e.printStackTrace();
        }

        mf.setForceSecondaryBitmap(true);
        mf.setUseBinaryBitmap(true);
        mf.setAssignDate(true); // This sets field 7 automatically
        mf.setTraceNumberGenerator(new SimpleTraceGenerator((int)  (System.currentTimeMillis() % 100000)));

        IsoMessage m = mf.newMessage(0x200); // You must use 0x200, 0x400, etc.
        m.setValue(3, "000000", IsoType.ALPHA, 6);
        m.setValue(11, "000001", IsoType.ALPHA, 6);
        m.setValue(41, "3239313130303031", IsoType.ALPHA, 16);
        m.setValue(60, "001054455354204D45535347", IsoType.ALPHA, 24);
        m.setValue(70, "0301", IsoType.ALPHA, 4);
        m.setForceSecondaryBitmap(true);

        System.out.println(m.debugString());
    }
}
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40147480

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档