FIM-Logo Protocols and ebXML POND Logo

 

Protocols

As conversations in the agent system are sometimes a bit cumbersome to handle, an extension was created: Hierarchical protocols. These protocols are like finite state machines, whcih can be hierarchically structured, i. e. a protocol can call another protocol as a sub-protocol, which will then be performed, till it terminates. After the end of the sub-protocol, the parent protocol resumes execution. Dependent on the state of the sub-protocol after termination, the state of the parent protocol can be adjusted.

This allows sturcturing protocols not only statically (through object-oriented implementation and subclassing), but also dynamically: Subprotocols can be selected and replaced at runtime, e. g. according to the capabilities of the communications partner.

<IMAGE TO COME>

Exemplary code fragments:

Part of the initiator:

switch(state.curState)
{
	case 0:
		if(inquiry==null)
		{
			// Error: We need an inquiry!
			state.curState=17;
			endProtocol();
		}
		else
		{
			state.curState=1;
			startSubProtocol(new ContactProtocol(getAgent(),
				getCounterpartIdentity(),true),null);
		}
	break;
	case 1:
                    sendInquiry();
	break;
	case 2:
		if(msg instanceof AnswerMessage)
		{
			receiveAnswer((AnswerMessage)msg);
		}
		else if(msg instanceof RejectMessage)
		{
			receiveRejection((RejectMessage)msg);
		}
		else
			return null;
	break;
	default:
		endProtocol();
	break;
}

Part of the respondent:

switch(state.curState)
{
	case 0:
		state.curState=1;
		startSubProtocol(new ContactProtocol(getAgent(),
				getCounterpartIdentity(),false),msg);
	break;
	case 1:
		state.curState=2;
	break;
	case 2:
		if(msg instanceof InquiryMessage)
			answerInquiry((InquiryMessage)msg);
		else
			return null;
	break;
	default:
		endProtocol();
	break;
}

State correction after end of sub-protocol:

public void adjustStateAfterSubprotocolTerminated(Protocol subprotocol)
{
	// State 2 in ContactProtocol is a success, all others are 
	// failures / errors
	if(subprotocol.getState().curState!=2)
	{
		state.curState=18;
		endProtocol();
	}
}

ebXML / XML

For unified access, messaging according to the emerging ebXML standard was implemented. This allows easy integration of legacy or other software into the system, just by providing the message as a string to the system, which will then dispatch it to the destination agent. This could also be used to implement remote messaging (currently only local messages and broadcasts possible): Messages can be sent much more easily as text than a binary stream, and are then readbale to humans too.

Example message:

Content-Type: multipart/related; type="application/vnd.eb+xml"; boundary="----=_
Part_1_3808966.1000458420920"
Content-Length: 1559

------=_Part_1_3808966.1000458420920
Content-Type: application/vnd.eb+xml; version=1.0
Content-ID: 45ddc9:e8eff78724:-7ff7
Content-Length: 1082

<?xml version="1.0" encoding="UTF8"?>
<!DOCTYPE ebXMLHeader SYSTEM "file:/ebXMLHeader.dtd">
<ebXMLHeader xmlns="http://www.ebxml.org/namespaces/messageHeader" Version="1.0"
MessageType="Normal">
<Manifest>
<DocumentReference>
<DocumentLabel>
Protocol.Inquiry.RejectMessage
</DocumentLabel>
<DocumentId>
45ddc9:e8eff78724:-7ff8
</DocumentId>
<DocumentDescription>
Transmits a semantic error message (e. g. invalid payment)
</DocumentDescription>
</DocumentReference>
</Manifest>
<Header>
<From>
<PartyId context="URI">
1
</PartyId>
</From>
<To>
<PartyId context="URI">
2
</PartyId>
</To>
<TPAInfo>
<TPAId context="DEFAULT">
1001
</TPAId>
<ConversationId context="DEFAULT">
1-2
</ConversationId>
<ServiceInterface>
DEFAULT
</ServiceInterface>
<Action>
FromInitiator
</Action>
</TPAInfo>
<MessageData>
<MessageId>
45ddc9:e8eff78724:-8000
</MessageId>
<TimeStamp>
20010914T110700.209Z
</TimeStamp>
<RefToMessageId>

</RefToMessageId>
</MessageData>
<ReliableMessagingInfo DeliverySemantics="OnceAndOnlyOnce"/>
</Header>
</ebXMLHeader>

------=_Part_1_3808966.1000458420920
Content-Type: application/xml
Content-ID: 45ddc9:e8eff78724:-7ff8
Content-Length: 154

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE RejectMessage SYSTEM "file:/RejectMessage.dtd">
<RejectMessage><Cause>Any cause</Cause></RejectMessage>
------=_Part_1_3808966.1000458420920--

Downloads

Protocol package and DTD's for the messages

 

FIM Homepage POND page Top of page [Back to FIM-Homepage] [Back to POND page] [Top of page]

Mail sonntag@fim.uni-linz.ac.at

Last modified: 14 September, 2001 , by MVS