Cosminexus ビジネスプロセス管理/エンタープライズサービスバス V8 サービスプラットフォーム 開発ガイド
ここでは,カスタム受付フレームワークが提供するAPIについて説明します。
受付処理が,カスタム受付フレームワークのAPIを呼び出す順序を次の図に示します。
図G-3 カスタム受付フレームワークのAPIの呼び出し順序
CSCMsgCustomServiceDeliveryFactoryクラスは,CSCMsgCustomServiceDeliveryFactoryオブジェクトの生成,CSCMsgCustomServiceDeliveryオブジェクトの生成などの機能を提供するファクトリクラスです。
package jp.co.Hitachi.soft.csc.msg.message.reception.custom;
public abstract class CSCMsgCustomServiceDeliveryFactory {
public static CSCMsgCustomServiceDeliveryFactory newInstance();
public CSCMsgCustomServiceDelivery createCSCMsgCustomServiceDelivery();
}
CSCMsgCustomServiceDeliveryFactoryクラスのメソッドを次の表に示します。
| メソッド名 | 機能 |
|---|---|
| newInstanceメソッド | CSCMsgCustomServiceDeliveryFactoryオブジェクトを生成します。 |
| createCSCMsgCustomServiceDeliveryメソッド | CSCMsgCustomServiceDeliveryオブジェクトを生成します。 |
public static CSCMsgCustomServiceDeliveryFactory newInstance();
public CSCMsgCustomServiceDelivery createCSCMsgCustomServiceDelivery();
カスタム受付の受付処理が,カスタム受付フレームワークと電文の受け渡しをするためのメソッドを提供します。また,開発環境で登録したカスタム受付ユーザファイルを取得するメソッドを提供します。
package jp.co.Hitachi.soft.csc.msg.message.reception.custom;
public interface CSCMsgCustomServiceDelivery {
public String invokeXML(String cscCorrelationID, String cscServiceOperationName,
String msg) throws CSCMsgServerException;
public String invokeXML(String cscCorrelationID, String msg)
throws CSCMsgServerException;
public byte[] invokeBinary(String cscCorrelationID, String cscServiceOperationName,
int requestMessageLength, byte[] msg) throws CSCMsgServerException;
public byte[] invokeBinary(String cscCorrelationID, int requestMessageLength,
byte[] msg) throws CSCMsgServerException;
public InputStream getUserFile(String fileName);
}
CSCMsgCustomServiceDeliveryインターフェースのメソッドを次の表に示します。
| メソッド名 | 機能 |
|---|---|
| invokeXMLメソッド(形式1) | 指定されたオペレーション名のサービスに対してXML電文のメッセージを送信し,その応答を返します。 |
| invokeXMLメソッド(形式2)※1 | デフォルトのオペレーション名のサービスに対してXML電文のメッセージを送信し,その応答を返します。 |
| invokeBinaryメソッド(形式1) | 指定されたオペレーション名のサービスに対してバイナリ電文のメッセージを送信し,その応答を返します。 |
| invokeBinaryメソッド(形式2)※2 | デフォルトのオペレーション名のサービスに対してバイナリ電文のメッセージを送信し,その応答を返します。 |
| getUserFileメソッド | 開発環境で登録したカスタム受付ユーザファイルのInputStreamを返します。 |
public String invokeXML(String cscCorrelationID,
String cscServiceOperationName, String msg)
throws CSCMsgServerException;
public String invokeXML(String cscCorrelationID, String msg)
throws CSCMsgServerException;
public byte[] invokeBinary(String cscCorrelationID,
String cscServiceOperationName, int requestMessageLength, byte[] msg)
throws CSCMsgServerException;
public byte[] invokeBinary(String cscCorrelationID,
int requestMessageLength, byte[] msg)
throws CSCMsgServerException;
public InputStream getUserFile(String fileName);
カスタム受付フレームワークのAPIを利用して,受付処理をEJB(Stateless Session Bean)形式で実装する場合の実装例を次に示します。
package com.example.sample.reception.ejb;
import javax.ejb.EJBObject;
/**
* 受付処理(Stateless Session Bean)の実装例(Remoteインターフェース)
*/
public interface MyReception extends EJBObject {
public String invoke(String cscCorrelationID, String cscServiceOperationName, String msg) throws RemoteException;
}
|
package com.example.sample.reception.ejb;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
/**
* 受付処理(Stateless Session Bean)の実装例(Homeインターフェース)
*/
public interface MyReceptionHome extends EJBHome {
public MyReception create() throws RemoteException, CreateException;
}
|
package com.example.sample.reception.ejb;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import jp.co.Hitachi.soft.csc.msg.message.reception.CSCMsgServerException;
import jp.co.Hitachi.soft.csc.msg.message.reception.custom.CSCMsgCustomServiceDelivery;
import jp.co.Hitachi.soft.csc.msg.message.reception.custom.CSCMsgCustomServiceDeliveryFactory;
/**
* 受付処理(Stateless Session Bean)の実装例(Beanクラス)
*/
public class MyReceptionBean implements SessionBean {
private static final CSCMsgCustomServiceDeliveryFactory factory =
CSCMsgCustomServiceDeliveryFactory.newInstance();
private CSCMsgCustomServiceDelivery delivery;
private SessionContext context;
public MyReceptionBean() {
}
public void ejbActivate() throws EJBException, RemoteException {
}
public void ejbCreate() throws CreateException {
// CSCMsgCustomServiceDeliveryオブジェクトを生成
delivery = factory.createCSCMsgCustomServiceDelivery();
}
public void ejbPassivate() throws EJBException, RemoteException {
}
public void ejbRemove() throws EJBException, RemoteException {
// CSCMsgCustomServiceDeliveryオブジェクトを破棄
delivery = null;
}
public String invoke(final String cscCorrelationID, final String cscServiceOperationName, final String msg) {
try {
// カスタム受付フレームワークを呼び出す
final String response = delivery.invokeXML(cscCorrelationID, cscServiceOperationName, msg);
return response;
} catch (CSCMsgServerException e) {
// カスタム受付フレームワークの例外をキャッチ
// 例外処理を実装すること
}
}
public void setSessionContext(final SessionContext sc) throws EJBException {
context = sc;
}
}
|
All Rights Reserved. Copyright (C) 2008, 2011, Hitachi, Ltd.