[jboss-svn-commits] JBL Code SVN: r13044 - in labs/jbossesb/trunk/product: docs and 9 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 3 12:19:05 EDT 2007
Author: tfennelly
Date: 2007-07-03 12:19:04 -0400 (Tue, 03 Jul 2007)
New Revision: 13044
Added:
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
Removed:
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java
labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
Modified:
labs/jbossesb/trunk/product/build-distr.xml
labs/jbossesb/trunk/product/build.xml
labs/jbossesb/trunk/product/docs/MessageActionGuide.odt
labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
labs/jbossesb/trunk/product/extras/jaxbintros/build.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageDeliveryAdapter.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/README.TXT
labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/src/org/jboss/soa/esb/samples/quickstart/webservicejbosswsadapter01/webservice/GoodbyeWorldWS.java
labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
labs/jbossesb/trunk/product/services/soapui-client/build.xml
Log:
more webservice cleanups + docs
Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/build-distr.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -13,29 +13,30 @@
<property name="esbserver.dist.dir" value="${build.dir}/jbossesb-server-${version}"/>
<property name="installation.files.dir" value="install"/>
+ <target name="dist" depends="server.dist, copy.esbserver.files" />
- <target name="dist" depends="server.dist">
- <copy todir="${esbserver.dist.dir}/docs">
+ <target name="copy.esbserver.files" unless="skip.server.esb">
+ <copy todir="${esbserver.dist.dir}/docs" failonerror="false">
<fileset dir="${build.dir}/jbossesb/docs">
<include name="**/*"/>
</fileset>
</copy>
- <copy todir="${esbserver.dist.dir}">
+ <copy todir="${esbserver.dist.dir}" failonerror="false">
<fileset dir="${build.dir}/jbossesb">
<include name="javadocs/**/*"/>
</fileset>
</copy>
- <copy todir="${esbserver.dist.dir}">
+ <copy todir="${esbserver.dist.dir}" failonerror="false">
<fileset dir="${build.dir}/jbossesb">
<include name="samples/**/*"/>
</fileset>
</copy>
- <copy todir="${esbserver.dist.dir}">
+ <copy todir="${esbserver.dist.dir}" failonerror="false">
<fileset dir="${build.dir}/jbossesb">
<include name="tools/**/*"/>
</fileset>
</copy>
- <copy todir="${esbserver.dist.dir}/docs/schema">
+ <copy todir="${esbserver.dist.dir}/docs/schema" failonerror="false">
<fileset dir="${build.dir}/jbossesb/xml">
<include name="**/*"/>
</fileset>
@@ -47,11 +48,11 @@
</copy>
</target>
- <target name="ftp-server">
+ <target name="ftp-server" unless="skip.ftp.server">
<ant antfile="build.xml" dir="ftp"/>
</target>
- <target name="server.dist" depends="build.sar, unpack.server.zip, ftp-server, services">
+ <target name="server.dist" depends="build.sar, unpack.server.zip, ftp-server, services" unless="skip.server.esb">
<copy todir="${esbserver.dist.dir}/server/default/deploy/jbossesb.sar">
<fileset dir="${build.dir}/jbossesb.sar">
<include name="**/*"/>
@@ -82,7 +83,7 @@
</copy>
</target>
- <target name="unpack.server.zip">
+ <target name="unpack.server.zip" unless="skip.server.esb">
<delete dir="${esbserver.dist.dir}"/>
<unzip src="${installation.files.dir}/standalone/jbossesb-server-base.zip" dest="${build.dir}"/>
<chmod dir="${build.dir}/jbossesb-server/bin" perm="ugo+rx" includes="*.sh"/>
@@ -142,16 +143,17 @@
</target>
- <target name="services">
+ <target name="services" unless="skip.services">
<mkdir dir="${build.dir}/services"/>
<copy todir="${build.dir}/services">
- <fileset dir="${services.dir}/jbossesb/build" includes="jbossesb.esb/**/*" excludes="jbossesb.esb/jbmq-queue-service.xml jbossesb.esb/jbm-queue-service-scoped.xml"/>
+ <fileset dir="${services.dir}/jbossesb/build" includes="jbossesb.esb/**/*" />
<fileset dir="${services.dir}/jbpm/build" includes="jbpm.esb/**/*"/>
<fileset dir="${services.dir}/jbrules/build" includes="jbrules.esb/**/*"/>
- <fileset dir="${services.dir}/smooks/build" includes="smooks.esb/**/*" excludes="smooks.esb/jbmq-queue-service.xml smooks.esb/jbm-queue-service-scoped.xml"/>
+ <fileset dir="${services.dir}/smooks/build" includes="smooks.esb/**/*" />
<fileset dir="${services.dir}/spring/build" includes="spring.esb/**/*"/>
<fileset dir="${services.dir}/spring/build" includes="spring.esb/**/*"/>
<fileset dir="${services.dir}/soap/build" includes="soap.esb/**/*"/>
+ <fileset dir="${services.dir}/soapui-client/target" includes="*.sar"/>
</copy>
</target>
Modified: labs/jbossesb/trunk/product/build.xml
===================================================================
--- labs/jbossesb/trunk/product/build.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/build.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -6,8 +6,9 @@
<!-- Set default properties filename -->
<property name="org.jboss.esb.properties" location="product.properties"/>
- <property name="org.jboss.esb.deployment.properties" location="install/deployment.properties"/>
+ <property name="org.jboss.esb.deployment.properties" location="install/deployment.properties"/>
+
<!-- Load Build Properties File -->
<property file="${org.jboss.esb.properties}"/>
<property file="${org.jboss.esb.deployment.properties}"/>
@@ -115,10 +116,10 @@
<target name="org.jboss.esb.compile"
depends="org.jboss.esb.internal.init, org.jboss.esb.rosetta.compile"/>
-
- <target name="org.jboss.esb.jar" depends="org.jboss.esb.internal.init, org.jboss.esb.rosetta.jar,
- org.jboss.soa.esb.services.jar"/>
+ <target name="org.jboss.esb.jar" depends="org.jboss.esb.internal.init, org.jboss.esb.rosetta.jar,
+ org.jboss.soa.esb.services.jar, extras.jar"/>
+
<target name="org.jboss.esb.rosetta.compile" depends="org.jboss.esb.internal.init">
<echo message="Compiling modules"/>
<ant dir="rosetta"/>
@@ -182,9 +183,16 @@
<echo message="Building *.esb archives"/>
<ant dir="services" target="esb"/>
</target>
-
- <target name="org.jboss.esb.javadocs"
- depends="org.jboss.esb.internal.init">
+
+ <target name="extras.jar">
+ <echo message="Building extras archives"/>
+ <property name="dist.extras" value="build/jbossesb/extras" />
+
+ <mkdir dir="${dist.extras}" />
+ <ant dir="extras/jaxbintros" />
+ </target>
+
+ <target name="org.jboss.esb.javadocs" depends="org.jboss.esb.internal.init" unless="skip.javadoc">
<echo message="Building javadocs"/>
<mkdir dir="${org.jboss.esb.internal.javadocs.dest}"/>
<path id="org.jboss.esb.internal.javadocs.path">
@@ -206,7 +214,7 @@
</target>
<target name="org.jboss.esb.samples.javadocs"
- depends="org.jboss.esb.internal.init">
+ depends="org.jboss.esb.internal.init" unless="skip.javadoc">
<echo message="Building samples javadocs"/>
<mkdir dir="${org.jboss.esb.internal.samples.javadocs.dest}"/>
<path id="org.jboss.esb.internal.samples.javadocs.path">
@@ -276,9 +284,65 @@
</target>
<!-- produce a product distribution -->
-
- <target name="org.jboss.esb.dist" depends="org.jboss.esb.install, org.jboss.esb.javadocs">
+ <target name="install.docs" unless="skip.docs">
+ <echo message="Installing docs"/>
+ <copy file="README_FIRST.txt" todir="${org.jboss.esb.installationdirectory}"/>
+ <copy file="../Contributors.txt" todir="${org.jboss.esb.installationdirectory}"/>
+
+ <mkdir dir="${org.jboss.esb.installationdirectory}/docs"/>
+ <copy todir="${org.jboss.esb.installationdirectory}/docs">
+ <fileset dir="docs">
+ <include name="*.pdf"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${org.jboss.esb.installationdirectory}/docs/tools"/>
+ <copy file="tools/configeditor/editor/docs/JBossESBConfigEditor.pdf" todir="${org.jboss.esb.installationdirectory}/docs/tools"/>
+
+ <mkdir dir="${org.jboss.esb.installationdirectory}/docs/services"/>
+ <copy
+ todir="${org.jboss.esb.installationdirectory}/docs/services"
+ >
+ <fileset dir="docs/services">
+ <include name="*.pdf"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${org.jboss.esb.installationdirectory}/docs/services"/>
+ <copy
+ todir="${org.jboss.esb.installationdirectory}/docs/JBossIDE"
+ >
+ <fileset dir="docs/JBossIDE">
+ <include name="*.pdf"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${org.jboss.esb.installationdirectory}/docs/wiki"/>
+ <copy
+ todir="${org.jboss.esb.installationdirectory}/docs/wiki"
+ >
+ <fileset dir="docs/wiki">
+ <include name="*.pdf"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="install.samples" unless="skip.samples">
+ <echo message="Installing samples"/>
+ <mkdir dir="${org.jboss.esb.installationdirectory}/samples"/>
+ <copy
+ todir="${org.jboss.esb.installationdirectory}/samples"
+ >
+ <fileset dir="samples">
+ <exclude name="**/*.pdf"/>
+ <exclude name="**/*.doc"/>
+ <exclude name="**/*.odg"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="org.jboss.esb.dist" depends="org.jboss.esb.install, org.jboss.esb.javadocs">
+
<echo message="Installation directory : ${org.jboss.esb.installationdirectory}"/>
<echo message="Installing jar files"/>
@@ -311,67 +375,13 @@
<echo message="Installing javadocs"/>
<mkdir dir="${org.jboss.esb.installationdirectory}/javadocs"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/javadocs"
- >
+ <copy todir="${org.jboss.esb.installationdirectory}/javadocs" failonerror="false">
<fileset dir="javadocs"/>
</copy>
-
- <echo message="Installing docs"/>
- <copy file="README_FIRST.txt" todir="${org.jboss.esb.installationdirectory}"/>
- <copy file="../Contributors.txt" todir="${org.jboss.esb.installationdirectory}"/>
-
- <mkdir dir="${org.jboss.esb.installationdirectory}/docs"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/docs"
- >
- <fileset dir="docs">
- <include name="*.pdf"/>
- </fileset>
- </copy>
-
- <mkdir dir="${org.jboss.esb.installationdirectory}/docs/tools"/>
- <copy file="tools/configeditor/editor/docs/JBossESBConfigEditor.pdf" todir="${org.jboss.esb.installationdirectory}/docs/tools"/>
-
- <mkdir dir="${org.jboss.esb.installationdirectory}/docs/services"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/docs/services"
- >
- <fileset dir="docs/services">
- <include name="*.pdf"/>
- </fileset>
- </copy>
-
- <mkdir dir="${org.jboss.esb.installationdirectory}/docs/services"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/docs/JBossIDE"
- >
- <fileset dir="docs/JBossIDE">
- <include name="*.pdf"/>
- </fileset>
- </copy>
-
- <mkdir dir="${org.jboss.esb.installationdirectory}/docs/wiki"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/docs/wiki"
- >
- <fileset dir="docs/wiki">
- <include name="*.pdf"/>
- </fileset>
- </copy>
-
- <echo message="Installing samples"/>
- <mkdir dir="${org.jboss.esb.installationdirectory}/samples"/>
- <copy
- todir="${org.jboss.esb.installationdirectory}/samples"
- >
- <fileset dir="samples">
- <exclude name="**/*.pdf"/>
- <exclude name="**/*.doc"/>
- <exclude name="**/*.odg"/>
- </fileset>
- </copy>
-
+
+ <antcall target="install.docs" />
+ <antcall target="install.samples" />
+
<ant antfile="build-distr.xml" target="dist" />
<copy todir="${org.jboss.esb.internal.jar.dest}">
<fileset dir="build" includes="jbossesb.sar/**"/>
@@ -416,7 +426,7 @@
</target>
<target name="dist" description="produces a product distribution">
- <runant target="org.jboss.esb.dist"/>
+ <runant target="org.jboss.esb.dist"/>
</target>
<target name="artifacts" depends="dist" description="Create disitribution artifacts for JBoss ESB">
Modified: labs/jbossesb/trunk/product/docs/MessageActionGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/extras/jaxbintros/build.xml
===================================================================
--- labs/jbossesb/trunk/product/extras/jaxbintros/build.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/extras/jaxbintros/build.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -6,14 +6,16 @@
<fileset dir="lib" includes="*.jar" />
</path>
- <target name="package">
+ <target name="package">
<mkdir dir="target/classes" />
<javac srcdir="src/main/java" destdir="target/classes" debug="on" >
<classpath refid="compile-classpath" />
</javac>
<jar basedir="target/classes" destfile="target/jboss-${ant.project.name}.jar" />
- </target>
+ <antcall target="copy.to.distro" />
+ </target>
+
<target name="test">
<mkdir dir="target/test/classes" />
<mkdir dir="target/test/report" />
@@ -21,6 +23,7 @@
<path id="test-compile-classpath">
<path refid="compile-classpath" />
<fileset dir="target" includes="*.jar" />
+ <fileset dir="../../lib/ext" includes="junit*.jar" />
</path>
<javac srcdir="src/test/java" destdir="target/test/classes" debug="on" classpathref="test-compile-classpath" />
<junit fork="yes" haltonfailure="true" haltonerror="true" showoutput="off">
@@ -37,6 +40,11 @@
</junit>
</target>
+ <target name="copy.to.distro" if="dist.extras">
+ <mkdir dir="../../${dist.extras}/jaxbintros" />
+ <copy file="target/jboss-${ant.project.name}.jar" todir="../../${dist.extras}/jaxbintros" />
+ </target>
+
<target name="clean">
<delete dir="target" />
</target>
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageDeliveryAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageDeliveryAdapter.java 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageDeliveryAdapter.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -208,7 +208,7 @@
try {
courier = getCourier(epr);
} catch (CourierException e) {
- logger.warn("Courier lookup failed for EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "].", e);
+ logger.debug("Courier lookup failed for EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "].", e);
} catch (MalformedEPRException e) {
logger.warn("Badly formed EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "]. " + e.getMessage());
} catch (Throwable t) {
@@ -237,7 +237,7 @@
}
}
} catch (CourierException e) {
- logger.warn("Badly formed EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "]. " + e.getMessage());
+ logger.debug("Badly formed EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "]. " + e.getMessage());
} catch (MalformedEPRException e) {
// Hmmmm???... Can this really happen? The Courier has already been created. Haven't we already validated the EPR during the Courier lookup (above)??
logger.warn("Unexpected error. Badly formed EPR [" + epr + "] for Service [" + serviceCategory + ":" + serviceName + "]. But the EPR has already been validated!!");
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/jboss-esb.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/test/jboss-esb.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -71,7 +71,7 @@
<property name="message"
value="[Quickstart_webservice_bpel] Message before invoking 'ABI_OrderManager' endpoint"/>
</action>
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.JBossWSAdapter">
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
<property name="jbossws-endpoint" value="ABI_OrderManager"/>
</action>
<action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
@@ -93,7 +93,7 @@
<property name="message"
value="[Quickstart_webservice_bpel] Message before invoking 'ABI_Shipping' endpoint"/>
</action>
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.JBossWSAdapter">
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
<property name="jbossws-endpoint" value="ABI_Shipping"/>
</action>
<action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/README.TXT
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/README.TXT 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/README.TXT 2007-07-03 16:19:04 UTC (rev 13044)
@@ -7,6 +7,9 @@
1. Exposing a Webservice interface for a Service that doesn't have a Webservice
interface (using the JBossWSAdapter action). In this example, the Service being exposed
is a legacy EJB based Order Management Service.
+ 3. How to use a jaxb-intros.xml config to "Introduce" JAXB Annotations on a Java interface/typeset
+ that isn't annotated for use with JAXB and how to add this config on a JBossWS
+ Webservice endpoint deployment.
2. Easily transforming a CSV based notification message into a Java object that's then used
to populate a SOAP request. See next.
3. Making an invocation on an external Webserivce from within an Action Processing
@@ -18,10 +21,11 @@
Before Running:
===============
Setting up JBoss App Server (v4.2.0GA):
- 1. Update the "org.jboss.esb.server.home" property in the quickstarts.properties
+ 1. Stop the JBoss App Server.
+ 2. Update the "org.jboss.esb.server.home" property in the quickstarts.properties
file in "../conf".
- 2. Make sure you're running the ESB on JBoss AS v4.2.0GA.
- 3. Make sure the following ESB components are deployed to your JBoss AS. These
+ 3. Make sure you're running the ESB on JBoss AS v4.2.0GA.
+ 4. Make sure the following ESB components are deployed to your JBoss AS. These
components can be located in the "lib" folder of the distro (build/jbossesb/lib
if you are working from the SVN source).
a) jbossesb.esb
@@ -29,8 +33,8 @@
c) soap.esb
d) soapui-client.sar
e) smooks.esb
- 4. Delete the jbm-queue-service.xml file from jbossesb.esb and smooks.esb.
- 5. Checkout, build and deploy JBossWS 2.0.x from http://anonsvn.jboss.org/repos/jbossws/branches/jbossws-2.0
+ 5. Delete the jbm-queue-service.xml file from jbossesb.esb and smooks.esb.
+ 6. Checkout, build and deploy JBossWS 2.0.x from http://anonsvn.jboss.org/repos/jbossws/branches/jbossws-2.0
To build and deploy JBossWS 2.0.0 follow the instructions on http://www.jboss.org/index.html?module=bb&op=viewtopic&t=109659.
NOTES:
a) You need to copy build/ant.properties.example to build/ant.properties and
@@ -38,15 +42,17 @@
b) You need to target your build for JBoss AS v4.2.0GA, so build and deploy using the
"deploy-jboss42" target.
c) Once deployed, go to jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml on your
- App Server and add the following bean configuration:
+ App Server and add the following bean config. Add it just before the
+ "WSEndpointHandlerDeployer" bean config:
"<bean name="WSEndpointJAXBIntrosCustomizationsDeployer"
class="org.jboss.wsf.spi.deployment.JAXBIntrosCustomizationsDeployer" />"
- d) Again in jboss-beans.xml, add a reference to the above bean config in the
+ d) Again in jboss-beans.xml, add an "inject" element for the above bean config in the
deployer list configured on the "WSMainDeployerManager" bean. E.g.:
"<inject bean="WSEndpointJAXBIntrosCustomizationsDeployer"/>"
- 6. Run the ant script in product/extras/jaxbintros and copy the build output jar
- (product/extras/jaxbintros/target/jboss-jaxb-intros.jar) to the root of the jbossws.sar
- service on your AS.
+ Add this before the "inject" element for the "WSEndpointHandlerDeployer" bean.
+ e) Copy "jbossesb/extras/jaxbintros/jboss-jaxb-intros.jar" to the root of the jbossws.sar
+ service on your JBoss App Server. Note that if you haven't already done this you'll
+ need to stop and restart the the App Server.
7. Start the JBoss App Server.
Setting up ActiveBPEL:
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/jboss-esb.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_bpel/jboss-esb.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -71,7 +71,7 @@
<property name="message"
value="[Quickstart_webservice_bpel] Message before invoking 'ABI_OrderManager' endpoint"/>
</action>
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.JBossWSAdapter">
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
<property name="jbossws-endpoint" value="ABI_OrderManager"/>
</action>
<action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
@@ -93,7 +93,7 @@
<property name="message"
value="[Quickstart_webservice_bpel] Message before invoking 'ABI_Shipping' endpoint"/>
</action>
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.JBossWSAdapter">
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
<property name="jbossws-endpoint" value="ABI_Shipping"/>
</action>
<action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/jboss-esb.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/jboss-esb.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -42,7 +42,7 @@
<property name="message"
value="[Quickstart_webservice_jbossws_adapter_01] Message before invoking jbossws endpoint"/>
</action>
- <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.JBossWSAdapter">
+ <action name="JBossWSAdapter" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
<property name="jbossws-endpoint" value="GoodbyeWorldWS"/>
</action>
<action name="print-after" class="org.jboss.soa.esb.actions.SystemPrintln">
@@ -52,18 +52,6 @@
</actions>
</service>
- <!-- service category="AnotherServiceCategory" name="AnotherService" description="WS Frontend speaks natively to the ESB">
-
- <listeners>
- <jms-listener name="JMS-ESBListener" busidref="quickstartEsbChannel" maxThreads="1"/>
- </listeners>
- <actions>
- <action name="print-before" class="org.jboss.soa.esb.actions.SystemPrintln">
- <property name="message"
- value="[Quickstart_webservice_jbossws_adapter_01] Message before invoking jbossws endpoint"/>
- </action>
- </actions>
- </service -->
</services>
</jbossesb>
Modified: labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/src/org/jboss/soa/esb/samples/quickstart/webservicejbosswsadapter01/webservice/GoodbyeWorldWS.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/src/org/jboss/soa/esb/samples/quickstart/webservicejbosswsadapter01/webservice/GoodbyeWorldWS.java 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/samples/quickstarts/webservice_jbossws_adapter_01/src/org/jboss/soa/esb/samples/quickstart/webservicejbosswsadapter01/webservice/GoodbyeWorldWS.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -6,7 +6,7 @@
import javax.jws.soap.SOAPBinding;
import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.actions.soap.JBossWSAdapter;
+import org.jboss.soa.esb.actions.soap.SOAPProcessor;
/**
* @author
@@ -18,7 +18,7 @@
@WebMethod
public String sayGoodbye(@WebParam(name="message") String message) {
- Message esbMessage = JBossWSAdapter.getMessage();
+ Message esbMessage = SOAPProcessor.getMessage();
if(esbMessage != null) {
System.out.println("**** Message set on ThreadLocal");
}
@@ -29,7 +29,7 @@
@WebMethod
public void sayGoodbyeWithoutResponse(@WebParam(name="message") String message) {
- Message esbMessage = JBossWSAdapter.getMessage();
+ Message esbMessage = SOAPProcessor.getMessage();
if(esbMessage != null) {
System.out.println("**** Message set on ThreadLocal");
}
Deleted: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -1,191 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import org.jboss.internal.soa.esb.publish.Publish;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
-import org.jboss.soa.esb.actions.ActionProcessingException;
-import org.jboss.soa.esb.actions.ActionUtils;
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.BasicInvocationContext;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.management.EndpointRegistry;
-import org.jboss.wsf.spi.management.EndpointRegistryFactory;
-
-/**
- * JBoss Webservices endpoint adapter.
- * <p/>
- * This action supports invocation of a JBossWS hosted webservice endpoint through any JBossESB hosted
- * listener. This means the ESB can be used to expose Webservice endpoints for Services that don't
- * already expose a Webservice endpoint. You can do this by writing a thin Service Wrapper Webservice
- * (e.g. a JSR 181 implementation) that wraps calls to the target Service (that doesn't have a Webservice endpoint),
- * exposing that Service via endpoints (listeners) running on the ESB. This also means that these Services
- * are invocable over any transport channel supported by the ESB (http, ftp, jms etc).
- *
- * <h3>Webservice Endpoint Deployment</h3>
- * Any JBossWS Webservice endpoint can be exposed via ESB listeners using this action. That includes endpoints that are deployed
- * from inside (i.e. the Webservice .war is bundled inside the .esb) and outside (e.g. standalone Webservice .war deployments,
- * Webservice .war deployments bundled inside a .ear) a .esb deployment.
- *
- * <h3>"ESB Message Aware" Webservice Endpoints</h3>
- * Note that Webservice endpoints exposed via this action have direct access to the current
- * JBossESB {@link org.jboss.soa.esb.message.Message} instance used to invoke this action's
- * {@link #process(org.jboss.soa.esb.message.Message)} method. It can access
- * the current {@link org.jboss.soa.esb.message.Message} instance via the {@link #getMessage()} method
- * and can change the {@link org.jboss.soa.esb.message.Message} instance via the
- * {@link #setMessage(org.jboss.soa.esb.message.Message)} method. This means that Webservice endpoints
- * exposed via this action are "ESB Message Aware".
- *
- * <h3>Action Configuration</h3>
- *
- *
- * <h3>Quickstarts</h3>
- * A number of quickstarts that demonstrate how to use this action are available in the JBossESB
- * distribution (samples/quickstarts). See the "webservice_jbossws_adapter_01" and "webservice_bpel"
- * quickstarts.
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
- at Publish(JBossWSAdapterContractPublisher.class)
-public class JBossWSAdapter extends AbstractActionPipelineProcessor {
-
- public static final String JBOSSWS_ENDPOINT = "jbossws-endpoint";
-
- private static ThreadLocal<Message> messageTL = new ThreadLocal<Message>();
- private String jbossws_endpoint;
-
- /**
- * Public constructor.
- * @param config Configuration.
- * @throws ConfigurationException "jbossws-endpoint" not specified.
- */
- public JBossWSAdapter(ConfigTree config) throws ConfigurationException {
- jbossws_endpoint = config.getRequiredAttribute(JBOSSWS_ENDPOINT);
- }
-
- /**
- * Process the SOAP message.
- * <p/>
- * Invokes the JBossWS endpoint and writes the SOAP response back into the message payload.
- * @param message The ESB Aware (normalized) SOAP request message.
- * @return The SOAP response message.
- * @throws ActionProcessingException
- */
- public Message process(Message message) throws ActionProcessingException {
- Endpoint endpoint = getServiceEndpoint(jbossws_endpoint);
- byte[] soapMessage;
-
- if(endpoint == null) {
- throw new ActionProcessingException("Unknown Service Endpoint '" + jbossws_endpoint + "'.");
- }
-
- soapMessage = getSOAPMessagePayload(message);
- try {
- messageTL.set(message);
-
- RequestHandler requestHandler = endpoint.getRequestHandler();
- InvocationContext invocationContext = new BasicInvocationContext();
- ByteArrayOutputStream os = new ByteArrayOutputStream();
-
- requestHandler.handleRequest(endpoint, new ByteArrayInputStream(soapMessage), os, invocationContext);
-
- ActionUtils.setTaskObject(message, new String(os.toByteArray()).trim());
- }
- catch (Exception ex) {
- throw new ActionProcessingException("Cannot process SOAP request", ex);
- } finally {
- // Get the message instance set on the Threadlocal before removing it. The Webservice endpoint
- // may have reset it with a new Message instance.
- message = messageTL.get();
- messageTL.remove();
- }
-
- return message;
- }
-
- private byte[] getSOAPMessagePayload(Message message) throws ActionProcessingException {
- byte[] soapMessage;
- Object messagePayload = ActionUtils.getTaskObject(message);
- if(messagePayload instanceof byte[]) {
- soapMessage = (byte[])messagePayload;
- } else if(messagePayload instanceof String) {
- try {
- soapMessage = ((String)messagePayload).getBytes("UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new ActionProcessingException("Unable to decode SOAP message payload.", e);
- }
- } else {
- throw new ActionProcessingException("Unable to decode SOAP message payload. Must be either a byte[] or java.lang.String.");
- }
- return soapMessage;
- }
-
- /**
- * Set the {@link org.jboss.soa.esb.message.Message} instance for this invocation context.
- * <p/>
- * This allows message aware Webservice endpoints modify the {@link org.jboss.soa.esb.message.Message}
- * instance for the current Action Processing Pipeline.
- *
- * @param message The new message instance.
- */
- public static void setMessage(final Message message) {
- messageTL.set(message);
- }
-
- /**
- * Get the {@link org.jboss.soa.esb.message.Message} instance for this invocation context.
- *
- * @return The message instance.
- */
- public static Message getMessage() {
- return messageTL.get();
- }
-
- /**
- * Get the Service Endpoint based on the endpoint name.
- * @param endpointName Service Endpoint name.
- * @return The service endpoint, or null if the endpoint is not found.
- */
- protected static Endpoint getServiceEndpoint(String endpointName) {
- EndpointRegistry registry = EndpointRegistryFactory.getEndpointRegistry();
- Set<ObjectName> objectNames = registry.getEndpoints();
-
- for (ObjectName objectName : objectNames) {
- String endpoint = objectName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
-
- if (endpoint != null && endpoint.equals(endpointName)) {
- return registry.getEndpoint(objectName);
- }
- }
-
- return null;
- }
-}
\ No newline at end of file
Deleted: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.actions.soap;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.util.List;
-
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
-import org.jboss.internal.soa.esb.publish.ContractInfo;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.addressing.EPR;
-import org.jboss.soa.esb.dom.YADOMUtil;
-import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
-import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.invocation.BasicInvocationContext;
-import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.invocation.RequestHandler;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Contract publisher for a JBossWS endpoint.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBossWSAdapterContractPublisher implements ActionContractPublisher {
-
- private String endpointName;
-
- /**
- * Set the JBossWS action configuration.
- * @param actionConfig action config.
- * @throws ConfigurationException Bad config.
- */
- public void setActionConfig(Action actionConfig) throws ConfigurationException {
- List<Property> properties = actionConfig.getPropertyList();
-
- for(Property property : properties) {
- if(property.getName().equals(JBossWSAdapter.JBOSSWS_ENDPOINT)) {
- endpointName = property.getValue();
- break;
- }
- }
-
- if(endpointName == null) {
- throw new ConfigurationException("Property '" + JBossWSAdapter.JBOSSWS_ENDPOINT + "' not specified.");
- }
- }
-
- /**
- * Get the contract configuration.
- * <p/>
- * This method impl basically returns the JBossWS WSDL, modified for
- * the supplied EPR and its channel.
- *
- * @param epr Endpoint EPR.
- * @return WSDL Contract.
- */
- public ContractInfo getContractInfo(EPR epr) {
- Endpoint endpoint = JBossWSAdapter.getServiceEndpoint(endpointName);
- RequestHandler requestHandler = endpoint.getRequestHandler();
- InvocationContext invocationContext = new BasicInvocationContext();
- ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
-
- try {
- // Generate the WSDL...
- requestHandler.handleWSDLRequest(endpoint, wsdlStream, invocationContext);
- String wsdl = updateWsdl(new String(wsdlStream.toByteArray()), epr);
-
- return new ContractInfo("text/xml", wsdl);
- } catch (Exception e) {
- return new ContractInfo("text/plain", "Unavailable: " + e.getMessage());
- }
- }
-
- /**
- * Update the supplied wsdl to take account of the ESB endpoint proxying of the JBossWS
- * invocation, as well as the fact that the transport may be different.
- *
- * @param wsdl WSDL input.
- * @param epr The SOAP endpoint from the ESB perspective.
- * @return The updated WSDL.
- */
- protected String updateWsdl(String wsdl, EPR epr) throws SAXException, IOException, ConfigurationException {
- URI endpointURI = URI.create(epr.getAddr().getAddress());
- ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
-
- // Now, fudge it to fix up the binding transport and endpoint addressing info...
- Document wsdlDoc = YADOMUtil.parseStream(new ByteArrayInputStream(wsdl.getBytes("UTF-8")), false, false);
- Attr transport = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/binding/binding/@transport");
- Attr address = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/service/port/address/@location");
-
- // TODO: Doubt this is the correct thing to do!!
- transport.setNodeValue("http://schemas.xmlsoap.org/soap/" + endpointURI.getScheme());
- address.setNodeValue(endpointURI.toString());
-
- YADOMUtil.serialize(wsdlDoc, new StreamResult(wsdlStream), true);
-
- return new String(wsdlStream.toByteArray()).trim();
- }
-}
Copied: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java (from rev 13003, labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapter.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.jboss.internal.soa.esb.publish.Publish;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.actions.ActionUtils;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.BasicInvocationContext;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.management.EndpointRegistry;
+import org.jboss.wsf.spi.management.EndpointRegistryFactory;
+
+/**
+ * JBoss Webservices SOAP Processor.
+ * <p/>
+ * This action supports invocation of a JBossWS hosted webservice endpoint through any JBossESB hosted
+ * listener. This means the ESB can be used to expose Webservice endpoints for Services that don't
+ * already expose a Webservice endpoint. You can do this by writing a thin Service Wrapper Webservice
+ * (e.g. a JSR 181 implementation) that wraps calls to the target Service (that doesn't have a Webservice endpoint),
+ * exposing that Service via endpoints (listeners) running on the ESB. This also means that these Services
+ * are invocable over any transport channel supported by the ESB (http, ftp, jms etc).
+ *
+ * <h3>"ESB Message Aware" Webservice Endpoints</h3>
+ * Note that Webservice endpoints exposed via this action have direct access to the current
+ * JBossESB {@link org.jboss.soa.esb.message.Message} instance used to invoke this action's
+ * {@link #process(org.jboss.soa.esb.message.Message)} method. It can access
+ * the current {@link org.jboss.soa.esb.message.Message} instance via the {@link #getMessage()} method
+ * and can change the {@link org.jboss.soa.esb.message.Message} instance via the
+ * {@link #setMessage(org.jboss.soa.esb.message.Message)} method. This means that Webservice endpoints
+ * exposed via this action are "ESB Message Aware".
+ *
+ * <h3>Webservice Endpoint Deployment</h3>
+ * Any JBossWS Webservice endpoint can be exposed via ESB listeners using this action. That includes endpoints that are deployed
+ * from inside (i.e. the Webservice .war is bundled inside the .esb) and outside (e.g. standalone Webservice .war deployments,
+ * Webservice .war deployments bundled inside a .ear) a .esb deployment.
+ *
+ * <div style="margin-left: 20">
+ * <h4>JAXB Introductions</h4>
+ * The naitive JBossWS SOAP stack uses JAXB to bind to and from SOAP. This typically means that an unannotated typeset
+ * could not be used to build a JSR 181 endpoint on JBossWS. To overcome this we use a JBossESB and JBossWS feature
+ * called "JAXB Introductions" which basically means you can define an XML configuration to "Introduce" the JAXB Annotations.
+ * For more on this, see the Webservices Guide.
+ * </div>
+ *
+ * <h3>Action Configuration</h3>
+ * The <action ... /> configuration for this action is very straightforward. The action just takes one
+ * property value, which is the name of the JBossWS endpoint it's exposing (invoking).
+ *
+ * <pre>
+ * <action name="ShippingProcessor" class="org.jboss.soa.esb.actions.soap.SOAPProcessor">
+ * <property name="<b>jbossws-endpoint</b>" value="<b>ABI_Shipping</b>"/>
+ * </action>
+ * </pre>
+ *
+ * <h3>Quickstarts</h3>
+ * A number of quickstarts that demonstrate how to use this action are available in the JBossESB
+ * distribution (samples/quickstarts). See the "webservice_jbossws_adapter_01" and "webservice_bpel"
+ * quickstarts.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+ at Publish(WebserviceContractPublisher.class)
+public class SOAPProcessor extends AbstractActionPipelineProcessor {
+
+ public static final String JBOSSWS_ENDPOINT = "jbossws-endpoint";
+
+ private static ThreadLocal<Message> messageTL = new ThreadLocal<Message>();
+ private String jbossws_endpoint;
+
+ /**
+ * Public constructor.
+ * @param config Configuration.
+ * @throws ConfigurationException "jbossws-endpoint" not specified.
+ */
+ public SOAPProcessor(ConfigTree config) throws ConfigurationException {
+ jbossws_endpoint = config.getRequiredAttribute(JBOSSWS_ENDPOINT);
+ }
+
+ /**
+ * Process the SOAP message.
+ * <p/>
+ * Invokes the JBossWS endpoint and writes the SOAP response back into the message payload.
+ * @param message The ESB Aware (normalized) SOAP request message.
+ * @return The SOAP response message.
+ * @throws ActionProcessingException
+ */
+ public Message process(Message message) throws ActionProcessingException {
+ Endpoint endpoint = getServiceEndpoint(jbossws_endpoint);
+ byte[] soapMessage;
+
+ if(endpoint == null) {
+ throw new ActionProcessingException("Unknown Service Endpoint '" + jbossws_endpoint + "'.");
+ }
+
+ soapMessage = getSOAPMessagePayload(message);
+ try {
+ messageTL.set(message);
+
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ InvocationContext invocationContext = new BasicInvocationContext();
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ requestHandler.handleRequest(endpoint, new ByteArrayInputStream(soapMessage), os, invocationContext);
+
+ ActionUtils.setTaskObject(message, new String(os.toByteArray()).trim());
+ }
+ catch (Exception ex) {
+ throw new ActionProcessingException("Cannot process SOAP request", ex);
+ } finally {
+ // Get the message instance set on the Threadlocal before removing it. The Webservice endpoint
+ // may have reset it with a new Message instance.
+ message = messageTL.get();
+ messageTL.remove();
+ }
+
+ return message;
+ }
+
+ private byte[] getSOAPMessagePayload(Message message) throws ActionProcessingException {
+ byte[] soapMessage;
+ Object messagePayload = ActionUtils.getTaskObject(message);
+ if(messagePayload instanceof byte[]) {
+ soapMessage = (byte[])messagePayload;
+ } else if(messagePayload instanceof String) {
+ try {
+ soapMessage = ((String)messagePayload).getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new ActionProcessingException("Unable to decode SOAP message payload.", e);
+ }
+ } else {
+ throw new ActionProcessingException("Unable to decode SOAP message payload. Must be either a byte[] or java.lang.String.");
+ }
+ return soapMessage;
+ }
+
+ /**
+ * Set the {@link org.jboss.soa.esb.message.Message} instance for this invocation context.
+ * <p/>
+ * This allows message aware Webservice endpoints modify the {@link org.jboss.soa.esb.message.Message}
+ * instance for the current Action Processing Pipeline.
+ *
+ * @param message The new message instance.
+ */
+ public static void setMessage(final Message message) {
+ messageTL.set(message);
+ }
+
+ /**
+ * Get the {@link org.jboss.soa.esb.message.Message} instance for this invocation context.
+ *
+ * @return The message instance.
+ */
+ public static Message getMessage() {
+ return messageTL.get();
+ }
+
+ /**
+ * Get the Service Endpoint based on the endpoint name.
+ * @param endpointName Service Endpoint name.
+ * @return The service endpoint, or null if the endpoint is not found.
+ */
+ protected static Endpoint getServiceEndpoint(String endpointName) {
+ EndpointRegistry registry = EndpointRegistryFactory.getEndpointRegistry();
+ Set<ObjectName> objectNames = registry.getEndpoints();
+
+ for (ObjectName objectName : objectNames) {
+ String endpoint = objectName.getKeyProperty(Endpoint.SEPID_PROPERTY_ENDPOINT);
+
+ if (endpoint != null && endpoint.equals(endpointName)) {
+ return registry.getEndpoint(objectName);
+ }
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/SOAPProcessor.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java (from rev 13003, labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisher.java)
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java (rev 0)
+++ labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.actions.soap;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.internal.soa.esb.publish.ActionContractPublisher;
+import org.jboss.internal.soa.esb.publish.ContractInfo;
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.soa.esb.addressing.EPR;
+import org.jboss.soa.esb.dom.YADOMUtil;
+import org.jboss.soa.esb.listeners.config.ActionDocument.Action;
+import org.jboss.soa.esb.listeners.config.PropertyDocument.Property;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.BasicInvocationContext;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * Contract publisher for a Webservice endpoint.
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class WebserviceContractPublisher implements ActionContractPublisher {
+
+ private String endpointName;
+
+ /**
+ * Set the {@link SOAPProcessor} action configuration.
+ * @param actionConfig action config.
+ * @throws ConfigurationException Bad config.
+ */
+ public void setActionConfig(Action actionConfig) throws ConfigurationException {
+ List<Property> properties = actionConfig.getPropertyList();
+
+ for(Property property : properties) {
+ if(property.getName().equals(SOAPProcessor.JBOSSWS_ENDPOINT)) {
+ endpointName = property.getValue();
+ break;
+ }
+ }
+
+ if(endpointName == null) {
+ throw new ConfigurationException("Property '" + SOAPProcessor.JBOSSWS_ENDPOINT + "' not specified.");
+ }
+ }
+
+ /**
+ * Get the contract configuration.
+ * <p/>
+ * This method impl basically returns the Endpoint WSDL, modified for
+ * the supplied EPR and its channel.
+ *
+ * @param epr Endpoint EPR.
+ * @return WSDL Contract.
+ */
+ public ContractInfo getContractInfo(EPR epr) {
+ Endpoint endpoint = SOAPProcessor.getServiceEndpoint(endpointName);
+ RequestHandler requestHandler = endpoint.getRequestHandler();
+ InvocationContext invocationContext = new BasicInvocationContext();
+ ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
+
+ try {
+ // Generate the WSDL...
+ requestHandler.handleWSDLRequest(endpoint, wsdlStream, invocationContext);
+ String wsdl = updateWsdl(new String(wsdlStream.toByteArray()), epr);
+
+ return new ContractInfo("text/xml", wsdl);
+ } catch (Exception e) {
+ return new ContractInfo("text/plain", "Unavailable: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Update the supplied wsdl to take account of the ESB endpoint proxying of the JBossWS
+ * invocation, as well as the fact that the transport may be different.
+ *
+ * @param wsdl WSDL input.
+ * @param epr The SOAP endpoint from the ESB perspective.
+ * @return The updated WSDL.
+ */
+ protected String updateWsdl(String wsdl, EPR epr) throws SAXException, IOException, ConfigurationException {
+ URI endpointURI = URI.create(epr.getAddr().getAddress());
+ ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
+
+ // Now, fudge it to fix up the binding transport and endpoint addressing info...
+ Document wsdlDoc = YADOMUtil.parseStream(new ByteArrayInputStream(wsdl.getBytes("UTF-8")), false, false);
+ Attr transport = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/binding/binding/@transport");
+ Attr address = (Attr) YADOMUtil.getNode(wsdlDoc, "/definitions/service/port/address/@location");
+
+ // TODO: Doubt this is the correct thing to do!!
+ transport.setNodeValue("http://schemas.xmlsoap.org/soap/" + endpointURI.getScheme());
+ address.setNodeValue(endpointURI.toString());
+
+ YADOMUtil.serialize(wsdlDoc, new StreamResult(wsdlStream), true);
+
+ return new String(wsdlStream.toByteArray()).trim();
+ }
+}
Property changes on: labs/jbossesb/trunk/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/WebserviceContractPublisher.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/services/soap/src/test/java/org/jboss/soa/esb/actions/soap/JBossWSAdapterContractPublisherUnitTest.java 2007-07-03 16:19:04 UTC (rev 13044)
@@ -38,7 +38,7 @@
private Logger log = Logger .getLogger( JBossWSAdapterContractPublisherUnitTest.class );
public void test() throws ConfigurationException, IOException, SAXException {
- JBossWSAdapterContractPublisher publisher = new JBossWSAdapterContractPublisher();
+ WebserviceContractPublisher publisher = new WebserviceContractPublisher();
String wsdlIn = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-in.wsdl")));
String wsdlOutExpected = new String(StreamUtils.readStream(getClass().getResourceAsStream("test-out-expected.wsdl")));
EPR epr = new EPR(URI.create("socket://x.y.x:8989/"));
Modified: labs/jbossesb/trunk/product/services/soapui-client/build.xml
===================================================================
--- labs/jbossesb/trunk/product/services/soapui-client/build.xml 2007-07-03 14:55:36 UTC (rev 13043)
+++ labs/jbossesb/trunk/product/services/soapui-client/build.xml 2007-07-03 16:19:04 UTC (rev 13044)
@@ -58,7 +58,7 @@
</copy>
<jar jarfile="${maven.build.directory}/${maven.build.final.name}.sar" basedir="${maven.build.directory}/sar" />
- <copy file="${maven.build.directory}/${maven.build.final.name}.sar" todir="../../build/services" />
+ <copy file="${maven.build.directory}/${maven.build.final.name}.sar" todir="../../build/jbossesb/lib" />
</target>
<target name="compile-tests" depends="junit-present, compile" description="Compile the test code"
if="junit.present">
More information about the jboss-svn-commits
mailing list