You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ja...@apache.org on 2004/09/13 13:25:45 UTC
cvs commit: ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers RMClientRequestHandler.java RMClientResponseHandler.java RMHandler.java RMServerRequestHandler.java
jaliya 2004/09/13 04:25:45
Modified: sandesha/src/org/apache/sandesha/ws/rm/handlers
RMClientRequestHandler.java
RMClientResponseHandler.java RMHandler.java
RMServerRequestHandler.java
Log:
Formatted code
Revision Changes Path
1.10 +64 -61 ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMClientRequestHandler.java
Index: RMClientRequestHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMClientRequestHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- RMClientRequestHandler.java 7 May 2004 17:39:38 -0000 1.9
+++ RMClientRequestHandler.java 13 Sep 2004 11:25:45 -0000 1.10
@@ -17,75 +17,80 @@
package org.apache.sandesha.ws.rm.handlers;
-import org.apache.axis.AxisFault;
-import org.apache.axis.MessageContext;
-import org.apache.axis.client.Call;
-import org.apache.axis.message.SOAPEnvelope;
-import org.apache.sandesha.Constants;
-
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
+import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
+import org.apache.axis.client.Call;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.sandesha.Constants;
+
/**
- * @author
- * Amila Navarathna<br>
- * Jaliya Ekanayaka<br>
- * Sudar Nimalan<br>
- * (Apache Sandesha Project)
- *
+ * @author Amila Navarathna <br>
+ * Jaliya Ekanayaka <br>
+ * Sudar Nimalan <br>
+ * (Apache Sandesha Project)
+ *
*/
-
public class RMClientRequestHandler extends RMHandler {
-
+
/**
* Method invoke
*
- * @param messageContext
- * @throws AxisFault
+ * @param messageContext
+ * @throws AxisFault
* @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
*/
public void invoke(MessageContext messageContext) throws AxisFault {
//Get the options from the client-config.wsdd.
- //Client should specify the URL of the client host and the port number of the Tomcat sever
-
+ //Client should specify the URL of the client host and the port number
+ // of the Tomcat sever
+
String sourceURI = (String) getOption("sourceURI");
String action = (String) getOption("action");
String replyTo = (String) getOption("replyTo");
String isSynchronized = (String) getOption("synchronized");
- //Get the properties set by the client by accessing the call object using the message context.
+ //Get the properties set by the client by accessing the call object
+ // using the message context.
Call call = (Call) messageContext.getProperty(MessageContext.CALL);
-
- String sequenceID=null;// = call.getSequenceIdentifier();
- if(call.getProperty(Constants.CLIENT_SEQUENCE_IDENTIFIER)!=null){
- sequenceID=(String) call.getProperty(Constants.CLIENT_SEQUENCE_IDENTIFIER);
- }else{
- sequenceID="";
+
+ String sequenceID = null;// = call.getSequenceIdentifier();
+ if (call.getProperty(Constants.CLIENT_SEQUENCE_IDENTIFIER) != null) {
+ sequenceID = (String) call
+ .getProperty(Constants.CLIENT_SEQUENCE_IDENTIFIER);
+ } else {
+ sequenceID = "";
}
boolean isLastMessage = false;
-
+
boolean isResponseExpected = false;
-
if (call.getProperty(Constants.CLIENT_LAST_MESSAGE) != null) {
- isLastMessage=((Boolean) (call.getProperty(Constants.CLIENT_LAST_MESSAGE))).booleanValue();
+ isLastMessage = ((Boolean) (call
+ .getProperty(Constants.CLIENT_LAST_MESSAGE)))
+ .booleanValue();
}
-
+
if (call.getProperty(Constants.CLIENT_RESPONSE_EXPECTED) != null) {
- isResponseExpected=((Boolean) (call.getProperty(Constants.CLIENT_RESPONSE_EXPECTED))).booleanValue();
+ isResponseExpected = ((Boolean) (call
+ .getProperty(Constants.CLIENT_RESPONSE_EXPECTED)))
+ .booleanValue();
}
- //Get the SOAP envelope of the request message and send it as a string parameter to the
+ //Get the SOAP envelope of the request message and send it as a string
+ // parameter to the
//clientService
- SOAPEnvelope requestSOAPEnvelope =
- messageContext.getCurrentMessage().getSOAPEnvelope();
+ SOAPEnvelope requestSOAPEnvelope = messageContext.getCurrentMessage()
+ .getSOAPEnvelope();
requestSOAPEnvelope.setSchemaVersion(messageContext.getSchemaVersion());
requestSOAPEnvelope.setSoapConstants(messageContext.getSOAPConstants());
@@ -93,46 +98,43 @@
String strRequestSOAPEnvelope = requestSOAPEnvelope.toString();
//Get the destination URL from the message context.
- String destinationURL =
- (String) messageContext.getProperty(MessageContext.TRANS_URL);
+ String destinationURL = (String) messageContext
+ .getProperty(MessageContext.TRANS_URL);
- //Set the destination URL of the message context to the Client Endpoint Manager (Re-directing)
- String toClientServiceURL =
- sourceURI
+ //Set the destination URL of the message context to the Client Endpoint
+ // Manager (Re-directing)
+ String toClientServiceURL = sourceURI
+ org.apache.sandesha.Constants.AXIS_SERVICES
+ org.apache.sandesha.Constants.RM_CLIENT_SERVICE
+ org.apache.sandesha.Constants.QUESTION_WSDL;
- //Set the URL of the client side reference that can be used to send the asynchronous responses
+ //Set the URL of the client side reference that can be used to send the
+ // asynchronous responses
//by the services.
- String clientReferenceURL =
- sourceURI
+ String clientReferenceURL = sourceURI
+ org.apache.sandesha.Constants.AXIS_SERVICES
+ org.apache.sandesha.Constants.CLIENT_REFERENCE
+ org.apache.sandesha.Constants.QUESTION_WSDL;
- messageContext.setProperty(
- MessageContext.TRANS_URL,
- toClientServiceURL);
+ messageContext
+ .setProperty(MessageContext.TRANS_URL, toClientServiceURL);
try {
//to the envelploe with CALL String
- SOAPEnvelope soapEnvelope =
- messageContext.getCurrentMessage().getSOAPEnvelope();
+ SOAPEnvelope soapEnvelope = messageContext.getCurrentMessage()
+ .getSOAPEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
soapEnvelope.clearBody();
soapEnvelope.removeHeaders();
- Name name =
- soapEnvelope.createName(
- org.apache.sandesha.Constants.CLIENT_METHOD,
- "ns1",
+ Name name = soapEnvelope.createName(
+ org.apache.sandesha.Constants.CLIENT_METHOD, "ns1",
org.apache.sandesha.Constants.RM_CLIENT_SERVICE);
SOAPBodyElement soapBodyElement = soapBody.addBodyElement(name);
//Add the SOAP envelope as a string parameter.
- SOAPElement soapElement =
- soapBodyElement.addChildElement("arg1", "");
+ SOAPElement soapElement = soapBodyElement.addChildElement("arg1",
+ "");
soapElement.addTextNode(strRequestSOAPEnvelope);
//Add the sequenceIdnetifier
@@ -143,15 +145,15 @@
soapElement = soapBodyElement.addChildElement("arg3", "");
soapElement.addTextNode(destinationURL);
- //Add the toClientServiceURL. This can be used by the asynchronous server to reference the Client Service
+ //Add the toClientServiceURL. This can be used by the asynchronous
+ // server to reference the Client Service
soapElement = soapBodyElement.addChildElement("arg4", "");
soapElement.addTextNode(clientReferenceURL);
//Add the isOneWay as a string value.
soapElement = soapBodyElement.addChildElement("arg5", "");
soapElement.addTextNode(isSynchronized);
-
-
+
//Add the isLastMessage as a string value
soapElement = soapBodyElement.addChildElement("arg6", "");
if (isLastMessage == true) {
@@ -161,7 +163,7 @@
//Add the isCreateSequence as a string value
}
-
+
soapElement = soapBodyElement.addChildElement("arg7", "");
if (isResponseExpected == true) {
soapElement.addTextNode("true");
@@ -171,10 +173,11 @@
}
soapElement = soapBodyElement.addChildElement("arg8", "");
soapElement.addTextNode(action);
-
- String strReplyTo=replyTo+ org.apache.sandesha.Constants.AXIS_SERVICES
- + org.apache.sandesha.Constants.CLIENT_REFERENCE
- + org.apache.sandesha.Constants.QUESTION_WSDL;
+
+ String strReplyTo = replyTo
+ + org.apache.sandesha.Constants.AXIS_SERVICES
+ + org.apache.sandesha.Constants.CLIENT_REFERENCE
+ + org.apache.sandesha.Constants.QUESTION_WSDL;
soapElement = soapBodyElement.addChildElement("arg9", "");
soapElement.addTextNode(strReplyTo);
@@ -185,4 +188,4 @@
}
-}
+}
\ No newline at end of file
1.8 +34 -37 ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMClientResponseHandler.java
Index: RMClientResponseHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMClientResponseHandler.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RMClientResponseHandler.java 7 May 2004 15:18:21 -0000 1.7
+++ RMClientResponseHandler.java 13 Sep 2004 11:25:45 -0000 1.8
@@ -17,62 +17,61 @@
package org.apache.sandesha.ws.rm.handlers;
-import org.apache.axis.AxisFault;
-import org.apache.axis.Message;
-import org.apache.axis.MessageContext;
-import org.apache.axis.message.MessageElement;
-import org.apache.axis.message.SOAPEnvelope;
+import java.util.Iterator;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
-import java.util.Iterator;
+import org.apache.axis.AxisFault;
+import org.apache.axis.Message;
+import org.apache.axis.MessageContext;
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.SOAPEnvelope;
/**
- * @author
- * Amila Navarathna<br>
- * Jaliya Ekanayaka<br>
- * Sudar Nimalan<br>
- * (Apache Sandesha Project)
- *
+ * @author Amila Navarathna <br>
+ * Jaliya Ekanayaka <br>
+ * Sudar Nimalan <br>
+ * (Apache Sandesha Project)
+ *
*/
public class RMClientResponseHandler extends RMHandler {
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
*/
-
+
/**
* Method invoke
*
- * @param messageContext
- * @throws AxisFault
- */
-
+ * @param messageContext
+ * @throws AxisFault
+ */
+
public void invoke(MessageContext messageContext) throws AxisFault {
try {
-
- SOAPEnvelope soapEnvelope = messageContext.getResponseMessage().
- getSOAPEnvelope();
- SOAPBody soapBody = soapEnvelope.getBody();
-
+ SOAPEnvelope soapEnvelope = messageContext.getResponseMessage()
+ .getSOAPEnvelope();
+ SOAPBody soapBody = soapEnvelope.getBody();
if (soapBody.getValue() == null) {
-
+
} else {
-
+
Iterator iterator = soapBody.getChildElements();
SOAPBodyElement soapBodyElement;
while (iterator.hasNext()) {
soapBodyElement = (SOAPBodyElement) iterator.next();
-
+
if (soapBodyElement.getLocalName().equals(
"clientMethodResponse")) {
-
+
Iterator ite = soapBodyElement.getChildElements();
MessageElement sbe;
while (ite.hasNext()) {
@@ -81,18 +80,18 @@
if (sbe.getValue() != null) {
- messageContext.setCurrentMessage(new
- Message(sbe.getValue()));
-
+ messageContext
+ .setCurrentMessage(new Message(sbe
+ .getValue()));
}
}
}
}
}
-
- if (messageContext.getCurrentMessage().getSOAPEnvelope().
- getBody().getFault() != null) {
+
+ if (messageContext.getCurrentMessage().getSOAPEnvelope()
+ .getBody().getFault() != null) {
soapBodyElement = (SOAPBodyElement) iterator.next();
@@ -105,12 +104,10 @@
}
-
-
- }catch (SOAPException e) {
+ } catch (SOAPException e) {
throw AxisFault.makeFault(e);
}
}
-}
+}
\ No newline at end of file
1.7 +24 -23 ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMHandler.java
Index: RMHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RMHandler.java 7 May 2004 15:18:21 -0000 1.6
+++ RMHandler.java 13 Sep 2004 11:25:45 -0000 1.7
@@ -17,13 +17,13 @@
package org.apache.sandesha.ws.rm.handlers;
+import javax.xml.soap.SOAPException;
+
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.sandesha.ws.rm.RMHeaders;
-import javax.xml.soap.SOAPException;
-
/**
* class RMHandler
*
@@ -36,37 +36,38 @@
/**
* Method setPropertyToMessageContext
*
- * @param msgContext
- * @param property
- * @throws AxisFault
- * @throws SOAPException
+ * @param msgContext
+ * @param property
+ * @throws AxisFault
+ * @throws SOAPException
*/
- public void setPropertyToMessageContext(MessageContext msgContext, String property)
- throws AxisFault, SOAPException {
+ public void setPropertyToMessageContext(MessageContext msgContext,
+ String property) throws AxisFault, SOAPException {
RMHeaders rmHeaders = new RMHeaders();
- rmHeaders.fromSOAPEnvelope(msgContext.getCurrentMessage().getSOAPEnvelope());
- if((rmHeaders.getAckRequest()!=null) ||
- (rmHeaders.getCreateSequence()!=null) ||
- (rmHeaders.getCreateSequenceResponse()!=null) ||
- (rmHeaders.getSequence()!= null) ||
- (rmHeaders.getSequenceAcknowledgement()!=null) ||
- (rmHeaders.getTerminateSequence()!=null)){
- msgContext.setProperty(property, rmHeaders);
- }
-
+ rmHeaders.fromSOAPEnvelope(msgContext.getCurrentMessage()
+ .getSOAPEnvelope());
+ if ((rmHeaders.getAckRequest() != null)
+ || (rmHeaders.getCreateSequence() != null)
+ || (rmHeaders.getCreateSequenceResponse() != null)
+ || (rmHeaders.getSequence() != null)
+ || (rmHeaders.getSequenceAcknowledgement() != null)
+ || (rmHeaders.getTerminateSequence() != null)) {
+ msgContext.setProperty(property, rmHeaders);
+ }
+
}
/**
* Method getProperryFromMessageContext
*
- * @param msgContext
- * @param property
- * @return
+ * @param msgContext
+ * @param property
+ * @return
*/
public RMHeaders getProperryFromMessageContext(MessageContext msgContext,
- String property) {
+ String property) {
return (RMHeaders) msgContext.getProperty(property);
}
-}
+}
\ No newline at end of file
1.11 +17 -17 ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMServerRequestHandler.java
Index: RMServerRequestHandler.java
===================================================================
RCS file: /home/cvs/ws-fx/sandesha/src/org/apache/sandesha/ws/rm/handlers/RMServerRequestHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RMServerRequestHandler.java 5 Jun 2004 10:18:00 -0000 1.10
+++ RMServerRequestHandler.java 13 Sep 2004 11:25:45 -0000 1.11
@@ -18,13 +18,13 @@
import java.util.Iterator;
+import javax.xml.soap.SOAPException;
+
import org.apache.axis.AxisFault;
import org.apache.axis.MessageContext;
import org.apache.axis.message.SOAPHeaderElement;
import org.apache.sandesha.Constants;
-import javax.xml.soap.SOAPException;
-
/**
* class RMServerRequestHandler
*
@@ -36,32 +36,32 @@
/*
* (non-Javadoc)
+ *
* @see org.apache.axis.Handler#invoke(org.apache.axis.MessageContext)
*/
/**
* Method invoke
*
- * @param msgContext
- * @throws AxisFault
+ * @param msgContext
+ * @throws AxisFault
*/
public void invoke(MessageContext msgContext) throws AxisFault {
try {
-
- Iterator iterator=msgContext.getRequestMessage().getSOAPEnvelope().getHeader().getChildElements();
+
+ Iterator iterator = msgContext.getRequestMessage()
+ .getSOAPEnvelope().getHeader().getChildElements();
SOAPHeaderElement elements;
- while(iterator.hasNext()){
- elements=(SOAPHeaderElement) iterator.next();
- elements.setProcessed(true);
+ while (iterator.hasNext()) {
+ elements = (SOAPHeaderElement) iterator.next();
+ elements.setProcessed(true);
}
-
- setPropertyToMessageContext(
- msgContext,
- Constants.ENV_RM_REQUEST_HEADERS);
- } catch (SOAPException e) {
+
+ setPropertyToMessageContext(msgContext,
+ Constants.ENV_RM_REQUEST_HEADERS);
+ } catch (SOAPException e) {
throw AxisFault.makeFault(e);
}
}
-
-
-}
+
+}
\ No newline at end of file