[jboss-svn-commits] JBL Code SVN: r26890 - labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/webservice_producer/src/org/jboss/soa/esb/samples/quickstart/webserviceproducer/test.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jun 9 11:28:16 EDT 2009


Author: tfennelly
Date: 2009-06-09 11:28:15 -0400 (Tue, 09 Jun 2009)
New Revision: 26890

Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/webservice_producer/src/org/jboss/soa/esb/samples/quickstart/webserviceproducer/test/SendMessage.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2612
webservice_producer is using JBR Client to make HTTP invocation on SOAPProcessor based Service

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/webservice_producer/src/org/jboss/soa/esb/samples/quickstart/webserviceproducer/test/SendMessage.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/webservice_producer/src/org/jboss/soa/esb/samples/quickstart/webserviceproducer/test/SendMessage.java	2009-06-09 14:41:04 UTC (rev 26889)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/samples/quickstarts/webservice_producer/src/org/jboss/soa/esb/samples/quickstart/webserviceproducer/test/SendMessage.java	2009-06-09 15:28:15 UTC (rev 26890)
@@ -21,8 +21,15 @@
 package org.jboss.soa.esb.samples.quickstart.webserviceproducer.test;
 
 import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.remoting.HttpMarshaller;
+import org.jboss.internal.soa.esb.remoting.HttpUnmarshaller;
 import org.jboss.remoting.InvokerLocator;
 import org.jboss.remoting.Client;
+import org.jboss.remoting.serialization.SerializationStreamFactory;
+import org.jboss.remoting.marshal.MarshalFactory;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.http.HTTPMarshaller;
+import org.jboss.remoting.marshal.http.HTTPUnMarshaller;
 
 import javax.jms.JMSException;
 import javax.jms.ObjectMessage;
@@ -34,6 +41,10 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import java.net.InetAddress;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.Map;
 
 import org.jboss.soa.esb.actions.StoreMessageToFile;
 
@@ -110,6 +121,9 @@
     	SendMessage sm = new SendMessage();
         String msg = getMessage("01");
 
+        // Set the marshallers. See See https://jira.jboss.org/jira/browse/JBESB-2612
+        MarshalFactory.addMarshaller(HTTPMarshaller.DATATYPE, new HTTPMarshaller(), new JBRServerHttpUnmarshaller());
+
         String protocol = args[0];
         if(protocol.equals("jms")) {
             sm.sendMessageOverJMS(msg);
@@ -117,4 +131,21 @@
             sm.sendMessageToJBRListener(protocol, Integer.parseInt(args[1]), msg);
         }
     }
+
+    /**
+     * See https://jira.jboss.org/jira/browse/JBESB-2612 
+     */
+    public static class JBRServerHttpUnmarshaller extends HTTPUnMarshaller {
+        public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException {
+            // We know we are talking to a JBR Server and that it will return an InvocationResponse...
+            ObjectInputStream ois = (ObjectInputStream) getMarshallingStream(inputStream, null);
+            return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, customClassLoader, version);
+        }
+
+        public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException {
+            JBRServerHttpUnmarshaller clone = new JBRServerHttpUnmarshaller();
+            clone.setClassLoader(customClassLoader);
+            return clone;
+        }
+    }
 }




More information about the jboss-svn-commits mailing list