typedef sequence byteArray;
interface XMLReceiver {
void documentReady(in byteArray serializedDocument)
raises(RemoteReceiverException);
};
以下代码用JAVA串行化DOM和CORBA实现发送者。
public void documentReady(DOMEvent evt) throws XbeansException {
Document documentToSend = evt.getDocument();
try {
ByteArrayOutputStream bastream = new ByteArrayOutputStream();
ObjectOutputStream p = new ObjectOutputStream(bastream);
p.writeObject(documentToSend);
p.flush();
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( new String[0],
System.getProperties());
XMLReceiver receiver = urlToObject(orb,getReceiverURL());
receiver.documentReady(bastream.toByteArray());
} catch (RemoteReceiverException rre) {
throw new XbeansException(rre.remoteIdentifier, rre.documentName,
rre.componentName, rre.message,rre.moreMessage);
} catch (Throwable e) {
文章来源于领测软件测试网 https://www.ltesting.net/