1 17 18 package org.apache.sandesha.ws.rm; 19 20 import org.apache.axis.message.MessageElement; 21 import org.apache.sandesha.Constants; 22 23 import javax.xml.soap.SOAPException ; 24 import java.util.Iterator ; 25 26 33 public class Accept extends MessageElement implements IRmElement { 34 35 38 private MessageElement acceptElement; 39 40 private AcksTo acksTo; 41 42 45 public Accept() { 46 acceptElement = new MessageElement(); 47 acceptElement.setName(Constants.WSRM.NS_PREFIX_RM + Constants.COLON + Constants.WSRM.ACCEPT); 48 } 49 50 55 56 61 public MessageElement getSoapElement() throws SOAPException { 62 acceptElement.addChildElement(acksTo.getSoapElement()); 63 return acceptElement; 64 } 65 66 public Accept fromSOAPEnvelope(MessageElement bodyElement) throws SOAPException { 67 68 Iterator iterator = bodyElement.getChildElements(); 69 MessageElement childElement; 70 71 while (iterator.hasNext()) { 72 childElement = (MessageElement) iterator.next(); 73 74 if (childElement.getName().equals(Constants.WSRM.NS_PREFIX_RM + Constants.COLON + Constants.WSRM.ACKS_TO)) { 75 acksTo = new AcksTo(); 76 acksTo.fromSOAPEnvelope(childElement); 77 } 78 79 if (childElement.getName().equals(Constants.WSRM.ACKS_TO)) { 80 acksTo = new AcksTo(); 81 acksTo.fromSOAPEnvelope(childElement); 82 } 83 84 } 85 86 return this; 87 } 88 89 96 public MessageElement toSOAPEnvelope(MessageElement msgElement) throws SOAPException { 97 MessageElement messageElement = new MessageElement("", Constants.WSRM.NS_PREFIX_RM, Constants.WSRM.NS_URI_RM); 98 messageElement.setName(Constants.WSRM.ACCEPT); 99 acksTo.toSOAPEnvelope(messageElement); 100 msgElement.addChildElement(messageElement); 101 return msgElement; 102 } 103 104 105 public void addChildElement(MessageElement element) { 106 107 } 108 109 114 public MessageElement getAcceptElement() { 115 return acceptElement; 116 } 117 118 123 public void setAcceptElement(MessageElement element) { 124 acceptElement = element; 125 } 126 127 public void setAcksTo(AcksTo acksTo) { 128 this.acksTo = acksTo; 129 } 130 131 public AcksTo getAcksTo() { 132 return this.acksTo; 133 } 134 135 136 } | Popular Tags |