[savara-commits] savara SVN: r424 - in trunk: samples/purchasing and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 29 16:11:38 EDT 2010


Author: objectiser
Date: 2010-09-29 16:11:37 -0400 (Wed, 29 Sep 2010)
New Revision: 424

Modified:
   trunk/distribution/src/files/jbossws-native/standard-jaxws-client-config-validator.xml
   trunk/samples/purchasing/CreditCheckRequest.xml
   trunk/samples/purchasing/PurchaseGoods.cdm
   trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java
   trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java
   trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java
Log:
Fix various issues with monitoring a jaxws service.

Modified: trunk/distribution/src/files/jbossws-native/standard-jaxws-client-config-validator.xml
===================================================================
--- trunk/distribution/src/files/jbossws-native/standard-jaxws-client-config-validator.xml	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/distribution/src/files/jbossws-native/standard-jaxws-client-config-validator.xml	2010-09-29 20:11:37 UTC (rev 424)
@@ -5,7 +5,7 @@
   
   <client-config>
     <config-name>Standard Client</config-name>
-    <post-handler-chains>
+    <pre-handler-chains>
       <javaee:handler-chain>
         <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol-bindings>
         <javaee:handler>
@@ -13,7 +13,7 @@
           <javaee:handler-class>org.jboss.savara.validator.jbosswsnative.JBossWSNativeClientInterceptor</javaee:handler-class>
         </javaee:handler>
       </javaee:handler-chain>
-    </post-handler-chains>
+    </pre-handler-chains>
     <feature>http://org.jboss.ws/dispatch/validate</feature>
     <property>
       <property-name>http://org.jboss.ws/http#chunksize</property-name>

Modified: trunk/samples/purchasing/CreditCheckRequest.xml
===================================================================
--- trunk/samples/purchasing/CreditCheckRequest.xml	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/samples/purchasing/CreditCheckRequest.xml	2010-09-29 20:11:37 UTC (rev 424)
@@ -1,4 +1,4 @@
 <tns:CreditCheckRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 			xmlns:tns="http://www.jboss.org/examples/creditAgency" 
 			xsi:schemaLocation="http://www.jboss.org/examples/creditAgency creditAgency.xsd " 
-			id="1" />
\ No newline at end of file
+			id="1" amount="200" />
\ No newline at end of file

Modified: trunk/samples/purchasing/PurchaseGoods.cdm
===================================================================
--- trunk/samples/purchasing/PurchaseGoods.cdm	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/samples/purchasing/PurchaseGoods.cdm	2010-09-29 20:11:37 UTC (rev 424)
@@ -50,26 +50,27 @@
   </typeDefinitions>
   <choreographies description="Choreography flow for the PurchaseGoods process" name="PurchaseGoodsProcess" root="true">
     <variableDefinitions description="Channel to facilitate interaction to CreditAgency" name="CreditAgencyChannel" type="//@typeDefinitions/@channelTypes.0"/>
+    <variableDefinitions name="CreditCheckVar" type="//@typeDefinitions/@informationTypes.5"/>
     <variableDefinitions description="Channel to facilitate interaction to Supplier" name="SupplierChannel" type="//@typeDefinitions/@channelTypes.1"/>
     <variableDefinitions description="This is the variable buy" name="buy" type="//@typeDefinitions/@informationTypes.2"/>
-    <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyRequest" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+    <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyRequest" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.2" relationship="//@typeDefinitions/@relationshipTypes.0">
       <exchangeDetails description="This is the exchange details for the request exchange associated with interaction BuyRequest" name="BuyRequestRequestExchange" type="//@typeDefinitions/@informationTypes.2">
         <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/store}StoreService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
       </exchangeDetails>
     </activities>
     <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheck" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1">
-      <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CreditCheck" name="CreditCheckRequestExchange" type="//@typeDefinitions/@informationTypes.5">
+      <exchangeDetails description="This is the exchange details for the request exchange associated with interaction CreditCheck" name="CreditCheckRequestExchange" type="//@typeDefinitions/@informationTypes.5" receiveVariable="//@choreographies.0/@variableDefinitions.1">
         <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAgencyService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
       </exchangeDetails>
     </activities>
     <activities xsi:type="org.pi4soa.cdl:Choice" description="Is credit ok?">
-      <activities xsi:type="org.pi4soa.cdl:Sequence" description="Credit Valid">
+      <activities xsi:type="org.pi4soa.cdl:Conditional" name="CreditValid" expression="cdl:getVariable('CreditCheckVar','','//@amount','CreditAgency') &lt; 250">
         <activities xsi:type="org.pi4soa.cdl:Interaction" name="CreditCheckOk" operation="checkCredit" channelVariable="//@choreographies.0/@variableDefinitions.0" relationship="//@typeDefinitions/@relationshipTypes.1">
           <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction CreditCheckOk" name="CreditCheckOkRespondExchange" type="//@typeDefinitions/@informationTypes.4" action="Respond">
             <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAgencyService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
           </exchangeDetails>
         </activities>
-        <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyConfirmed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+        <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyConfirmed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.2" relationship="//@typeDefinitions/@relationshipTypes.0">
           <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction BuyConfirmed" name="BuyConfirmedRespondExchange" type="//@typeDefinitions/@informationTypes.0" action="Respond">
             <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/store}StoreService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
           </exchangeDetails>
@@ -81,7 +82,7 @@
             <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAgencyService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
           </exchangeDetails>
         </activities>
-        <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyFailed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.1" relationship="//@typeDefinitions/@relationshipTypes.0">
+        <activities xsi:type="org.pi4soa.cdl:Interaction" name="BuyFailed" operation="buy" channelVariable="//@choreographies.0/@variableDefinitions.2" relationship="//@typeDefinitions/@relationshipTypes.0">
           <exchangeDetails description="This is the exchange details for the respond exchange associated with interaction BuyFailed" name="BuyFailedRespondExchange" type="//@typeDefinitions/@informationTypes.1" action="Respond" faultName="BuyFailed">
             <semanticAnnotations annotation="&lt;validator>&#xD;&#xA;&#x9;&lt;destination name=&quot;{{Destination;The URI for the destination;string;;{http://www.jboss.org/examples/store}StoreService}}&quot;&#xD;&#xA;&#x9;&#x9;type=&quot;{{Type;The type of destination;enum;endpoint address,service name;service name}}&quot; />&#xD;&#xA;&#x9;&#x9;dynamicReplyTo=&quot;{{Dynamic ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}&quot; />&#xD;&#xA;&lt;/validator>&#xD;&#xA;" name="validator"/>
           </exchangeDetails>

Modified: trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java
===================================================================
--- trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/AbstractJBossWSNativeInterceptor.java	2010-09-29 20:11:37 UTC (rev 424)
@@ -36,6 +36,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.savara.validator.Endpoint;
 import org.jboss.savara.validator.ServiceValidatorManager;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.umdm.ParameterMetaData;
 import org.jboss.wsf.common.DOMWriter;
 import org.jboss.wsf.common.handler.GenericSOAPHandler;
@@ -96,7 +97,7 @@
 	 * @return The message type
 	 * @throws SOAPException Failed to determine the message type
 	 */
-	public static String getMessageType(SOAPMessageContext soapCtx) throws SOAPException {
+	public static String getMessageType(SOAPMessageContext soapCtx, boolean request) throws SOAPException {
 		String ret=null;
 		
 		if (soapCtx instanceof org.jboss.ws.core.jaxws.handler.MessageContextJAXWS) {
@@ -104,21 +105,31 @@
 				(org.jboss.ws.core.jaxws.handler.MessageContextJAXWS)soapCtx;
 		    org.jboss.ws.metadata.umdm.OperationMetaData opmetadata=mc.getOperationMetaData();
 		    
-		    if (opmetadata.getInputParameters().size() == 1) {
-		    	ParameterMetaData pmd=opmetadata.getInputParameters().get(0);
+		    if (opmetadata != null) {
+		    	ParameterMetaData pmd=null;
 		    	
-		    	// TODO: Find out why 'genericParam' is generated when the parameter
-		    	// is a complex type
-				if (pmd.getXmlName().getLocalPart().equals("genericParam")) {
-					
-					// Extract message value
-		            SOAPElement elem=getMessageBody(soapCtx);
-		            
-		            ret = elem.getElementQName().toString();
-
-				} else {
-					ret = pmd.getXmlName().toString();
-				}
+		    	if (request && opmetadata.getInputParameters().size() == 1) {
+			    	pmd = opmetadata.getInputParameters().get(0);	
+		    	} else if (!request && opmetadata.getOutputParameters().size() == 1) {
+			    	pmd = opmetadata.getOutputParameters().get(0);	
+		    	}
+		    	
+		    	if (pmd != null) {
+			    	// TODO: Find out why 'genericParam' is generated when the parameter
+			    	// is a complex type
+					if (pmd.getXmlName().getLocalPart().equals("genericParam")) {
+						
+						// Extract message value
+			            SOAPElement elem=getMessageBody(soapCtx);
+			            
+			            if (elem != null) {
+			            	ret = elem.getElementQName().toString();
+			            }
+	
+					} else {
+						ret = pmd.getXmlName().toString();
+					}
+		    	}
 		    }
 		}
 
@@ -131,7 +142,14 @@
 		// Extract message value
         SOAPBody soapBody = soapCtx.getMessage().getSOAPPart().getEnvelope().getBody();
 		
-        ret = (SOAPElement)soapBody.getChildElements().next();
+    	java.util.Iterator<?> iter=soapBody.getChildElements();
+    	while (ret == null && iter.hasNext()) {
+    		Object body=iter.next();
+    		
+    		if (body instanceof SOAPElement) {
+    			ret = (SOAPElement)body;
+    		}
+    	}
         
         if (ret instanceof SOAPFault) {
         	SOAPFault fault=(SOAPFault)ret;
@@ -154,6 +172,15 @@
         
 		if (logger.isDebugEnabled()) {
 			logger.debug("Service for endpoint = "+service);
+			
+			if (service == null && soapCtx instanceof SOAPMessageContextJAXWS) {
+				SOAPMessageContextJAXWS smc=(SOAPMessageContextJAXWS)soapCtx;
+				
+				if (smc.getEndpointMetaData() != null &&
+								smc.getEndpointMetaData().getServiceMetaData() != null) {
+					service = smc.getEndpointMetaData().getServiceMetaData().getServiceName();
+				}			
+			}
 		}
 
 		return(service == null ? null : new Endpoint(service.toString()));

Modified: trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java
===================================================================
--- trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeClientInterceptor.java	2010-09-29 20:11:37 UTC (rev 424)
@@ -53,7 +53,7 @@
 				for (int i=0; validators != null &&
 							i < validators.size(); i++) {
 			        try {
-			        	validators.get(i).messageReceived(getMessageType(soapCtx), getMessage(soapCtx));
+			        	validators.get(i).messageReceived(getMessageType(soapCtx, false), getMessage(soapCtx));
 			        	validated = true;
 			        } catch(Exception t) {
 			        	// Ignore
@@ -108,7 +108,7 @@
 				for (int i=0; validators != null &&
 							i < validators.size(); i++) {
 			        try {
-			        	validators.get(i).messageSent(getMessageType(soapCtx), getMessage(soapCtx));
+			        	validators.get(i).messageSent(getMessageType(soapCtx, true), getMessage(soapCtx));
 			        	validated = true;
 			        } catch(Exception t) {
 			        	// Ignore

Modified: trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java
===================================================================
--- trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java	2010-09-24 14:28:04 UTC (rev 423)
+++ trunk/validators/jboss/wsnative/src/main/java/org/jboss/savara/validator/jbosswsnative/JBossWSNativeServerInterceptor.java	2010-09-29 20:11:37 UTC (rev 424)
@@ -53,7 +53,7 @@
 				for (int i=0; validators != null &&
 							i < validators.size(); i++) {
 			        try {
-			        	validators.get(i).messageReceived(getMessageType(soapCtx), getMessage(soapCtx));
+			        	validators.get(i).messageReceived(getMessageType(soapCtx, true), getMessage(soapCtx));
 			        	validated = true;
 			        } catch(Exception t) {
 			        	// Ignore
@@ -108,7 +108,7 @@
 				for (int i=0; validators != null &&
 							i < validators.size(); i++) {
 			        try {
-			        	validators.get(i).messageSent(getMessageType(soapCtx), getMessage(soapCtx));
+			        	validators.get(i).messageSent(getMessageType(soapCtx, false), getMessage(soapCtx));
 			        	validated = true;
 			        } catch(Exception t) {
 			        	// Ignore



More information about the savara-commits mailing list