Skip to content

Commit

Permalink
Some code simplifications.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/axis/axis2/java/sandesha/trunk@1435838 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
veithen committed Jan 20, 2013
1 parent cdcd583 commit ceb2214
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.apache.sandesha2.util.FaultManager;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.RMMsgCreator;
import org.apache.sandesha2.util.SOAPAbstractFactory;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.util.SpecSpecificConstants;
import org.apache.sandesha2.util.WSRMMessageSender;
Expand Down Expand Up @@ -163,7 +162,7 @@ public boolean processAckRequestedHeader(RMMsgContext rmMsgCtx, OMElement soapHe
ackMsgCtx.setMessageID(SandeshaUtil.getUUID());

//adding the SOAP Envelope
SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgContext.getEnvelope()));
SOAPFactory factory = (SOAPFactory)msgContext.getEnvelope().getOMFactory();
SOAPEnvelope envelope = factory.getDefaultEnvelope();
try {
ackMsgCtx.setEnvelope(envelope);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.apache.sandesha2.util.FaultManager;
import org.apache.sandesha2.util.LoggingControl;
import org.apache.sandesha2.util.MsgInitializer;
import org.apache.sandesha2.util.SOAPAbstractFactory;
import org.apache.sandesha2.util.SandeshaUtil;
import org.apache.sandesha2.util.SpecSpecificConstants;
import org.apache.sandesha2.workers.SandeshaThread;
Expand Down Expand Up @@ -369,15 +368,7 @@ public static void replyToPoll(RMMsgContext pollMessage,
private static void addMessagePendingHeader(MessageContext returnMessage, String namespace) {
MessagePending messagePending = new MessagePending();
messagePending.setPending(true);
if (returnMessage.getEnvelope().getHeader() == null) {
int SOAPVersion = Sandesha2Constants.SOAPVersion.v1_1;
if (!returnMessage.isSOAP11())
SOAPVersion = Sandesha2Constants.SOAPVersion.v1_2;
//The header might not be there because of the persistence code if it doesn't exist we need to add one
SOAPAbstractFactory.getSOAPFactory(
SOAPVersion).createSOAPHeader(returnMessage.getEnvelope());
}
messagePending.toHeader(returnMessage.getEnvelope().getHeader());
messagePending.toHeader(returnMessage.getEnvelope().getOrCreateHeader());
}

public boolean processOutMessage(RMMsgContext rmMsgCtx, Transaction transaction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public static RMMsgContext generateAckMessage(

ackMsgCtx.setMessageID(SandeshaUtil.getUUID());

SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(referenceMsg.getEnvelope()));
SOAPFactory factory = (SOAPFactory)referenceMsg.getEnvelope().getOMFactory();

// Setting new envelope
SOAPEnvelope envelope = factory.getDefaultEnvelope();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ private static RMMsgContext createResponseMsg(RMMsgContext requestMsg, RMSequenc
MessageContext outMessage = MessageContextBuilder.createOutMessageContext (requestMsg.getMessageContext());
RMMsgContext responseRMMsg = new RMMsgContext(outMessage);

SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(requestMsg.getSOAPEnvelope()));
SOAPFactory factory = (SOAPFactory)requestMsg.getSOAPEnvelope().getOMFactory();

String namespace = requestMsg.getRMNamespaceValue();
responseRMMsg.setRMNamespaceValue(namespace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ private static void doSOAP11Encoding(MessageContext faultMsgContext,
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.soapEnvNotSet));

SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
.getSOAPVersion(faultMsgEnvelope));
SOAPFactory factory = (SOAPFactory)faultMsgEnvelope.getOMFactory();

SOAPFault fault = faultMsgEnvelope.getBody().getFault();

Expand Down Expand Up @@ -182,8 +181,7 @@ private static void doSOAP12Encoding(MessageContext faultMsgContext,
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.soapEnvNotSet));

SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil
.getSOAPVersion(faultEnvelope));
SOAPFactory factory = (SOAPFactory)faultEnvelope.getOMFactory();

SOAPFault fault = faultEnvelope.getBody().getFault();
if (fault == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,7 @@ public static MessageContext createNewRelatedMessageContext(RMMsgContext referen
operationContext.addMessageContext(newMessageContext);

// adding a blank envelope
SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(referenceMessage
.getEnvelope()));
SOAPFactory factory = (SOAPFactory)referenceMessage.getEnvelope().getOMFactory();
newMessageContext.setEnvelope(factory.getDefaultEnvelope());

newMessageContext.setTransportIn(referenceMessage.getTransportIn());
Expand Down

0 comments on commit ceb2214

Please sign in to comment.