You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by th...@apache.org on 2005/09/07 08:55:30 UTC
svn commit: r279261 - in
/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor:
ActivationCoordinatorPortTypeRawXMLStub.java
RegistrationCoordinatorPortTypeRawXMLStub.java
RegistrationRequesterPortTypeRawXMLSkeleton.java
Author: thilina
Date: Tue Sep 6 23:55:24 2005
New Revision: 279261
URL: http://svn.apache.org/viewcvs?rev=279261&view=rev
Log:
commiting Raw XML registration ports
Added:
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
Modified:
webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java?rev=279261&r1=279260&r2=279261&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java (original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java Tue Sep 6 23:55:24 2005
@@ -23,20 +23,11 @@
import org.apache.axis2.addressing.AnyContentType;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.clientapi.MessageSender;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.OperationDescription;
-import org.apache.axis2.description.ParameterImpl;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.MIMEOutputUtils;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-import org.apache.axis2.util.Utils;
import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaListener;
/**
* @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
@@ -44,8 +35,7 @@
public class ActivationCoordinatorPortTypeRawXMLStub extends
org.apache.axis2.clientapi.Stub {
-
- private ConfigurationContext responseConfigurationContext ;
+
public static final String AXIS2_HOME = ".";
protected static org.apache.axis2.description.OperationDescription[] operations;
@@ -80,15 +70,13 @@
//creating the configuration
_configurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
.buildClientConfigurationContext(axis2Home);
- responseConfigurationContext = new org.apache.axis2.context.ConfigurationContextFactory()
- .buildClientConfigurationContext(axis2Home);
+
_configurationContext.getAxisConfiguration().addService(_service);
_serviceContext = _configurationContext.createServiceContext(_service
.getName());
}
-
private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
String coordinationType) {
org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
@@ -106,66 +94,35 @@
return env;
}
- public void createCoordinationContextOperation(
- String coordinationType, String id)
- throws java.rmi.RemoteException {
+ public void createCoordinationContextOperation(String coordinationType,
+ String id) throws IOException {
QName serviceName = new QName("ActivationRequesterPortType");
- QName operationName = new QName(Constants.WS_COOR,"CreateCoordinationContextOperation");
-
- ServiceDescription service = new ServiceDescription(serviceName);
- service.addParameter(new ParameterImpl(
- AbstractMessageReceiver.SERVICE_CLASS,
- ActivationRequesterPortTypeRawXMLSkeleton.class.getName()));
- service.setFileName(ActivationRequesterPortTypeRawXMLSkeleton.class.getName());
- org.apache.axis2.description.OperationDescription responseOperationDesc;
- operations = new org.apache.axis2.description.OperationDescription[1];
-
- responseOperationDesc = new org.apache.axis2.description.OperationDescription();
- responseOperationDesc.setName(new javax.xml.namespace.QName(
- "http://schemas.xmlsoap.org/ws/2003/09/wscoor",
- "CreateCoordinationContextOperation"));
- responseOperationDesc.setMessageReceiver(new RawXMLINOnlyMessageReceiver());
- operations[0] = responseOperationDesc;
- service.addOperation(responseOperationDesc);
- service.setClassLoader(Thread.currentThread().getContextClassLoader());
-
- try {
- SimpleHTTPServer receiver=null;
-
- responseConfigurationContext.getAxisConfiguration().addService(service);
- responseConfigurationContext.createServiceContext(serviceName);
-
- receiver = new SimpleHTTPServer(responseConfigurationContext, 6060);
-
- receiver.start();
- System.out.print("Server started on port " + 5050 + ".....");
-
-
- Utils.resolvePhases(receiver.getSystemContext()
- .getAxisConfiguration(), service);
- MessageSender messageSender = new MessageSender(_serviceContext);
- org.apache.axis2.context.MessageContext messageContext = getMessageContext();
- EndpointReference replyToEpr = new EndpointReference(
- "http://127.0.0.1:6061" + "/axis2/services/" + serviceName.getLocalPart());
- AnyContentType refProperties = new AnyContentType();
- refProperties.addReferenceValue(new QName("http://ws.apache.org/kandula",id),id);
- replyToEpr.setReferenceProperties(refProperties);
- // messageSender.
- messageSender.setReplyTo(replyToEpr);
- messageSender.setTo(this.toEPR);
- messageSender.setSoapAction("CreateCoordinationContextOperation");
- //_call.setWsaAction("CreateCoordinationContextOperation");
- org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
- messageContext.setEnvelope(env);
- messageSender
- .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
- messageSender.send(operations[0], messageContext);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
+ QName operationName = new QName(Constants.WS_COOR,
+ "CreateCoordinationContextOperation");
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(serviceName, operationName,
+ ActivationRequesterPortTypeRawXMLSkeleton.class.getName());
+ listener.start();
+
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ EndpointReference replyToEpr = new EndpointReference(listener.getHost()
+ + serviceName.getLocalPart());
+ AnyContentType refProperties = new AnyContentType();
+ refProperties.addReferenceValue(new QName(
+ "http://ws.apache.org/kandula", "id"), id);
+ replyToEpr.setReferenceProperties(refProperties);
+ // messageSender.
+ messageSender.setReplyTo(replyToEpr);
+ messageSender.setTo(this.toEPR);
+ messageSender.setSoapAction("CreateCoordinationContextOperation");
+ //_call.setWsaAction("CreateCoordinationContextOperation");
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
+ messageContext.setEnvelope(env);
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(operations[0], messageContext);
- }
}
}
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java?rev=279261&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java Tue Sep 6 23:55:24 2005
@@ -0,0 +1,108 @@
+ package org.apache.kandula.wscoor;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.MessageSender;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.kandula.Constants;
+import org.apache.kandula.utility.KandulaListener;
+
+ /*
+ * Auto generated java implementation by the Axis code generator
+ */
+
+ public class RegistrationCoordinatorPortTypeRawXMLStub extends org.apache.axis2.clientapi.Stub{
+ public static final String AXIS2_HOME = ".";
+ protected static org.apache.axis2.description.OperationDescription[] _operations;
+
+ static{
+
+ //creating the Service
+ _service = new org.apache.axis2.description.ServiceDescription(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor","RegistrationCoordinatorPortType"));
+
+ //creating the operations
+ org.apache.axis2.description.OperationDescription __operation;
+ _operations = new org.apache.axis2.description.OperationDescription[1];
+
+ __operation = new org.apache.axis2.description.OperationDescription();
+ __operation.setName(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor", "RegisterOperation"));
+ _operations[0]=__operation;
+ _service.addOperation(__operation);
+
+
+ }
+
+ /**
+ * Constructor
+ */
+ public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home,String targetEndpoint) throws java.lang.Exception {
+ this.toEPR = new org.apache.axis2.addressing.EndpointReference(targetEndpoint);
+ //creating the configuration
+ _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
+ _configurationContext.getAxisConfiguration().addService(_service);
+ _serviceContext = _configurationContext.createServiceContext(_service.getName());
+
+ }
+
+
+ private org.apache.axis2.soap.SOAPEnvelope createSOAPEnvelope(
+ String coordinationType) {
+ org.apache.axis2.soap.SOAPEnvelope env = super.createEnvelope();
+ org.apache.axis2.soap.SOAPFactory factory = OMAbstractFactory
+ .getSOAP12Factory();
+ OMNamespace wsCoor = factory.createOMNamespace(Constants.WS_COOR,
+ "wscoor");
+ OMElement request = factory.createOMElement(
+ "CreateCoordinationContext", wsCoor);
+ OMElement coorType = factory
+ .createOMElement("CoordinationType", wsCoor);
+ coorType.setText(coordinationType);
+ request.addChild(coorType);
+ env.getBody().addChild(request);
+ return env;
+ }
+
+ public void RegisterOperation(String coordinationType,
+ String id) throws IOException {
+
+ QName serviceName = new QName("RegistrationRequesterPortType");
+ QName operationName = new QName(Constants.WS_COOR,
+ "RegisterOperation");
+ KandulaListener listener = KandulaListener.getInstance();
+ listener.addService(serviceName, operationName,
+ RegistrationRequesterPortTypeRawXMLSkeleton.class.getName());
+ listener.start();
+
+ MessageSender messageSender = new MessageSender(_serviceContext);
+ org.apache.axis2.context.MessageContext messageContext = getMessageContext();
+ EndpointReference replyToEpr = new EndpointReference(listener.getHost()
+ + serviceName.getLocalPart());
+ AnyContentType refProperties = new AnyContentType();
+ refProperties.addReferenceValue(new QName(
+ "http://ws.apache.org/kandula", id), id);
+ replyToEpr.setReferenceProperties(refProperties);
+ // messageSender.
+ messageSender.setReplyTo(replyToEpr);
+ messageSender.setTo(this.toEPR);
+ messageSender.setSoapAction("CreateCoordinationContextOperation");
+ //_call.setWsaAction("CreateCoordinationContextOperation");
+ org.apache.axis2.soap.SOAPEnvelope env = createSOAPEnvelope(coordinationType);
+ messageContext.setEnvelope(env);
+ messageSender
+ .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ messageSender.send(_operations[0], messageContext);
+
+ }
+
+
+
+
+
+ }
+
\ No newline at end of file
Added: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java?rev=279261&view=auto
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java (added)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java Tue Sep 6 23:55:24 2005
@@ -0,0 +1,53 @@
+package org.apache.kandula.wscoor;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.om.OMElement;
+import org.apache.kandula.coordinator.context.ActivityContext;
+import org.apache.kandula.participant.standalone.TransactionManager;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.typemapping.CoordinationContext;
+
+/*
+ * 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.
+ *
+ *
+ */
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+
+public class RegistrationRequesterPortTypeRawXMLSkeleton {
+ MessageContext msgContext;
+
+ public void init(MessageContext context) {
+ this.msgContext = context;
+ }
+
+ public OMElement RegisterOperation(OMElement requestElement) {
+// OMElement coordinationContextElement = requestElement
+// .getFirstChildWithName(new QName("CoordinationContext"));
+// if ("CoordinationContext".equals(requestElement.getLocalName()))
+// {
+// msgContext.getMessageInformationHeaders().getReferenceParameters();
+// CoordinationContext coordinationContext =CoordinationContext.Factory.newInstance(requestElement);
+// ActivityContext context = StorageFactory.getInstance().getStore().getContext(TransactionManager.tempID);
+// context.setCoordinationContext(coordinationContext);
+// }
+ return null;
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org