You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by di...@apache.org on 2007/08/09 02:51:42 UTC
svn commit: r564061 [10/15] - in
/webservices/sandesha/branches/sandesha2/java/1_3: ./ modules/client/
modules/core/ modules/core/src/main/java/org/apache/sandesha2/
modules/core/src/main/java/org/apache/sandesha2/client/
modules/core/src/main/java/org...
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/module.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/module.xml?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/module.xml (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/module.xml Wed Aug 8 17:51:29 2007
@@ -1,156 +1,156 @@
-<module name="sandesha2" class="org.apache.sandesha2.SandeshaModule">
-
- <Description>
- This module implements WS-ReliableMessaging for Axis2. This implements both the WSRM submitted spec and up to the version CD4 of the new WSRM 1.1 spec.
- </Description>
-
- <InFlow>
- <handler name="SandeshaGlobalInHandler" class="org.apache.sandesha2.handlers.SandeshaGlobalInHandler">
- <!-- Global In handler should come before addressing dispatching -->
- <order phase="Dispatch" phaseFirst="true"/>
- </handler>
-
- <handler name="SequenceIDDispatcher" class="org.apache.sandesha2.handlers.SequenceIDDispatcher">
- <order phase="Addressing" before="AddressingBasedDispatcher" />
- </handler>
-
- <handler name="SandeshaInHandler" class="org.apache.sandesha2.handlers.SandeshaInHandler">
- <order phase="RMPhase"/>
- </handler>
- </InFlow>
-
- <OutFlow>
- <handler name="SandeshaOutHandler" class="org.apache.sandesha2.handlers.SandeshaOutHandler">
- <order phase="RMPhase"/>
- </handler>
- </OutFlow>
-
- <InFaultFlow>
- <handler name="SandeshaGlobalInHandler" class="org.apache.sandesha2.handlers.SandeshaGlobalInHandler">
- <!-- Global In handler should come before instance dispatching -->
- <order phase="Dispatch" before="InstanceDispatcher" />
- </handler>
- <handler name="SandeshaInHandler" class="org.apache.sandesha2.handlers.SandeshaInHandler">
- <order phase="RMPhase"/>
- </handler>
- </InFaultFlow>
-
- <OutFaultFlow>
- <handler name="SandeshaOutHandler" class="org.apache.sandesha2.handlers.SandeshaOutHandler">
- <order phase="RMPhase"/>
- </handler>
- </OutFaultFlow>
-
- <operation name="Sandesha2OperationInOnly" mep="http://www.w3.org/2006/01/wsdl/in-only">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
-
- <!-- namespaces for the 2005-02 spec -->
- <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement</actionMapping>
-
- <!-- For interopability purposes. Some WSRM implementations tend to send this as the LastMessage -->
- <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage</actionMapping>
-
- <!-- namespaces for the 2007-02 spec -->
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement</actionMapping>
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/fault</actionMapping>
-
- <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence</actionMapping>
- </operation>
-
- <operation name="Sandesha2OperationInOut" mep="http://www.w3.org/2006/01/wsdl/in-out">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
-
- <!-- namespaces for the 2005-02 spec -->
- <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</actionMapping>
- <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested</actionMapping>
-
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested</actionMapping>
-
- <!-- namespaces for the 2007-02 spec -->
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence</actionMapping>
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence</actionMapping>
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequence</actionMapping>
- <actionMapping>http://docs.oasis-open.org/ws-rx/wsmc/200702/MakeConnection</actionMapping>
- </operation>
-
- <operation name="Sandesha2OperationOutOnly" mep="http://www.w3.org/2006/01/wsdl/out-only">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
- </operation>
- <operation name="Sandesha2OperationOutIn" mep="http://www.w3.org/2006/01/wsdl/out-in">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
- </operation>
-
- <operation name="Sandesha2OperationDuplicateInOnly" mep="http://www.w3.org/2006/01/wsdl/in-only">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
- </operation>
-
- <operation name="Sandesha2OperationDuplicateInOut" mep="http://www.w3.org/2006/01/wsdl/in-out">
- <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
- </operation>
-
- <supported-policy-namespaces namespaces="http://ws.apache.org/sandesha2/policy" />
-
- <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:sandesha2="http://ws.apache.org/sandesha2/policy" wsu:Id="RMPolicy">
- <sandesha2:RMAssertion>
- <wsp:Policy>
- <sandesha2:AcknowledgementInterval>3000</sandesha2:AcknowledgementInterval>
-
- <sandesha2:RetransmissionInterval>6000</sandesha2:RetransmissionInterval>
-
- <!-- '-1' conveys that there is no limit to the max. number of retransmissions.-->
- <sandesha2:MaximumRetransmissionCount>10</sandesha2:MaximumRetransmissionCount>
-
- <sandesha2:ExponentialBackoff>false</sandesha2:ExponentialBackoff>
-
- <sandesha2:InactivityTimeout>60</sandesha2:InactivityTimeout>
-
- <sandesha2:InactivityTimeoutMeasure>seconds</sandesha2:InactivityTimeoutMeasure>
-
- <!-- Once a sequence has been marked as deleted, or timed out, this is the length of time that the
- sequence will remain before all sequence state is totally removed -->
- <sandesha2:SequenceRemovalTimeout>600</sandesha2:SequenceRemovalTimeout>
-
- <sandesha2:SequenceRemovalTimeoutMeasure>seconds</sandesha2:SequenceRemovalTimeoutMeasure>
-
- <sandesha2:InvokeInOrder>true</sandesha2:InvokeInOrder>
-
- <!-- These will not be overriden by service level policies -->
- <sandesha2:MessageTypesToDrop>none</sandesha2:MessageTypesToDrop>
-
- <!-- This will not be overriden by service level policies -->
- <sandesha2:StorageManagers>
-
- <sandesha2:InMemoryStorageManager>
- org.apache.sandesha2.storage.inmemory.InMemoryStorageManager
- </sandesha2:InMemoryStorageManager>
-
- <sandesha2:PermanentStorageManager>
- org.apache.sandesha2.storage.inmemory.InMemoryStorageManager
- </sandesha2:PermanentStorageManager>
-
- </sandesha2:StorageManagers>
-
- <!-- This will not be overriden by service level policies -->
- <sandesha2:SecurityManager>org.apache.sandesha2.security.dummy.DummySecurityManager</sandesha2:SecurityManager>
- <sandesha2:ContextManager>org.apache.sandesha2.context.DummyContextManager</sandesha2:ContextManager>
-
- <sandesha2:MakeConnection>
- <sandesha2:Enabled>true</sandesha2:Enabled>
- <sandesha2:UseRMAnonURI>true</sandesha2:UseRMAnonURI>
- </sandesha2:MakeConnection>
-
- <!-- <sandesha2:UseMessageSerialization>true</sandesha2:UseMessageSerialization> -->
-
- <sandesha2:EnforceRM>false</sandesha2:EnforceRM>
- </wsp:Policy>
- </sandesha2:RMAssertion>
- </wsp:Policy>
-
-
- <!-- Parameters that will be copied when creating related MessageContexts -->
- <parameter name="propertiesToCopyFromReferenceMessage" locked="false">TransportURL,WSAddressingVersion,disableAddressingForOutMessages,rampartPolicy,RECV_RESULTS,PROXY</parameter>
- <parameter name="propertiesToCopyFromReferenceRequestMessage" locked="false">WSAddressingVersion,RECV_RESULTS,rampartPolicy</parameter>
-
-</module>
+<module name="sandesha2" class="org.apache.sandesha2.SandeshaModule">
+
+ <Description>
+ This module implements WS-ReliableMessaging for Axis2. This implements both the WSRM submitted spec and up to the version CD4 of the new WSRM 1.1 spec.
+ </Description>
+
+ <InFlow>
+ <handler name="SandeshaGlobalInHandler" class="org.apache.sandesha2.handlers.SandeshaGlobalInHandler">
+ <!-- Global In handler should come before addressing dispatching -->
+ <order phase="Dispatch" phaseFirst="true"/>
+ </handler>
+
+ <handler name="SequenceIDDispatcher" class="org.apache.sandesha2.handlers.SequenceIDDispatcher">
+ <order phase="Addressing" before="AddressingBasedDispatcher" />
+ </handler>
+
+ <handler name="SandeshaInHandler" class="org.apache.sandesha2.handlers.SandeshaInHandler">
+ <order phase="RMPhase"/>
+ </handler>
+ </InFlow>
+
+ <OutFlow>
+ <handler name="SandeshaOutHandler" class="org.apache.sandesha2.handlers.SandeshaOutHandler">
+ <order phase="RMPhase"/>
+ </handler>
+ </OutFlow>
+
+ <InFaultFlow>
+ <handler name="SandeshaGlobalInHandler" class="org.apache.sandesha2.handlers.SandeshaGlobalInHandler">
+ <!-- Global In handler should come before instance dispatching -->
+ <order phase="Dispatch" before="InstanceDispatcher" />
+ </handler>
+ <handler name="SandeshaInHandler" class="org.apache.sandesha2.handlers.SandeshaInHandler">
+ <order phase="RMPhase"/>
+ </handler>
+ </InFaultFlow>
+
+ <OutFaultFlow>
+ <handler name="SandeshaOutHandler" class="org.apache.sandesha2.handlers.SandeshaOutHandler">
+ <order phase="RMPhase"/>
+ </handler>
+ </OutFaultFlow>
+
+ <operation name="Sandesha2OperationInOnly" mep="http://www.w3.org/2006/01/wsdl/in-only">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+
+ <!-- namespaces for the 2005-02 spec -->
+ <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement</actionMapping>
+
+ <!-- For interopability purposes. Some WSRM implementations tend to send this as the LastMessage -->
+ <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage</actionMapping>
+
+ <!-- namespaces for the 2007-02 spec -->
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/SequenceAcknowledgement</actionMapping>
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/fault</actionMapping>
+
+ <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence</actionMapping>
+ </operation>
+
+ <operation name="Sandesha2OperationInOut" mep="http://www.w3.org/2006/01/wsdl/in-out">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+
+ <!-- namespaces for the 2005-02 spec -->
+ <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</actionMapping>
+ <actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested</actionMapping>
+
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested</actionMapping>
+
+ <!-- namespaces for the 2007-02 spec -->
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/CreateSequence</actionMapping>
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/CloseSequence</actionMapping>
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/TerminateSequence</actionMapping>
+ <actionMapping>http://docs.oasis-open.org/ws-rx/wsmc/200702/MakeConnection</actionMapping>
+ </operation>
+
+ <operation name="Sandesha2OperationOutOnly" mep="http://www.w3.org/2006/01/wsdl/out-only">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+ </operation>
+ <operation name="Sandesha2OperationOutIn" mep="http://www.w3.org/2006/01/wsdl/out-in">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+ </operation>
+
+ <operation name="Sandesha2OperationDuplicateInOnly" mep="http://www.w3.org/2006/01/wsdl/in-only">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+ </operation>
+
+ <operation name="Sandesha2OperationDuplicateInOut" mep="http://www.w3.org/2006/01/wsdl/in-out">
+ <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
+ </operation>
+
+ <supported-policy-namespaces namespaces="http://ws.apache.org/sandesha2/policy" />
+
+ <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:sandesha2="http://ws.apache.org/sandesha2/policy" wsu:Id="RMPolicy">
+ <sandesha2:RMAssertion>
+ <wsp:Policy>
+ <sandesha2:AcknowledgementInterval>3000</sandesha2:AcknowledgementInterval>
+
+ <sandesha2:RetransmissionInterval>6000</sandesha2:RetransmissionInterval>
+
+ <!-- '-1' conveys that there is no limit to the max. number of retransmissions.-->
+ <sandesha2:MaximumRetransmissionCount>10</sandesha2:MaximumRetransmissionCount>
+
+ <sandesha2:ExponentialBackoff>false</sandesha2:ExponentialBackoff>
+
+ <sandesha2:InactivityTimeout>60</sandesha2:InactivityTimeout>
+
+ <sandesha2:InactivityTimeoutMeasure>seconds</sandesha2:InactivityTimeoutMeasure>
+
+ <!-- Once a sequence has been marked as deleted, or timed out, this is the length of time that the
+ sequence will remain before all sequence state is totally removed -->
+ <sandesha2:SequenceRemovalTimeout>600</sandesha2:SequenceRemovalTimeout>
+
+ <sandesha2:SequenceRemovalTimeoutMeasure>seconds</sandesha2:SequenceRemovalTimeoutMeasure>
+
+ <sandesha2:InvokeInOrder>true</sandesha2:InvokeInOrder>
+
+ <!-- These will not be overriden by service level policies -->
+ <sandesha2:MessageTypesToDrop>none</sandesha2:MessageTypesToDrop>
+
+ <!-- This will not be overriden by service level policies -->
+ <sandesha2:StorageManagers>
+
+ <sandesha2:InMemoryStorageManager>
+ org.apache.sandesha2.storage.inmemory.InMemoryStorageManager
+ </sandesha2:InMemoryStorageManager>
+
+ <sandesha2:PermanentStorageManager>
+ org.apache.sandesha2.storage.inmemory.InMemoryStorageManager
+ </sandesha2:PermanentStorageManager>
+
+ </sandesha2:StorageManagers>
+
+ <!-- This will not be overriden by service level policies -->
+ <sandesha2:SecurityManager>org.apache.sandesha2.security.dummy.DummySecurityManager</sandesha2:SecurityManager>
+ <sandesha2:ContextManager>org.apache.sandesha2.context.DummyContextManager</sandesha2:ContextManager>
+
+ <sandesha2:MakeConnection>
+ <sandesha2:Enabled>true</sandesha2:Enabled>
+ <sandesha2:UseRMAnonURI>true</sandesha2:UseRMAnonURI>
+ </sandesha2:MakeConnection>
+
+ <!-- <sandesha2:UseMessageSerialization>true</sandesha2:UseMessageSerialization> -->
+
+ <sandesha2:EnforceRM>false</sandesha2:EnforceRM>
+ </wsp:Policy>
+ </sandesha2:RMAssertion>
+ </wsp:Policy>
+
+
+ <!-- Parameters that will be copied when creating related MessageContexts -->
+ <parameter name="propertiesToCopyFromReferenceMessage" locked="false">TransportURL,WSAddressingVersion,disableAddressingForOutMessages,rampartPolicy,RECV_RESULTS,PROXY</parameter>
+ <parameter name="propertiesToCopyFromReferenceRequestMessage" locked="false">WSAddressingVersion,RECV_RESULTS,rampartPolicy</parameter>
+
+</module>
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/module.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/mar/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/policy/pom.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/policy/pom.xml?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/policy/pom.xml (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/policy/pom.xml Wed Aug 8 17:51:29 2007
@@ -1,27 +1,27 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
<parent>
- <groupId>org.apache.sandesha2</groupId>
+ <groupId>org.apache.sandesha2</groupId>
<artifactId>sandesha2-parent</artifactId>
- <version>1.3-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
</parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2-policy</artifactId>
- <packaging>jar</packaging>
- <name>Sandesha2 - Policy</name>
-
- <build>
- <sourceDirectory>src/main/java</sourceDirectory>
- <testSourceDirectory>src/main/java</testSourceDirectory>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- </resources>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.sandesha2</groupId>
+ <artifactId>sandesha2-policy</artifactId>
+ <packaging>jar</packaging>
+ <name>Sandesha2 - Policy</name>
+
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <testSourceDirectory>src/main/java</testSourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
<plugins>
<plugin>
@@ -50,27 +50,27 @@
</execution>
</executions>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
</plugins>
-
- </build>
-
+
+ </build>
+
<dependencies>
-
- <dependency>
- <groupId>org.apache.sandesha2</groupId>
- <artifactId>sandesha2-core</artifactId>
- <version>1.3-SNAPSHOT</version>
+
+ <dependency>
+ <groupId>org.apache.sandesha2</groupId>
+ <artifactId>sandesha2-core</artifactId>
+ <version>1.3-SNAPSHOT</version>
</dependency>
-
- </dependencies>
-
-</project>
+
+ </dependencies>
+
+</project>
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/policy/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/rampart-integration/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/rampart-integration/src/main/java/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/rampart-integration/src/main/java/org/apache/sandesha2/security/rampart/RampartSecurityToken.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/samples.build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/simpleServer/SimpleSandesha2Server.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/simpleServer/SimpleSandesha2Server.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/simpleServer/SimpleSandesha2Server.java Wed Aug 8 17:51:29 2007
@@ -1,56 +1,56 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package sandesha2.samples.simpleServer;
-
-import java.io.File;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-
-public class SimpleSandesha2Server {
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_SERVER_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "server" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws AxisFault {
-
- String axisServerRepo = null;
- if (args!=null && args.length>0)
- axisServerRepo = args[0];
-
- if (axisServerRepo!=null && !"".equals(axisServerRepo)) {
- AXIS2_SERVER_PATH = axisServerRepo;
- }
-
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
- return;
- }
-
- System.out.println("Starting sandesha2 server...");
-
- String axis2_xml = AXIS2_SERVER_PATH + "server_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_SERVER_PATH,axis2_xml);
-
- SimpleHTTPServer server = new SimpleHTTPServer (configContext,8080);
-
- server.start();
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package sandesha2.samples.simpleServer;
+
+import java.io.File;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+public class SimpleSandesha2Server {
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_SERVER_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "server" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws AxisFault {
+
+ String axisServerRepo = null;
+ if (args!=null && args.length>0)
+ axisServerRepo = args[0];
+
+ if (axisServerRepo!=null && !"".equals(axisServerRepo)) {
+ AXIS2_SERVER_PATH = axisServerRepo;
+ }
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ System.out.println("Starting sandesha2 server...");
+
+ String axis2_xml = AXIS2_SERVER_PATH + "server_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_SERVER_PATH,axis2_xml);
+
+ SimpleHTTPServer server = new SimpleHTTPServer (configContext,8080);
+
+ server.start();
+ }
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/simpleServer/SimpleSandesha2Server.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AnonEchoClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java Wed Aug 8 17:51:29 2007
@@ -1,173 +1,173 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package sandesha2.samples.userguide;
-
-import java.io.File;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class AsyncEchoBlockingClient {
-
- private final static String applicationNamespaceName = "http://tempuri.org/";
- private final static String echoString = "echoString";
- private final static String Text = "Text";
- private final static String Sequence = "Sequence";
- private final static String EchoStringReturn = "EchoStringReturn";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8070";
-
- private String transportToPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
-
- private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws Exception {
-
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
- new AsyncEchoBlockingClient ().run();
- }
-
- private void run () throws Exception {
-
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-
- Options clientOptions = new Options ();
-
- clientOptions.setTo(new EndpointReference (toEPR));
-
- String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
- clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-
- String sequenceKey = "sequence4";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
-
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-
- clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
-// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-
- clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
- clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
- clientOptions.setAction("urn:wsrm:EchoString");
-
- //You must set the following two properties in the request-reply case.
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- clientOptions.setUseSeparateListener(true);
-
- serviceClient.setOptions(clientOptions);
-
- clientOptions.setTimeOutInMilliSeconds(40000);
-
- OMElement result = serviceClient.sendReceive (getEchoOMBlock("echo1",sequenceKey));
- showResult(result);
-
- result = serviceClient.sendReceive (getEchoOMBlock("echo2",sequenceKey));
- showResult(result);
-
- result = serviceClient.sendReceive(getEchoOMBlock("echo3",sequenceKey));
- showResult(result);
-
- result = serviceClient.sendReceive(getEchoOMBlock("echo4",sequenceKey));
- showResult(result);
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- OMElement bodyElem = getEchoOMBlock("echo5",sequenceKey);
-
- result = serviceClient.sendReceive(bodyElem);
- showResult(result);
-
- Thread.sleep(4000);
- }
-
- private static OMElement getEchoOMBlock(String text, String sequenceKey) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
- OMElement textElem = fac.createOMElement(Text,applicationNamespace);
- OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-
- textElem.setText(text);
- sequenceElem.setText(sequenceKey);
- echoStringElement.addChild(textElem);
- echoStringElement.addChild(sequenceElem);
-
- OMNamespace namespace = fac.createOMNamespace(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,"env");
- OMAttribute attr = fac.createOMAttribute("encodingStyle", namespace,"http://schemas.xmlsoap.org/soap/encoding/");
-
- echoStringElement.addAttribute(attr);
-
- return echoStringElement;
- }
-
- private void showResult (OMElement echoStringResponseElem) {
-
- OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
- if (echoStringReturnElem==null) {
- System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
- return;
- }
-
- String resultStr = echoStringReturnElem.getText();
- System.out.println("Got result:" + resultStr);
- }
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package sandesha2.samples.userguide;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class AsyncEchoBlockingClient {
+
+ private final static String applicationNamespaceName = "http://tempuri.org/";
+ private final static String echoString = "echoString";
+ private final static String Text = "Text";
+ private final static String Sequence = "Sequence";
+ private final static String EchoStringReturn = "EchoStringReturn";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String transportToPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+
+ private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ new AsyncEchoBlockingClient ().run();
+ }
+
+ private void run () throws Exception {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+ Options clientOptions = new Options ();
+
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+
+ String sequenceKey = "sequence4";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+
+ clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
+ clientOptions.setAction("urn:wsrm:EchoString");
+
+ //You must set the following two properties in the request-reply case.
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+
+ serviceClient.setOptions(clientOptions);
+
+ clientOptions.setTimeOutInMilliSeconds(40000);
+
+ OMElement result = serviceClient.sendReceive (getEchoOMBlock("echo1",sequenceKey));
+ showResult(result);
+
+ result = serviceClient.sendReceive (getEchoOMBlock("echo2",sequenceKey));
+ showResult(result);
+
+ result = serviceClient.sendReceive(getEchoOMBlock("echo3",sequenceKey));
+ showResult(result);
+
+ result = serviceClient.sendReceive(getEchoOMBlock("echo4",sequenceKey));
+ showResult(result);
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ OMElement bodyElem = getEchoOMBlock("echo5",sequenceKey);
+
+ result = serviceClient.sendReceive(bodyElem);
+ showResult(result);
+
+ Thread.sleep(4000);
+ }
+
+ private static OMElement getEchoOMBlock(String text, String sequenceKey) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+ OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+ OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+
+ textElem.setText(text);
+ sequenceElem.setText(sequenceKey);
+ echoStringElement.addChild(textElem);
+ echoStringElement.addChild(sequenceElem);
+
+ OMNamespace namespace = fac.createOMNamespace(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,"env");
+ OMAttribute attr = fac.createOMAttribute("encodingStyle", namespace,"http://schemas.xmlsoap.org/soap/encoding/");
+
+ echoStringElement.addAttribute(attr);
+
+ return echoStringElement;
+ }
+
+ private void showResult (OMElement echoStringResponseElem) {
+
+ OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+ if (echoStringReturnElem==null) {
+ System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+ return;
+ }
+
+ String resultStr = echoStringReturnElem.getText();
+ System.out.println("Got result:" + resultStr);
+ }
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoBlockingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java Wed Aug 8 17:51:29 2007
@@ -1,206 +1,206 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package sandesha2.samples.userguide;
-
-import java.io.File;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContextConstants;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-import org.apache.sandesha2.util.SandeshaUtil;
-
-public class AsyncEchoClient {
-
- private final static String applicationNamespaceName = "http://tempuri.org/";
- private final static String echoString = "echoString";
- private final static String Text = "Text";
- private final static String Sequence = "Sequence";
- private final static String echoStringResponse = "echoStringResponse";
- private final static String EchoStringReturn = "EchoStringReturn";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8070";
-
- private String transportToPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
-
- private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws Exception {
-
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
- new AsyncEchoClient ().run();
- }
-
- private void run () throws Exception {
-
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
-
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-
- Options clientOptions = new Options ();
-
- clientOptions.setTo(new EndpointReference (toEPR));
-
-
- String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
- clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
-
- String sequenceKey = SandeshaUtil.getUUID(); //sequence key for thie sequence.
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
-// clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Final.WSA_ANONYMOUS_URL));
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-// clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-// serviceClient.engageModule(new QName ("sandesha2"));
-
- clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
-
- clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-
- clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
- clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
- clientOptions.setAction("urn:wsrm:EchoString");
-
- //You must set the following two properties in the request-reply case.
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
- clientOptions.setUseSeparateListener(true);
-
- serviceClient.setOptions(clientOptions);
-
-// Callback callback1 = new TestCallback ("Callback 1");
-// serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
-//
-// Callback callback2 = new TestCallback ("Callback 2");
-// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
-//
-// Callback callback3 = new TestCallback ("Callback 3");
-// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
-//
-// Callback callback4 = new TestCallback ("Callback 4");
-// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- Callback callback5 = new TestCallback ("Callback 5");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
-
- while (!callback5.isComplete()) {
- Thread.sleep(1000);
- }
-
- Thread.sleep(4000);
-
- configContext.getListenerManager().stop();
- serviceClient.cleanup();
-
- }
-
- private static OMElement getEchoOMBlock(String text, String sequenceKey) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
- OMElement textElem = fac.createOMElement(Text,applicationNamespace);
- OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-
- textElem.setText(text);
- sequenceElem.setText(sequenceKey);
- echoStringElement.addChild(textElem);
- echoStringElement.addChild(sequenceElem);
-
- return echoStringElement;
- }
-
- public class TestCallback extends Callback {
-
- String name = null;
-
- public TestCallback () {
-
- }
-
- public TestCallback (String name) {
- this.name = name;
- }
-
- public void onComplete(AsyncResult result) {
- //System.out.println("On Complete Called for " + text);
- SOAPBody body = result.getResponseEnvelope().getBody();
-
- OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
- if (echoStringResponseElem==null) {
- System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
- return;
- }
-
- OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
- if (echoStringReturnElem==null) {
- System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
- return;
- }
-
- String resultStr = echoStringReturnElem.getText();
- System.out.println("Callback '" + name + "' got result:" + resultStr);
- }
-
- public void onError (Exception e) {
- // TODO Auto-generated method stub
- System.out.println("Error reported for test call back");
- e.printStackTrace();
- }
- }
-
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package sandesha2.samples.userguide;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContextConstants;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+import org.apache.sandesha2.util.SandeshaUtil;
+
+public class AsyncEchoClient {
+
+ private final static String applicationNamespaceName = "http://tempuri.org/";
+ private final static String echoString = "echoString";
+ private final static String Text = "Text";
+ private final static String Sequence = "Sequence";
+ private final static String echoStringResponse = "echoStringResponse";
+ private final static String EchoStringReturn = "EchoStringReturn";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String transportToPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+
+ private String transportToEPR = "http://" + toIP + ":" + transportToPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ new AsyncEchoClient ().run();
+ }
+
+ private void run () throws Exception {
+
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please set the directory you unzipped Sandesha2 as the first option.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+ Options clientOptions = new Options ();
+
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+
+ String acksTo = serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress() + "/" + ServiceClient.ANON_OUT_IN_OP;
+ clientOptions.setProperty(SandeshaClientConstants.AcksTo,acksTo);
+
+ String sequenceKey = SandeshaUtil.getUUID(); //sequence key for thie sequence.
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+// clientOptions.setReplyTo(new EndpointReference (AddressingConstants.Final.WSA_ANONYMOUS_URL));
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+// clientOptions.setProperty(SandeshaClientConstants.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+// serviceClient.engageModule(new QName ("sandesha2"));
+
+ clientOptions.setProperty(MessageContextConstants.TRANSPORT_URL,transportToEPR);
+
+ clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+
+ clientOptions.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,AddressingConstants.Submission.WSA_NAMESPACE);
+ clientOptions.setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
+ clientOptions.setAction("urn:wsrm:EchoString");
+
+ //You must set the following two properties in the request-reply case.
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+
+ clientOptions.setUseSeparateListener(true);
+
+ serviceClient.setOptions(clientOptions);
+
+// Callback callback1 = new TestCallback ("Callback 1");
+// serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1",sequenceKey),callback1);
+//
+// Callback callback2 = new TestCallback ("Callback 2");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
+//
+// Callback callback3 = new TestCallback ("Callback 3");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
+//
+// Callback callback4 = new TestCallback ("Callback 4");
+// serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo4",sequenceKey),callback4);
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ Callback callback5 = new TestCallback ("Callback 5");
+ serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo5",sequenceKey),callback5);
+
+ while (!callback5.isComplete()) {
+ Thread.sleep(1000);
+ }
+
+ Thread.sleep(4000);
+
+ configContext.getListenerManager().stop();
+ serviceClient.cleanup();
+
+ }
+
+ private static OMElement getEchoOMBlock(String text, String sequenceKey) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+ OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+ OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+
+ textElem.setText(text);
+ sequenceElem.setText(sequenceKey);
+ echoStringElement.addChild(textElem);
+ echoStringElement.addChild(sequenceElem);
+
+ return echoStringElement;
+ }
+
+ public class TestCallback extends Callback {
+
+ String name = null;
+
+ public TestCallback () {
+
+ }
+
+ public TestCallback (String name) {
+ this.name = name;
+ }
+
+ public void onComplete(AsyncResult result) {
+ //System.out.println("On Complete Called for " + text);
+ SOAPBody body = result.getResponseEnvelope().getBody();
+
+ OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
+ if (echoStringResponseElem==null) {
+ System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
+ return;
+ }
+
+ OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+ if (echoStringReturnElem==null) {
+ System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+ return;
+ }
+
+ String resultStr = echoStringReturnElem.getText();
+ System.out.println("Callback '" + name + "' got result:" + resultStr);
+ }
+
+ public void onError (Exception e) {
+ // TODO Auto-generated method stub
+ System.out.println("Error reported for test call back");
+ e.printStackTrace();
+ }
+ }
+
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncEchoWithPollingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/AsyncPingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/MTOMPingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/RMSampleService.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/RMSampleService.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/RMSampleService.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/RMSampleService.java Wed Aug 8 17:51:29 2007
@@ -1,119 +1,119 @@
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package sandesha2.samples.userguide;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axis2.AxisFault;
-
-public class RMSampleService {
-
- private static Map sequenceStrings = new HashMap(); //TODO make this non static
- private final String applicationNamespaceName = "http://tempuri.org/";
- private final String Text = "Text";
- private final String Sequence = "Sequence";
- private final String echoStringResponse = "echoStringResponse";
- private final String EchoStringReturn = "EchoStringReturn";
- private final String Attachment = "Attachment";
- private final String DESTINATION_IMAGE_FILE = "mtom-image1.jpg";
-
- public void init(org.apache.axis2.context.ServiceContext serviceContext) {
-
- }
-
- public OMElement echoString(OMElement in) throws Exception {
-
- OMElement textElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Text));
- OMElement sequenceElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Sequence));
-
- if (textElem==null)
- throw new Exception ("'Text' element is not present as a child of the 'echoString' element");
- if (sequenceElem==null)
- throw new Exception ("'Sequence' element is not present as a child of the 'echoString' element");
-
- String textStr = textElem.getText();
- String sequenceStr = sequenceElem.getText();
-
- System.out.println("'EchoString' service got text '" + textStr + "' for the sequence '" + sequenceStr + "'");
-
- String previousText = (String) sequenceStrings.get(sequenceStr);
- String resultText = (previousText==null)?textStr:previousText+textStr;
- sequenceStrings.put(sequenceStr,resultText);
-
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement echoStringResponseElem = fac.createOMElement(echoStringResponse, applicationNamespace);
- OMElement echoStringReturnElem = fac.createOMElement(EchoStringReturn, applicationNamespace);
-
- echoStringReturnElem.setText(resultText);
- echoStringResponseElem.addChild(echoStringReturnElem);
-
- return echoStringResponseElem;
- }
-
- public void ping(OMElement in) throws Exception {
- OMElement textElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Text));
- if (textElem==null)
- throw new Exception ("'Text' element is not present as a child of the 'Ping' element");
-
- String textValue = textElem.getText();
-
- System.out.println("ping service got text:" + textValue);
- }
-
- public void MTOMPing(OMElement in) throws Exception {
- OMElement attachmentElem = in.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
- if (attachmentElem == null)
- throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");
-
- OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();
-
- binaryElem.setOptimize(true);
- DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();
-
- try {
-
- File destinationFile = new File(DESTINATION_IMAGE_FILE);
- if (destinationFile.exists())
- destinationFile.delete();
-
- FileOutputStream fileOutputStream = new FileOutputStream(DESTINATION_IMAGE_FILE);
-
- InputStream inputStream = dataHandler.getDataSource().getInputStream();
- byte[] bytes = new byte[5000];
- int length = inputStream.read(bytes);
- fileOutputStream.write(bytes, 0, length);
- fileOutputStream.close();
-
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
- }
-}
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package sandesha2.samples.userguide;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMText;
+import org.apache.axis2.AxisFault;
+
+public class RMSampleService {
+
+ private static Map sequenceStrings = new HashMap(); //TODO make this non static
+ private final String applicationNamespaceName = "http://tempuri.org/";
+ private final String Text = "Text";
+ private final String Sequence = "Sequence";
+ private final String echoStringResponse = "echoStringResponse";
+ private final String EchoStringReturn = "EchoStringReturn";
+ private final String Attachment = "Attachment";
+ private final String DESTINATION_IMAGE_FILE = "mtom-image1.jpg";
+
+ public void init(org.apache.axis2.context.ServiceContext serviceContext) {
+
+ }
+
+ public OMElement echoString(OMElement in) throws Exception {
+
+ OMElement textElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Text));
+ OMElement sequenceElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Sequence));
+
+ if (textElem==null)
+ throw new Exception ("'Text' element is not present as a child of the 'echoString' element");
+ if (sequenceElem==null)
+ throw new Exception ("'Sequence' element is not present as a child of the 'echoString' element");
+
+ String textStr = textElem.getText();
+ String sequenceStr = sequenceElem.getText();
+
+ System.out.println("'EchoString' service got text '" + textStr + "' for the sequence '" + sequenceStr + "'");
+
+ String previousText = (String) sequenceStrings.get(sequenceStr);
+ String resultText = (previousText==null)?textStr:previousText+textStr;
+ sequenceStrings.put(sequenceStr,resultText);
+
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement echoStringResponseElem = fac.createOMElement(echoStringResponse, applicationNamespace);
+ OMElement echoStringReturnElem = fac.createOMElement(EchoStringReturn, applicationNamespace);
+
+ echoStringReturnElem.setText(resultText);
+ echoStringResponseElem.addChild(echoStringReturnElem);
+
+ return echoStringResponseElem;
+ }
+
+ public void ping(OMElement in) throws Exception {
+ OMElement textElem = in.getFirstChildWithName(new QName (applicationNamespaceName,Text));
+ if (textElem==null)
+ throw new Exception ("'Text' element is not present as a child of the 'Ping' element");
+
+ String textValue = textElem.getText();
+
+ System.out.println("ping service got text:" + textValue);
+ }
+
+ public void MTOMPing(OMElement in) throws Exception {
+ OMElement attachmentElem = in.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
+ if (attachmentElem == null)
+ throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");
+
+ OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();
+
+ binaryElem.setOptimize(true);
+ DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();
+
+ try {
+
+ File destinationFile = new File(DESTINATION_IMAGE_FILE);
+ if (destinationFile.exists())
+ destinationFile.delete();
+
+ FileOutputStream fileOutputStream = new FileOutputStream(DESTINATION_IMAGE_FILE);
+
+ InputStream inputStream = dataHandler.getDataSource().getInputStream();
+ byte[] bytes = new byte[5000];
+ int length = inputStream.read(bytes);
+ fileOutputStream.write(bytes, 0, length);
+ fileOutputStream.close();
+
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+ }
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/RMSampleService.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java?view=diff&rev=564061&r1=564060&r2=564061
==============================================================================
--- webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java (original)
+++ webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java Wed Aug 8 17:51:29 2007
@@ -1,176 +1,176 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package sandesha2.samples.userguide;
-
-import java.io.File;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.async.AsyncResult;
-import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.sandesha2.client.SandeshaClientConstants;
-
-
-public class SyncEchoClient {
-
- private final static String applicationNamespaceName = "http://tempuri.org/";
- private final static String echoString = "echoString";
- private final static String Text = "Text";
- private final static String Sequence = "Sequence";
- private final static String echoStringResponse = "echoStringResponse";
- private final static String EchoStringReturn = "EchoStringReturn";
-
- private String toIP = "127.0.0.1";
-
- private String toPort = "8070";
-
- private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
-
- private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
-
- private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
-
- public static void main(String[] args) throws Exception {
-
- String axisClientRepo = null;
- if (args!=null && args.length>0)
- axisClientRepo = args[0];
-
- if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
- AXIS2_CLIENT_PATH = axisClientRepo;
- SANDESHA2_HOME = "";
- }
-
- new SyncEchoClient().run();
- }
-
- private void run () throws Exception {
- if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
- System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
- return;
- }
-
- String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
- ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
-
- ServiceClient serviceClient = new ServiceClient (configContext,null);
-
-// serviceClient.engageModule(new QName ("sandesha2"));
-
- Options clientOptions = new Options ();
-
- clientOptions.setTo(new EndpointReference (toEPR));
-
- String sequenceKey = "sequence3";
- clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
-
- //You must set the following two properties in the request-reply case.
- clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
- clientOptions.setUseSeparateListener(true);
- clientOptions.setAction("urn:wsrm:EchoString");
-
-// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
-// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
-// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
-// clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
-
- serviceClient.setOptions(clientOptions);
-
- Callback callback1 = new TestCallback ("Callback 1");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
-
- clientOptions.setAction("urn:wsrm:EchoString");
- Callback callback2 = new TestCallback ("Callback 2");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
-
- clientOptions.setAction("urn:wsrm:EchoString");
-
- clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
- Callback callback3 = new TestCallback ("Callback 3");
- serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
-
- while (!callback3.isComplete()) {
- Thread.sleep(1000);
- }
- }
-
- private static OMElement getEchoOMBlock(String text, String sequenceKey) {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
- OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
- OMElement textElem = fac.createOMElement(Text,applicationNamespace);
- OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
-
- textElem.setText(text);
- sequenceElem.setText(sequenceKey);
- echoStringElement.addChild(textElem);
- echoStringElement.addChild(sequenceElem);
-
- return echoStringElement;
- }
-
- private class TestCallback extends Callback {
-
- String name = null;
-
- public TestCallback (String name) {
- this.name = name;
- }
-
- public String toString () {
- return name;
- }
-
- public void onComplete(AsyncResult result) {
- //System.out.println("On Complete Called for " + text);
- SOAPBody body = result.getResponseEnvelope().getBody();
-
- OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
- if (echoStringResponseElem==null) {
- System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
- return;
- }
-
- OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
- if (echoStringReturnElem==null) {
- System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
- return;
- }
-
- String resultStr = echoStringReturnElem.getText();
- System.out.println("Callback '" + name + "' got result:" + resultStr);
-
- }
-
- public void onError(Exception e) {
- // TODO Auto-generated method stub
- System.out.println("Error reported for test call back");
- }
- }
-
-}
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package sandesha2.samples.userguide;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.sandesha2.client.SandeshaClientConstants;
+
+
+public class SyncEchoClient {
+
+ private final static String applicationNamespaceName = "http://tempuri.org/";
+ private final static String echoString = "echoString";
+ private final static String Text = "Text";
+ private final static String Sequence = "Sequence";
+ private final static String echoStringResponse = "echoStringResponse";
+ private final static String EchoStringReturn = "EchoStringReturn";
+
+ private String toIP = "127.0.0.1";
+
+ private String toPort = "8070";
+
+ private String toEPR = "http://" + toIP + ":" + toPort + "/axis2/services/RMSampleService";
+
+ private static String SANDESHA2_HOME = "<SANDESHA2_HOME>"; //Change this to ur path.
+
+ private static String AXIS2_CLIENT_PATH = SANDESHA2_HOME + File.separator + "target" + File.separator +"repos" + File.separator + "client" + File.separator; //this will be available after a maven build
+
+ public static void main(String[] args) throws Exception {
+
+ String axisClientRepo = null;
+ if (args!=null && args.length>0)
+ axisClientRepo = args[0];
+
+ if (axisClientRepo!=null && !"".equals(axisClientRepo)) {
+ AXIS2_CLIENT_PATH = axisClientRepo;
+ SANDESHA2_HOME = "";
+ }
+
+ new SyncEchoClient().run();
+ }
+
+ private void run () throws Exception {
+ if ("<SANDESHA2_HOME>".equals(SANDESHA2_HOME)){
+ System.out.println("ERROR: Please change <SANDESHA2_HOME> to your Sandesha2 installation directory.");
+ return;
+ }
+
+ String axis2_xml = AXIS2_CLIENT_PATH + "client_axis2.xml";
+ ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_CLIENT_PATH,axis2_xml);
+
+ ServiceClient serviceClient = new ServiceClient (configContext,null);
+
+// serviceClient.engageModule(new QName ("sandesha2"));
+
+ Options clientOptions = new Options ();
+
+ clientOptions.setTo(new EndpointReference (toEPR));
+
+ String sequenceKey = "sequence3";
+ clientOptions.setProperty(SandeshaClientConstants.SEQUENCE_KEY,sequenceKey);
+
+ //You must set the following two properties in the request-reply case.
+ clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+ clientOptions.setUseSeparateListener(true);
+ clientOptions.setAction("urn:wsrm:EchoString");
+
+// clientOptions.setProperty(MessageContextConstants.CHUNKED,Constants.VALUE_FALSE); //uncomment this to send messages without chunking.
+// clientOptions.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); //uncomment this to send messages in SOAP 1.2
+// clientOptions.setProperty(SandeshaClient.RM_SPEC_VERSION,Sandesha2Constants.SPEC_VERSIONS.v1_1); //uncomment this to send the messages according to the v1_1 spec.
+// clientOptions.setProperty(SandeshaClient.OFFERED_SEQUENCE_ID,SandeshaUtil.getUUID()); //Uncomment this to offer a sequenceID for the incoming sequence.
+
+ serviceClient.setOptions(clientOptions);
+
+ Callback callback1 = new TestCallback ("Callback 1");
+ serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo1",sequenceKey),callback1);
+
+ clientOptions.setAction("urn:wsrm:EchoString");
+ Callback callback2 = new TestCallback ("Callback 2");
+ serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2",sequenceKey),callback2);
+
+ clientOptions.setAction("urn:wsrm:EchoString");
+
+ clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
+ Callback callback3 = new TestCallback ("Callback 3");
+ serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3",sequenceKey),callback3);
+
+ while (!callback3.isComplete()) {
+ Thread.sleep(1000);
+ }
+ }
+
+ private static OMElement getEchoOMBlock(String text, String sequenceKey) {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
+ OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
+ OMElement textElem = fac.createOMElement(Text,applicationNamespace);
+ OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);
+
+ textElem.setText(text);
+ sequenceElem.setText(sequenceKey);
+ echoStringElement.addChild(textElem);
+ echoStringElement.addChild(sequenceElem);
+
+ return echoStringElement;
+ }
+
+ private class TestCallback extends Callback {
+
+ String name = null;
+
+ public TestCallback (String name) {
+ this.name = name;
+ }
+
+ public String toString () {
+ return name;
+ }
+
+ public void onComplete(AsyncResult result) {
+ //System.out.println("On Complete Called for " + text);
+ SOAPBody body = result.getResponseEnvelope().getBody();
+
+ OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));
+ if (echoStringResponseElem==null) {
+ System.out.println("Error: SOAPBody does not have a 'echoStringResponse' child");
+ return;
+ }
+
+ OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));
+ if (echoStringReturnElem==null) {
+ System.out.println("Error: 'echoStringResponse' element does not have a 'EchoStringReturn' child");
+ return;
+ }
+
+ String resultStr = echoStringReturnElem.getText();
+ System.out.println("Callback '" + name + "' got result:" + resultStr);
+
+ }
+
+ public void onError(Exception e) {
+ // TODO Auto-generated method stub
+ System.out.println("Error reported for test call back");
+ }
+ }
+
+}
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncEchoClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/sandesha/branches/sandesha2/java/1_3/modules/samples/src/main/java/sandesha2/samples/userguide/SyncPingClient.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org