SPBEncodeDecode.java
Exemplo de encode e decode de mensagem SPB.
- Veja Nota sobre os exemplos.
package doxy.examples;
import java.io.IOException;
public class SPBEncodeDecode {
private static String strAddr = "10.0.62.17";
private static String strUsrId = "tjava";
private static String strPwd = "12345678";
private static int nPort = 4433;
public static void main(String[] args) throws TacException {
int nFlags = 0;
String szSrcISPB = "11111111@SPR";
byte bSpecialTreatment = 0;
boolean bAcceptExpiredCert = false;
boolean bAutoUpdateCert = false;
StringBuilder sb = new StringBuilder();
for(int i=0; i<1;i++)
{
sb.append("abcdefghijklmnopqrstuvwxyz");
}
byte[] pbMsgIn = sb.toString().getBytes();
Dinamo api = new Dinamo();
try {
api.openSession(strAddr, strUsrId, strPwd, nPort, nFlags);
byte[] bout = api.SPBEncode(szSrcISPB, szSrcISPB, pbMsgIn, bSpecialTreatment);
byte[] bin2 = api.SPBDecode(szSrcISPB, szSrcISPB, bout, bAcceptExpiredCert, bAutoUpdateCert);
} catch (TacException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
api.closeSession();
}
}
}