[jboss-svn-commits] JBL Code SVN: r20229 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services: soapui-client/src/main/java/org/jboss/soa/esb/services/soapui and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 30 12:44:45 EDT 2008
Author: tfennelly
Date: 2008-05-30 12:44:45 -0400 (Fri, 30 May 2008)
New Revision: 20229
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml
Log:
http://jira.jboss.com/jira/browse/JBESB-1782
http://jira.jboss.com/jira/browse/JBESB-1785
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java 2008-05-30 10:25:53 UTC (rev 20228)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPClient.java 2008-05-30 16:44:45 UTC (rev 20229)
@@ -371,15 +371,20 @@
}
public Message process(final Message message) throws ActionProcessingException {
- Map params;
+ Object payload;
try {
- params = (Map) payloadProxy.getPayload(message);
+ payload = payloadProxy.getPayload(message);
} catch (MessageDeliverException e) {
- throw new ActionProcessingException("Could not locate SOAP message parameters from payload", e) ;
+ throw new ActionProcessingException("Error getting SOAP message parameters from payload.", e);
}
- if(params.isEmpty()) {
+ if (!(payload instanceof Map)) {
+ throw new ActionProcessingException("Invalid payload type in message body location '" + payloadProxy.getGetPayloadLocation() + "'. Expected 'java.util.Map', was '" + payload.getClass().getName() + "'.");
+ }
+
+ Map params = (Map) payload;
+ if (params.isEmpty()) {
logger.warn("Params Map found in message, but the map is empty.");
}
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2008-05-30 10:25:53 UTC (rev 20228)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/main/java/org/jboss/soa/esb/services/soapui/SoapUIClientService.java 2008-05-30 16:44:45 UTC (rev 20229)
@@ -19,35 +19,36 @@
*/
package org.jboss.soa.esb.services.soapui;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.*;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.dom.DOMResult;
-
+import com.eviware.soapui.impl.wsdl.WsdlInterface;
+import com.eviware.soapui.impl.wsdl.WsdlProject;
+import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader;
+import com.eviware.soapui.model.iface.Operation;
+import org.apache.commons.httpclient.HttpClient;
import org.apache.log4j.Logger;
-import org.apache.commons.httpclient.HttpClient;
import org.jboss.internal.soa.esb.soap.OGNLUtils;
+import org.jboss.internal.soa.esb.util.ESBProperties;
import org.jboss.internal.soa.esb.util.LRUCache;
-import org.jboss.internal.soa.esb.util.ESBProperties;
+import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.dom.YADOMUtil;
import org.jboss.soa.esb.http.HttpClientFactory;
-import org.jboss.soa.esb.ConfigurationException;
import org.jboss.system.ServiceMBeanSupport;
-import org.milyn.xml.XmlUtil;
import org.milyn.Smooks;
+import org.milyn.container.standalone.StandaloneExecutionContext;
+import org.milyn.javabean.BeanAccessor;
import org.milyn.resource.URIResourceLocator;
+import org.milyn.xml.XmlUtil;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
-import com.eviware.soapui.impl.wsdl.WsdlInterface;
-import com.eviware.soapui.impl.wsdl.WsdlProject;
-import com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader;
-import com.eviware.soapui.model.iface.Operation;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.*;
/**
* Soap UI Soap Client Service MBean.
@@ -170,25 +171,30 @@
expandMessage(docRoot, params);
injectParameters(docRoot, params, soapNs);
if(smooksResource != null) {
- applySmooksTransform(smooksResource, messageDoc);
+ return applySmooksTransform(smooksResource, messageDoc, params);
+ } else {
+ return XmlUtil.serialize(messageDoc.getChildNodes());
}
-
- return XmlUtil.serialize(messageDoc.getChildNodes());
}
- private void applySmooksTransform(String smooksResource, Document messageDoc) throws IOException, SAXException {
- if(smooksResource != null) {
- Smooks smooks = smooksCache.get(smooksResource);
+ private String applySmooksTransform(String smooksResource, Document messageDoc, Map requestParams) throws IOException, SAXException {
+ Smooks smooks = smooksCache.get(smooksResource);
- if(smooks == null) {
- smooks = new Smooks();
- smooks.addConfigurations("smooks-resource", new ByteArrayInputStream(smooksResource.getBytes("UTF-8")));
- smooks.addConfigurations("cdu-creators", new URIResourceLocator().getResource("/META-INF/smooks-creators.xml"));
- smooksCache.put(smooksResource, smooks);
- }
+ if(smooks == null) {
+ smooks = new Smooks();
+ smooks.addConfigurations("smooks-resource", new ByteArrayInputStream(smooksResource.getBytes("UTF-8")));
+ smooks.addConfigurations("cdu-creators", new URIResourceLocator().getResource("/META-INF/smooks-creators.xml"));
+ smooksCache.put(smooksResource, smooks);
+ }
- smooks.filter(new DOMSource(messageDoc), new DOMResult(), smooks.createExecutionContext());
- }
+ StringWriter resultWriter = new StringWriter();
+ StandaloneExecutionContext executionContext = smooks.createExecutionContext();
+ Map beanMap = BeanAccessor.getBeans(executionContext);
+
+ beanMap.putAll(requestParams);
+ smooks.filter(new DOMSource(messageDoc), new StreamResult(resultWriter), executionContext);
+
+ return resultWriter.toString();
}
/**
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2008-05-30 10:25:53 UTC (rev 20228)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/SoapUIClientServiceMBeanUnitTest.java 2008-05-30 16:44:45 UTC (rev 20229)
@@ -303,6 +303,7 @@
properties.setProperty(HttpClientFactory.TARGET_HOST_URL, wsdlFile.toURI().toString());
params.put("salesOrderNotification", new OrderNotification());
+ params.put("someDynamicValue", 123);
String message = mbean.buildRequest(wsdlFile.toURI().toString(), "SendSalesOrderNotification", params, properties, StreamUtils.readStreamString(getClass().getResourceAsStream("sendNotificationTransform.xml"), "UTF-8"), null);
assertTrue("Generated SOAP message not as expected. See expected_04.xml. Generated message: \n" + message, compareCharStreams(getClass().getResourceAsStream("expected_04.xml"), new ByteArrayInputStream(message.getBytes())));
assertEquals("http://localhost:18080/active-bpel/services/RetailerCallback", mbean.getEndpoint(wsdlFile.toURI().toString(), properties));
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml 2008-05-30 10:25:53 UTC (rev 20228)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/expected_04.xml 2008-05-30 16:44:45 UTC (rev 20229)
@@ -1,5 +1,8 @@
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abi="http://org.jboss.esb/quickstarts/bpel/ABI_OrderManager">
- <soapenv:Header><something addedto="header"/></soapenv:Header>
+ <soapenv:Header>
+ <something addedto="header" />
+ <somethingelse>123</somethingelse>
+</soapenv:Header>
<soapenv:Body>
<abi:salesOrderNotification>
<abi:orderNumber>12345</abi:orderNumber>
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml 2008-05-30 10:25:53 UTC (rev 20228)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/services/soapui-client/src/test/java/org/jboss/soa/esb/services/soapui/sendNotificationTransform.xml 2008-05-30 16:44:45 UTC (rev 20229)
@@ -2,12 +2,10 @@
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd">
<resource-config selector="header">
- <resource type="xsl">
- <!--
- <something addedto="header" />
- -->
+ <resource type="ftl"><!--
+ <something addedto="header" />
+ <somethingelse>${someDynamicValue}</somethingelse>-->
</resource>
- <param name="is-xslt-templatelet">true</param>
<param name="action">addto</param>
</resource-config>
More information about the jboss-svn-commits
mailing list