Element[] children = XmlUtils.getAllElements(request, WsrpConstants.NAMESPACE_URI);
if (children.length == 0)
throw new InvalidMessageFormatFault(_MESSAGES.get("EmptySetRequest"));
SetRequest set = new SimpleSetRequest();
//
// build the different types of sets from XML. don't bother with a
// table, we only have three command types
//
for (int n = 0; n < children.length; ++n)
{
String type = children[n].getLocalName();
SetRequestComponent operation = null;
if (type.equals(DeleteRequest.OPERATION))
operation = new DeleteRequest(children[n]);
else if (type.equals(InsertRequest.OPERATION))
operation = new InsertRequest(children[n]);
else if (type.equals(UpdateRequest.OPERATION))
operation = new UpdateRequest(children[n]);
else
{
Object[] filler = { type };
throw new InvalidMessageFormatFault(_MESSAGES.get("InvalidSet", filler));
}
set.addRequestComponent(operation);
}
return set;
}