下一節說明設計新的通訊協定處理常式或修改現有的通訊協定處理常式時,所使用的「通訊協定處理常式組織架構」方法。
getContent() 方法用於商業物件處理。它執行下列動作:
public abstract Object getContent (Object input, String mimeType, String BOprefix) throws IOException
傳回商業物件介面
下列程式碼範例說明如何呼叫 WebSphere Business Integration Adapter 提供的通訊協定處理常式。
try { // 設定系統內容,以便 Java 知道到何處尋找 // 通訊協定處理常式。您僅需要執行一次即可。 Properties prop = System.getProperties(); prop.put("java.protocol.handler.pkgs", "com.crossworlds.connectors.utils.ProtocolHandlers"); URL url = new URL(『http://www.crossworlds.com』); CWURLConnection uc = (CWURLConnection) url.openConnection(); BusinessObjectInterface respBO = (BusinessObjectInterface) uc.getContent (input, mime, prefix); } catch (Exception XX) { //旗標錯誤 }