public static int getLastSequenceID(SOAPHeader soapHeader) { Iterator headers = soapHeader.getHeadersToProcess(null, "http://www.w3.org/2005/08/addressing"); int seqId = -1; int lastSeqId = -1; boolean isReset = false; SOAPHeaderBlock referenceParametersHeaderBlock = null; while (headers.hasNext()) { SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) headers.next(); String localName = soapHeaderBlock.getLocalName(); if (localName.equals("SequenceID")) { try { seqId = Integer.parseInt(soapHeaderBlock.getText()); } catch (NumberFormatException e) { // if the client didn't send a SeqID, then there's nothing we can do return -1; } return seqId; } } return -1; }