[jboss-svn-commits] JBL Code SVN: r29277 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/http and 6 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 9 10:48:33 EDT 2009
Author: dward
Date: 2009-09-09 10:48:32 -0400 (Wed, 09 Sep 2009)
New Revision: 29277
Added:
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-8443.properties
Removed:
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-httpgateway-9443.properties
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-jbossws-8443.properties
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpRequest.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequest.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/src/org/jboss/soa/esb/samples/quickstart/webservice_proxy_security/test/SendWSMessage.java
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/jboss-web.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/web.xml
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxy.java
Log:
Fix for JBESB-2814
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/HttpRouter.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -20,15 +20,14 @@
package org.jboss.soa.esb.actions.routing.http;
import java.io.Closeable;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Properties;
+import java.util.HashSet;
import java.util.Set;
-import java.util.HashSet;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
@@ -37,19 +36,22 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.util.StreamUtils;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.util.FileUtil;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.routing.AbstractRouter;
import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.http.*;
+import org.jboss.soa.esb.http.HttpClientFactory;
+import org.jboss.soa.esb.http.HttpHeader;
+import org.jboss.soa.esb.http.HttpRequest;
import org.jboss.soa.esb.http.HttpResponse;
import org.jboss.soa.esb.listeners.ListenerTagNames;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.Properties;
import org.jboss.soa.esb.message.ResponseHeader;
import org.jboss.soa.esb.message.ResponseStatus;
import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jboss.soa.esb.util.FileUtil;
/**
* Http router.
@@ -63,7 +65,7 @@
private static Logger logger = Logger.getLogger(HttpRouter.class);
private ConfigTree config;
- private Properties httpClientProps = new Properties();
+ private java.util.Properties httpClientProps = new java.util.Properties();
private HttpClient httpclient;
private URL endpointUrl;
private String method;
@@ -184,7 +186,7 @@
private void attachResponseDetails(Message message, HttpMethodBase method, int responseCode) {
HttpResponse response = new HttpResponse(responseCode);
- org.jboss.soa.esb.message.Properties properties = message.getProperties();
+ Properties properties = message.getProperties();
response.setEncoding(method.getResponseCharSet());
response.setLength(method.getResponseContentLength());
@@ -229,29 +231,52 @@
}
}
- private void setMappedHttpHeaders(HttpMethodBase method, Message message) {
- for (String headerName : mappedHeaderList) {
- final Object header = getHttpHeaders(message, headerName);
- if (header != null) {
- final String headerValue = header.toString() ;
- if (headerValue.length() > 0) {
- method.setRequestHeader(headerName, headerValue);
- }
+ private void setMappedHttpHeaders(HttpMethodBase method, Message message) {
+ HttpRequest request = HttpRequest.getRequest(message);
+ Properties properties = message.getProperties();
+ for (String headerName : mappedHeaderList) {
+ String headerValue = null;
+ if (request != null) {
+ headerValue = getHttpHeaderValue(request, headerName);
+ }
+ if (headerValue == null) {
+ headerValue = getHttpHeaderValue(properties, headerName);
+ }
+ if (headerValue != null) {
+ method.setRequestHeader(headerName, headerValue);
+ }
+ }
+ }
+
+ private String getHttpHeaderValue(HttpRequest request, String headerName) {
+ String headerValue = null;
+ for (HttpHeader header : request.getHeaders()) {
+ String name = header.getName();
+ // HTTP header field names are case-insensitive
+ if (name.equalsIgnoreCase(headerName)) {
+ headerValue = header.getValue();
+ break;
}
}
+ return headerValue;
}
- // HTTP header field names are case-insensitive
- private Object getHttpHeaders(Message esbMessage, String headerName) {
-
- org.jboss.soa.esb.message.Properties ps = esbMessage.getProperties();
- for(String name : ps.getNames()) {
+ private String getHttpHeaderValue(Properties properties, String headerName) {
+ String headerValue = null;
+ for (String name : properties.getNames()) {
+ // HTTP header field names are case-insensitive
if (name.equalsIgnoreCase(headerName)) {
- return ps.getProperty(name);
+ Object property = properties.getProperty(name);
+ if (property != null) {
+ headerValue = property.toString();
+ if (headerValue.length() == 0) {
+ headerValue = null;
+ }
+ }
+ break;
}
}
-
- return null;
+ return headerValue;
}
public String[] getMappedHeaderList() {
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpRequest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpRequest.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/http/HttpRequest.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -19,16 +19,15 @@
*/
package org.jboss.soa.esb.http;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.http.HttpHeader;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-
-import java.util.Map;
+import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.ArrayList;
-import java.io.Serializable;
+import java.util.Map;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.soa.esb.message.Message;
+
/**
* HTTP Request Information.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -59,7 +58,7 @@
private String requestPath;
private List<String> pathInfoTokens = new ArrayList<String>();
private Map<String, String[]> queryParams = new HashMap<String, String[]>();
- private List<HttpHeader> headers = new ArrayList<org.jboss.soa.esb.http.HttpHeader>();
+ private List<HttpHeader> headers = new ArrayList<HttpHeader>();
public String getAuthType() {
return authType;
@@ -224,6 +223,20 @@
public List<HttpHeader> getHeaders() {
return headers;
}
+
+ public HttpHeader getHeader(String headerName) {
+ for (HttpHeader header : headers) {
+ if (header.getName().equalsIgnoreCase(headerName)) {
+ return header;
+ }
+ }
+ return null;
+ }
+
+ public String getHeaderValue(String headerName) {
+ HttpHeader header = getHeader(headerName);
+ return (header != null) ? header.getValue() : null;
+ }
public static HttpRequest getRequest(Message message) {
AssertArgument.isNotNull(message, "message");
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequest.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/gateway/http/HttpRequest.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -19,16 +19,16 @@
*/
package org.jboss.soa.esb.listeners.gateway.http;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.http.HttpHeader;
-import org.jboss.internal.soa.esb.assertion.AssertArgument;
-
-import java.util.Map;
+import java.io.Serializable;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.ArrayList;
-import java.io.Serializable;
+import java.util.Map;
+import org.jboss.internal.soa.esb.assertion.AssertArgument;
+import org.jboss.soa.esb.http.HttpHeader;
+import org.jboss.soa.esb.message.Message;
+
/**
* HTTP Request Information.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -59,7 +59,7 @@
private String requestPath;
private List<String> pathInfoTokens = new ArrayList<String>();
private Map<String, String[]> queryParams = new HashMap<String, String[]>();
- private List<HttpHeader> headers = new ArrayList<org.jboss.soa.esb.http.HttpHeader>();
+ private List<HttpHeader> headers = new ArrayList<HttpHeader>();
public String getAuthType() {
return authType;
@@ -224,6 +224,20 @@
public List<HttpHeader> getHeaders() {
return headers;
}
+
+ public HttpHeader getHeader(String headerName) {
+ for (HttpHeader header : headers) {
+ if (header.getName().equalsIgnoreCase(headerName)) {
+ return header;
+ }
+ }
+ return null;
+ }
+
+ public String getHeaderValue(String headerName) {
+ HttpHeader header = getHeader(headerName);
+ return (header != null) ? header.getValue() : null;
+ }
public static HttpRequest getRequest(Message message) {
AssertArgument.isNotNull(message, "message");
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/message/ResponseStatus.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -29,51 +29,52 @@
* now that these actions will set the http response status back into the Message Properties,
* which will then get returned in the http response of a synchronous invocation of the
* <jbr-provider/> ({@link org.jboss.soa.esb.listeners.gateway.JBossRemotingGatewayListener JBossRemotingGatewayListener}) or <http-provider/> ({@link org.jboss.soa.esb.listeners.gateway.HttpGatewayListener HttpGatewayListener}).<p/>
- *
+ *
* If you want the legacy behavior, you can override this at an action level (META-INF/jboss-esb.xml):<br/>
* <action name="..." class="..."><br/>
* <property name="http.responseStatusEnabled" value="false"/><br/>
* </action><p/>
- *
+ *
* or at a global level (jbossesb-properties.xml):<br/>
* <esb><br/>
* <properties name="transports"><br/>
* <property name="org.jboss.soa.esb.http.responseStatusEnabled" value="false"/><br/>
* </properties><br/>
* </esb>
- *
+ *
* @author dward at jboss.org
*/
+ at SuppressWarnings("deprecation")
public class ResponseStatus
{
-
+
public static final String ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG = "http.responseStatusEnabled";
public static final String GLOBAL_HTTP_RESPONSE_STATUS_ENABLED_CONFIG = "org.jboss.soa.esb." + ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG;
-
+
private static boolean GLOBAL_HTTP_RESPONSE_STATUS_ENABLED;
static {
GLOBAL_HTTP_RESPONSE_STATUS_ENABLED =
ModulePropertyManager.getPropertyManager(ModulePropertyManager.TRANSPORTS_MODULE)
.getProperty(GLOBAL_HTTP_RESPONSE_STATUS_ENABLED_CONFIG, "true").equals("true");
}
-
+
private ResponseStatus() {}
-
+
// JBESB-2761
- public static boolean isHttpEnabled(ConfigTree actionConfig) {
- return actionConfig.getBooleanAttribute(ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG, GLOBAL_HTTP_RESPONSE_STATUS_ENABLED);
- }
-
- // JBESB-2761
- public static void setHttpProperties(Properties properties, int statusCode, String statusMessage) {
- if (statusCode > 0) {
- properties.setProperty(HTTPMetadataConstants.RESPONSE_CODE, statusCode); // <jbr-provider/>
- properties.setProperty(HttpMessageComposer.HTTP_RESPONSE_STATUS, statusCode); // <http-provider/>
- }
- if (statusMessage != null) {
- properties.setProperty(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE, statusMessage); // <jbr-provider/>
- // unnecessary to set status message for <http-provider/>
- }
- }
+ public static boolean isHttpEnabled(ConfigTree actionConfig) {
+ return actionConfig.getBooleanAttribute(ACTION_HTTP_RESPONSE_STATUS_ENABLED_CONFIG, GLOBAL_HTTP_RESPONSE_STATUS_ENABLED);
+ }
+ // JBESB-2761
+ public static void setHttpProperties(Properties properties, int statusCode, String statusMessage) {
+ if (statusCode > 0) {
+ properties.setProperty(HTTPMetadataConstants.RESPONSE_CODE, statusCode); // <jbr-provider/>
+ properties.setProperty(HttpMessageComposer.HTTP_RESPONSE_STATUS, statusCode); // <http-provider/>
+ }
+ if (statusMessage != null) {
+ properties.setProperty(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE, statusMessage); // <jbr-provider/>
+ // unnecessary to set status message for <http-provider/>
+ }
+ }
+
}
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/build.xml 2009-09-09 14:48:32 UTC (rev 29277)
@@ -16,12 +16,12 @@
<target name="quickstart-specific-predeploys">
<copy todir="${org.jboss.esb.server.deploy.dir}"
- file="build/predeploy/${ant.project.name}.war"/>
+ file="build/predeploy/webservice_proxy_security.war"/>
<sleep seconds="3"/>
</target>
<target name="quickstart-specific-undeploys">
- <delete file="${org.jboss.esb.server.deploy.dir}/${ant.project.name}.war"/>
+ <delete file="${org.jboss.esb.server.deploy.dir}/webservice_proxy_security.war"/>
</target>
<target name="genkey">
@@ -54,18 +54,12 @@
</filterset>
</copy>
- <copy file="httpclient-jbossws-8443.properties" todir="${build.dir}/META-INF">
+ <copy file="httpclient-8443.properties" todir="${build.dir}/META-INF">
<filterset>
<filter token="keystore" value="${keystoredir}" />
</filterset>
</copy>
- <copy file="httpclient-httpgateway-9443.properties" todir="${build.dir}">
- <filterset>
- <filter token="keystore" value="${keystoredir}" />
- </filterset>
- </copy>
-
<copy file="server-template.xml" tofile="${build.dir}/server.xml">
<filterset>
<filter token="keystore" value="${keystoredir}" />
@@ -89,7 +83,7 @@
<!-- War... -->
<mkdir dir="build/predeploy"/>
- <war warfile="build/predeploy/${ant.project.name}.war"
+ <war warfile="build/predeploy/webservice_proxy_security.war"
webxml="${basedir}/war/resources/WEB-INF/web.xml">
<webinf dir="${basedir}/war/resources/WEB-INF">
<include name="jboss-web.xml"/>
@@ -116,22 +110,20 @@
<java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.webservice_proxy_security.test.SendWSMessage" failonerror="true">
<arg value="${runtest.arg.url}"/>
<arg value="${user.name}"/>
- <arg value="${runtest.arg.http}"/>
+ <arg value="${build.dir}/META-INF/httpclient-8443.properties"/>
<classpath refid="exec-classpath"/>
</java>
</target>
<target name="runws" depends="compile">
<echo>Calling JBossWS webservice directly.</echo>
- <property name="runtest.arg.url" value="https://localhost:8443/Quickstart_webservice_proxy_security/HelloWorldWS"/>
- <property name="runtest.arg.http" value="${build.dir}/META-INF/httpclient-jbossws-8443.properties"/>
+ <property name="runtest.arg.url" value="https://localhost:8443/webservice_proxy_security/HelloWorldWS"/>
<antcall target="runinternal"/>
</target>
<target name="runhttps" depends="compile">
<echo>Calling JBossWS webservice via HttpGatewayListener and SOAPProxy.</echo>
- <property name="runtest.arg.url" value="https://localhost:9443/Proxy_Security/HelloWorldWS/"/>
- <property name="runtest.arg.http" value="${build.dir}/httpclient-httpgateway-9443.properties"/>
+ <property name="runtest.arg.url" value="https://localhost:8443/Quickstart_webservice_proxy_security/http/ProxyWS"/>
<antcall target="runinternal"/>
</target>
<target name="runtest" depends="runhttps"/>
Copied: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-8443.properties (from rev 29264, labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-jbossws-8443.properties)
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-8443.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-8443.properties 2009-09-09 14:48:32 UTC (rev 29277)
@@ -0,0 +1,27 @@
+# See:
+# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpRouter and
+# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory
+
+# Configurators
+configurators=HttpProtocol,AuthBASIC
+
+# HttpProtocol config
+#protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.StrictSSLProtocolSocketFactory
+protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory
+#protocol-socket-factory=org.jboss.soa.esb.http.protocol.SelfSignedSSLProtocolSocketFactoryBuilder
+#protocol-socket-factory=org.jboss.soa.esb.http.protocol.AuthSSLProtocolSocketFactoryBuilder
+keystore=@keystore@
+keystore-passw=webservice_proxy_security_pass
+truststore=@keystore@
+truststore-passw=webservice_proxy_security_pass
+
+# Connection config
+#max-connections-per-host=5
+
+# AuthBASIC config
+auth-username=kermit
+auth-password=thefrog
+authscope-host=localhost
+authscope-port=8443
+authscope-realm=webservice_proxy_security
+
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-httpgateway-9443.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-httpgateway-9443.properties 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-httpgateway-9443.properties 2009-09-09 14:48:32 UTC (rev 29277)
@@ -1,17 +0,0 @@
-# See:
-# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpRouter and
-# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory
-
-# Configurators
-configurators=HttpProtocol
-
-# HttpProtocol config
-#protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.StrictSSLProtocolSocketFactory
-protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory
-#protocol-socket-factory=org.jboss.soa.esb.http.protocol.SelfSignedSSLProtocolSocketFactoryBuilder
-#protocol-socket-factory=org.jboss.soa.esb.http.protocol.AuthSSLProtocolSocketFactoryBuilder
-keystore=@keystore@
-keystore-passw=webservice_proxy_security_pass
-truststore=@keystore@
-truststore-passw=webservice_proxy_security_pass
-
Deleted: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-jbossws-8443.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-jbossws-8443.properties 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/httpclient-jbossws-8443.properties 2009-09-09 14:48:32 UTC (rev 29277)
@@ -1,27 +0,0 @@
-# See:
-# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpRouter and
-# - http://wiki.jboss.org/wiki/Wiki.jsp?page=HttpClientFactory
-
-# Configurators
-configurators=HttpProtocol,AuthBASIC
-
-# HttpProtocol config
-#protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.StrictSSLProtocolSocketFactory
-protocol-socket-factory=org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory
-#protocol-socket-factory=org.jboss.soa.esb.http.protocol.SelfSignedSSLProtocolSocketFactoryBuilder
-#protocol-socket-factory=org.jboss.soa.esb.http.protocol.AuthSSLProtocolSocketFactoryBuilder
-keystore=@keystore@
-keystore-passw=webservice_proxy_security_pass
-truststore=@keystore@
-truststore-passw=webservice_proxy_security_pass
-
-# Connection config
-#max-connections-per-host=5
-
-# AuthBASIC config
-auth-username=admin
-auth-password=admin
-authscope-host=localhost
-authscope-port=8443
-authscope-realm=webservice_proxy_security
-
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/jboss-esb-template.xml 2009-09-09 14:48:32 UTC (rev 29277)
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.1.0.xsd" parameterReloadSecs="5">
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd" parameterReloadSecs="5">
<providers>
- <http-provider name="HTTP" host="localhost" port="9443">
- <property name="scheme" value="https"/>
- <property name="secure" value="true"/>
- <property name="SSLEnabled" value="true"/>
- <property name="Keystore" value="@keystore@"/>
- <property name="Keypass" value="webservice_proxy_security_pass"/>
- <http-bus busid="HTTP-BUS" context="/Proxy_Security/HelloWorldWS"/>
+ <http-provider name="HTTP-PROVIDER">
+ <http-bus busid="HTTP-BUS" transportGuarantee="CONFIDENTIAL">
+ <allowed-roles>
+ <role name="friend" />
+ </allowed-roles>
+ </http-bus>
+ <auth method="BASIC" domain="JBossWS" />
</http-provider>
</providers>
@@ -16,11 +16,9 @@
<service category="Proxy_Security" name="Proxy"
description="Security WebService Proxy"
invmScope="GLOBAL">
+ <security moduleName="JBossWS" />
<listeners>
- <http-listener name="HTTP-GATEWAY"
- busidref="HTTP-BUS"
- is-gateway="true"
- />
+ <http-gateway name="HTTP-GATEWAY" busidref="HTTP-BUS" urlPattern="ProxyWS/*" />
</listeners>
<actions mep="RequestResponse">
<action name="echo-request"
@@ -29,9 +27,9 @@
</action>
<action name="proxy"
class="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy">
- <property name="wsdl" value="https://localhost:8443/Quickstart_webservice_proxy_security/HelloWorldWS?wsdl"/>
- <property name="endpointUrl" value="https://localhost:8443/Quickstart_webservice_proxy_security/HelloWorldWS"/>
- <property name="file" value="/META-INF/httpclient-jbossws-8443.properties"/>
+ <property name="wsdl" value="https://localhost:8443/webservice_proxy_security/HelloWorldWS?wsdl"/>
+ <property name="endpointUrl" value="https://localhost:8443/webservice_proxy_security/HelloWorldWS"/>
+ <property name="file" value="/META-INF/httpclient-8443.properties"/>
</action>
<action name="echo-response"
class="org.jboss.soa.esb.actions.SystemPrintln">
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/readme.txt 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/readme.txt 2009-09-09 14:48:32 UTC (rev 29277)
@@ -21,7 +21,7 @@
15:10:03,777 INFO [SOAPProxy] mapped soapaction [""] to binding [{http://webservice_proxy_security/helloworld}HelloWorldBinding]
15:10:03,777 INFO [SOAPProxy] mapped operation [{http://webservice_proxy_security/helloworld}sayHello] to binding [{http://webservice_proxy_security/helloworld}HelloWorldBinding]
-15:10:03,796 INFO [SOAPProxy] mapped binding [{http://webservice_proxy_security/helloworld}HelloWorldBinding] to transport [org.jboss.soa.esb.actions.soap.proxy.HttpSOAPProxyTransport] with endpoint address: [https://localhost:8443/Quickstart_webservice_proxy_security/HelloWorldWS]
+15:10:03,796 INFO [SOAPProxy] mapped binding [{http://webservice_proxy_security/helloworld}HelloWorldBinding] to transport [org.jboss.soa.esb.actions.soap.proxy.HttpSOAPProxyTransport] with endpoint address: [https://localhost:8443/webservice_proxy_security/HelloWorldWS]
4. Open another command terminal window in this folder ("Window2"), type
'ant runtest'.
@@ -34,13 +34,13 @@
- This calls the target JBossWS webservice directly setting the
Authorization header and using HTTPClient for SSL.
- The request url is:
- https://localhost:8443/Quickstart_webservice_proxy_security/HelloWorldWS
+ https://localhost:8443/webservice_proxy_security/HelloWorldWS
- Running it will create output similar to the runhttps output below.
'runhttps' (alias 'runtest') target description:
- This will exercise the target webservice *via* the SOAPProxy, first going
through a Http Gateway Listener.
- - The request url is: https://localhost:9443/Proxy_Security/HelloWorldWS/
+ - The request url is: https://localhost:8443/Quickstart_webservice_proxy_security/http/ProxyWS
- Running it will create output like this in the server console:
15:11:11,693 INFO [STDOUT] Message before SOAPProxy:
@@ -50,14 +50,14 @@
...and this in the client console:
- [java] **** REQUEST URL: https://localhost:9443/Proxy_Security/HelloWorldWS/
+ [java] **** REQUEST URL: https://localhost:8443/Quickstart_webservice_proxy_security/http/ProxyWS
[java] **** REQUEST BODY: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_security/helloworld"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>
- [java] 15:11:11,392 DEBUG [main][header] >> "POST /Proxy_Security/HelloWorldWS/ HTTP/1.1[\r][\n]"
+ [java] 15:11:11,392 DEBUG [main][header] >> "POST /Quickstart_webservice_proxy_security/http/ProxyWS HTTP/1.1[\r][\n]"
[java] 15:11:11,426 DEBUG [main][header] >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[java] 15:11:11,427 DEBUG [main][header] >> "Authorization: Basic YWRtaW46YWRtaW4=[\r][\n]"
[java] 15:11:11,427 DEBUG [main][header] >> "SOAPAction: ""[\r][\n]"
[java] 15:11:11,427 DEBUG [main][header] >> "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
- [java] 15:11:11,428 DEBUG [main][header] >> "Host: localhost:9443[\r][\n]"
+ [java] 15:11:11,428 DEBUG [main][header] >> "Host: localhost:8443[\r][\n]"
[java] 15:11:11,428 DEBUG [main][header] >> "Content-Length: 254[\r][\n]"
[java] 15:11:11,428 DEBUG [main][header] >> "[\r][\n]"
[java] 15:11:11,428 DEBUG [main][content] >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hello="http://webservice_proxy_security/helloworld"><soapenv:Header/><soapenv:Body><hello:sayHello><toWhom>dward</toWhom></hello:sayHello></soapenv:Body></soapenv:Envelope>"
@@ -93,12 +93,9 @@
log4j.xml:
Needed to configure log4J used by the quickstart.
- build/httpclient-jbossws-8443.properties:
- HTTPClient config file used to talk to the original endpoint
+ build/httpclient-8443.properties:
+ HTTPClient config file used to talk BASI Auth + SSL
- build/httpclient-httpgateway-9443.properties:
- HTTPClient config file used to talk to the proxy endpoint from SendWSMessage
-
src/../SendWSMessage.java:
Sends a SOAP message to the target webservice endpoint (see "ant run*" above) over
SSL + Basic Auth.
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/src/org/jboss/soa/esb/samples/quickstart/webservice_proxy_security/test/SendWSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/src/org/jboss/soa/esb/samples/quickstart/webservice_proxy_security/test/SendWSMessage.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/src/org/jboss/soa/esb/samples/quickstart/webservice_proxy_security/test/SendWSMessage.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -57,9 +57,9 @@
{
// for testing main method from Eclipse (build.xml passes these args in)
args = new String[3];
- args[0] = "https://localhost:9443/Proxy_Security/HelloWorldWS"; // proxy via http gateway ("ant runtest")
+ args[0] = "https://localhost:8443/Quickstart_webservice_proxy_security/http/ProxyWS"; // proxy via http gateway ("ant runtest")
args[1] = System.getProperty("user.name");
- args[2] = "/path-to/samples/quickstarts/webservice_proxy_security/build/META-INF/httpclient-httpgateway-9443.properties";
+ args[2] = "/path-to/samples/quickstarts/webservice_proxy_security/build/META-INF/httpclient-8443.properties";
}
String url = args[0];
@@ -68,7 +68,7 @@
method.setRequestHeader("Content-Type", "text/xml;charset=UTF-8");
// basic auth header should come from client unless <property name="clientCredentialsRequired" value="false"/> is specified
- method.setRequestHeader("Authorization", "Basic " + Encoding.encodeBytes("admin:admin".getBytes()) );
+ method.setRequestHeader("Authorization", "Basic " + Encoding.encodeBytes("kermit:thefrog".getBytes()) );
// this line should be used for better performance/interop but is not necessary
// http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/jboss-web.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/jboss-web.xml 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/jboss-web.xml 2009-09-09 14:48:32 UTC (rev 29277)
@@ -1,3 +1,3 @@
<jboss-web>
- <security-domain>java:/jaas/jmx-console</security-domain>
-</jboss-web>
\ No newline at end of file
+ <security-domain>java:/jaas/JBossWS</security-domain>
+</jboss-web>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/web.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/web.xml 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_proxy_security/war/resources/WEB-INF/web.xml 2009-09-09 14:48:32 UTC (rev 29277)
@@ -21,7 +21,7 @@
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
- <role-name>JBossAdmin</role-name>
+ <role-name>friend</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
@@ -34,7 +34,7 @@
</login-config>
<security-role>
- <role-name>JBossAdmin</role-name>
+ <role-name>friend</role-name>
</security-role>
</web-app>
Modified: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxy.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxy.java 2009-09-09 14:47:56 UTC (rev 29276)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/proxy/SOAPProxy.java 2009-09-09 14:48:32 UTC (rev 29277)
@@ -38,6 +38,7 @@
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.http.HttpRequest;
import org.jboss.soa.esb.listeners.message.MessageDeliverException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.MessagePayloadProxy;
@@ -203,10 +204,19 @@
transport.initialise();
}
}
-
+
public Message process(Message message) throws ActionProcessingException
{
- String soapaction = (String)message.getProperties().getProperty("soapaction");
+ String soapaction = null;
+ HttpRequest request = HttpRequest.getRequest(message);
+ if (request != null)
+ {
+ soapaction = request.getHeaderValue("soapaction");
+ }
+ if (soapaction == null)
+ {
+ soapaction = (String)message.getProperties().getProperty("soapaction");
+ }
QName binding = (soapaction != null) ? soapaction_to_binding.get(soapaction) : null;
QName operation = null;
if (binding == null)
More information about the jboss-svn-commits
mailing list