You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2004/11/05 08:07:24 UTC
svn commit: rev 56653 - in webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis: . async context encoding engine handlers message providers transport transport/http
Author: hemapani
Date: Thu Nov 4 23:07:23 2004
New Revision: 56653
Added:
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/Dispatcher.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/MessageQueue.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/Sender.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/AbstractHandler.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/DocLitOpNameFinder.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/RPCOpNameFinder.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/OMMessage.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/ASyncProvider.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SyncProvider.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/TransportSender.java
Removed:
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/encoding/ConcreateDeserializationContext.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/encoding/DeseializationContext.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/Message.java
Modified:
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/Provider.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/GlobalContext.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/MessageContext.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/AxisEngine.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/ConcreateCommonExecuter.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/SOAPEnvelope.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SimpleJavaProvider.java
webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/http/SimpleAxisWorker.java
Log:
change the engine to incoperate the sync/async things we discuss .. no Serialization Context and Deserialization contexts all happens through OM ls CommonExecuters are still there .. for now
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/Provider.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/Provider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/Provider.java Thu Nov 4 23:07:23 2004
@@ -23,5 +23,4 @@
* @author Srinath Perera(hemapani@opensource.lk)
*/
public interface Provider extends Handler{
- public QName getName();
}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/Dispatcher.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/Dispatcher.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2003,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 org.apache.axis.async;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class Dispatcher {
+
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/MessageQueue.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/async/MessageQueue.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2003,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 org.apache.axis.async;
+
+import org.apache.axis.context.MessageContext;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public interface MessageQueue {
+ public void submitAJob(MessageContext msgctx);
+ public boolean hasAJob();
+ public MessageContext getNextJob();
+
+}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/GlobalContext.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/GlobalContext.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/GlobalContext.java Thu Nov 4 23:07:23 2004
@@ -15,8 +15,10 @@
*/
package org.apache.axis.context;
+
import java.util.HashMap;
+import org.apache.axis.async.MessageQueue;
import org.apache.axis.registry.EngineRegistry;
/**
@@ -26,7 +28,21 @@
private EngineRegistry registry;
private HashMap map = new HashMap();
+ private MessageQueue queue;
+
+ /**
+ * @return Returns the queue.
+ */
+ public MessageQueue getQueue() {
+ return queue;
+ }
+ /**
+ * @param queue The queue to set.
+ */
+ public void setQueue(MessageQueue queue) {
+ this.queue = queue;
+ }
public GlobalContext(EngineRegistry er){
this.registry = er;
}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/MessageContext.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/MessageContext.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/context/MessageContext.java Thu Nov 4 23:07:23 2004
@@ -21,10 +21,10 @@
import javax.xml.namespace.QName;
import org.apache.axis.Constants;
-import org.apache.axis.encoding.DeseializationContext;
import org.apache.axis.encoding.SerializationContext;
-import org.apache.axis.engine.Message;
+import org.apache.axis.message.OMMessage;
import org.apache.axis.registry.EngineRegistry;
+import org.apache.axis.transport.TransportSender;
/**
* The palce where all the service specific states are kept.
* All the Global states kept in the <code>EngineRegistry</code> and all the
@@ -33,6 +33,7 @@
*/
public class MessageContext {
private int messageStyle = Constants.SOAP_STYLE_RPC_ENCODED;
+ private HashMap messages = new HashMap();
/**
* @return Returns the faultOut.
*/
@@ -46,18 +47,6 @@
this.faultOut = faultOut;
}
/**
- * @return Returns the sourceIn.
- */
- public DeseializationContext getSourceIn() {
- return sourceIn;
- }
- /**
- * @param sourceIn The sourceIn to set.
- */
- public void setSourceIn(DeseializationContext sourceIn) {
- this.sourceIn = sourceIn;
- }
- /**
* @return Returns the sourceOut.
*/
public SerializationContext getSourceOut() {
@@ -77,7 +66,6 @@
globalContext = new GlobalContext(er);
sessionContext = new SimpleSessionContext();
}
- private DeseializationContext sourceIn;
private SerializationContext sourceOut;
private SerializationContext faultOut;
@@ -88,8 +76,22 @@
private HashMap properties = new HashMap();
private boolean useSOAPAction = true;
private String soapAction = "";
- private Message inMessage;
- private Message outMessage;
+ private OMMessage inMessage;
+ private OMMessage outMessage;
+ private TransportSender transportSender;
+
+ /**
+ * @return Returns the transportSender.
+ */
+ public TransportSender getTransportSender() {
+ return transportSender;
+ }
+ /**
+ * @param transportSender The transportSender to set.
+ */
+ public void setTransportSender(TransportSender transportSender) {
+ this.transportSender = transportSender;
+ }
/**
* @return Returns the soapAction.
*/
@@ -207,25 +209,25 @@
/**
* @return Returns the inMessage.
*/
- public Message getInMessage() {
+ public OMMessage getInMessage() {
return inMessage;
}
/**
* @param inMessage The inMessage to set.
*/
- public void setInMessage(Message inMessage) {
+ public void setInMessage(OMMessage inMessage) {
this.inMessage = inMessage;
}
/**
* @return Returns the outMessage.
*/
- public Message getOutMessage() {
+ public OMMessage getOutMessage() {
return outMessage;
}
/**
* @param outMessage The outMessage to set.
*/
- public void setOutMessage(Message outMessage) {
+ public void setOutMessage(OMMessage outMessage) {
this.outMessage = outMessage;
}
/**
@@ -240,4 +242,8 @@
public void setMessageStyle(int messageStyle) {
this.messageStyle = messageStyle;
}
+
+ public void addRelatedMessageContext(String key,MessageContext msgctx){
+ messages.put(key,msgctx);
+ }
}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/AxisEngine.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/AxisEngine.java Thu Nov 4 23:07:23 2004
@@ -23,7 +23,6 @@
import org.apache.axis.AxisFault;
import org.apache.axis.CommonExecutor;
import org.apache.axis.context.MessageContext;
-import org.apache.axis.encoding.DeseializationContext;
import org.apache.axis.registry.EngineRegistry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -128,9 +127,9 @@
globel = registry.getGlobal();
- DeseializationContext deserializationContext = mc.getSourceIn();
- mc.getInMessage().setEnvelope(deserializationContext.parseEnvelope());
- mc.getInMessage().setHeaders(deserializationContext.parseHeaders());
+// DeseializationContext deserializationContext = mc.getSourceIn();
+// mc.getInMessage().setEnvelope(deserializationContext.parseEnvelope());
+// mc.getInMessage().setHeaders(deserializationContext.parseHeaders());
@@ -141,12 +140,6 @@
globel.recive(mc);
executionStack.push(globel);
- QName operationName = deserializationContext.enterTheBody(mc.getMessageStyle());
- if(operationName != null){
- mc.setCurrentOperation(operationName);
- }else{
- //TODO if the Operation is null find it in some other way
- }
log.info("Dispatch Service Name");
//dispatch the service Name
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/ConcreateCommonExecuter.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/ConcreateCommonExecuter.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/ConcreateCommonExecuter.java Thu Nov 4 23:07:23 2004
@@ -57,7 +57,6 @@
flowInclude = new ConcreateFlowInclude();
modules = new ConcreateModuleInclude();
typemappings = new ConcreateTypeMappingInclude();
-
}
/**
* @return
@@ -200,7 +199,4 @@
invoker.invoke(mc);
log.info("invoked "+getClass());
}
-
-
-
}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/Sender.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/engine/Sender.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2003,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 org.apache.axis.engine;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.context.MessageContext;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class Sender {
+ public void send(MessageContext msgCtx) throws AxisFault{
+ AxisEngine engine = new AxisEngine(msgCtx.getGlobalContext().getRegistry());
+ engine.send(msgCtx);
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/AbstractHandler.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/AbstractHandler.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2003,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 org.apache.axis.handlers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Handler;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.registry.Parameter;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public abstract class AbstractHandler implements Handler{
+ private QName name;
+ public QName getName() {
+ return name;
+ }
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ }
+ public void revoke(MessageContext msgContext) {
+ }
+ public void setName(QName name) {
+ this.name = name;
+ }
+ public void addParameter(Parameter param) {
+ //TODO
+ }
+ public void cleanup() throws AxisFault {
+ }
+ public Parameter getParameter(String key) {
+ //TODO
+ return null;
+ }
+ public void init() throws AxisFault {
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/DocLitOpNameFinder.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/DocLitOpNameFinder.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2003,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 org.apache.axis.handlers;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class DocLitOpNameFinder {
+
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/RPCOpNameFinder.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/handlers/RPCOpNameFinder.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2003,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 org.apache.axis.handlers;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.message.OMMessage;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class RPCOpNameFinder extends AbstractHandler{
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ int style = msgContext.getMessageStyle();
+ if(Constants.SOAP_STYLE_RPC_ENCODED == style || style == Constants.SOAP_STYLE_RPC_LITERAL){
+ OMMessage message = msgContext.getInMessage();
+ OMNode node = null;
+ OMElement element = message.getEnvelope().getBody();
+ if(Constants.ELEM_BODY.equals(element.getLocalName())){
+ Iterator bodychilderen = element.getChildren();
+ while(bodychilderen.hasNext()){
+ node = (OMNode)bodychilderen.next();
+
+ //TODO
+ if(node == null){
+ System.out.println("Why the some nodes are null :( :( :(");
+ continue;
+ }
+
+ if(node.getType() == OMNode.ELEMENT_NODE){
+ OMElement bodyChild = (OMElement)node;
+
+ OMNamespace omns = bodyChild.getNamespace();
+
+ if(omns != null){
+ String ns = omns.getValue();
+ if(ns != null){
+ msgContext.setCurrentOperation(new QName(ns,bodyChild.getLocalName()));
+ }
+ }
+ throw new AxisFault("SOAP Body must be NS Qualified");
+ }
+ }
+ }
+ }
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/OMMessage.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/OMMessage.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,67 @@
+/*
+ * Created on Oct 18, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.message;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+import javax.print.attribute.standard.OutputDeviceAssigned;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Constants;
+
+import org.apache.axis.om.OMDocument;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.xpp.StreamingXPPOMBuilder;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+/**
+ * @author hemapani
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class OMMessage {
+ private SOAPEnvelope envelope;
+ //TODO Binary info if they are there
+
+ public OMMessage(InputStream in)throws Exception{
+ XmlPullParserFactory pf = XmlPullParserFactory.newInstance();
+ pf.setNamespaceAware(true);
+ XmlPullParser parser = pf.newPullParser();
+ parser.setInput(new InputStreamReader(in));
+ OMDocument omdoc = new StreamingXPPOMBuilder(parser).getModel().getDocument();
+ envelope = new SOAPEnvelope(omdoc.getDocumentElement());
+
+ }
+
+ public OMMessage(Object[] obj)throws Exception{
+ //TODO create OMMessage
+ }
+
+ public void serialize(OutputStream out){
+
+ }
+ /**
+ * @return Returns the envelope.
+ */
+ public SOAPEnvelope getEnvelope() {
+ return envelope;
+ }
+ /**
+ * @param envelope The envelope to set.
+ */
+ public void setEnvelope(SOAPEnvelope envelope) {
+ this.envelope = envelope;
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/SOAPEnvelope.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/SOAPEnvelope.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/message/SOAPEnvelope.java Thu Nov 4 23:07:23 2004
@@ -15,12 +15,15 @@
*/
package org.apache.axis.message;
+import java.util.Iterator;
+
import javax.xml.soap.SOAPConstants;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
/**
* @author Srinath Perera (hemapani@opensource.lk)
@@ -28,13 +31,14 @@
public class SOAPEnvelope {
private SOAPConstants soapcostants;
private OMElement envelope;
+ private SOAPHeaders headers;
+ private OMElement body;
public SOAPEnvelope(OMElement envelope) throws AxisFault{
this.envelope = envelope;
String localName = envelope.getLocalName();
if (!localName.equals(Constants.ELEM_ENVELOPE))
throw new AxisFault(Constants.ELEM_ENVELOPE + " Tag not found ... not a SOAP message");
-
OMNamespace omns = envelope.getNamespace();
if(omns != null){
@@ -49,32 +53,67 @@
}
}
}else{
- throw new AxisFault("the Envelope got to be Name spache qualified");
+ throw new AxisFault("the Envelope got to be Name space qualified");
+ }
+ Iterator childeren = this.envelope.getChildren();
+
+ OMElement omele = null;
+
+ while(childeren.hasNext()){
+ OMNode node = (OMNode)childeren.next();
+ if(node.getType() == OMNode.ELEMENT_NODE){
+ omele = (OMElement)node;
+ if(Constants.ELEM_HEADER.equals(omele.getLocalName())){
+ if(body != null){
+ throw new AxisFault("Body can never come before the Haders ");
+ }
+ if(headers != null){
+ throw new AxisFault("Only one Header block allowed");
+ }
+ headers = new SOAPHeaders(omele);
+ }else if(Constants.ELEM_BODY.equals(omele.getLocalName())){
+ if(headers != null){
+ throw new AxisFault("Only one Body block allowed");
+ }
+ body = omele;
+ }else{
+ throw new AxisFault("Only Body and Header allowed");
+ }
+ }
}
}
+ public SOAPConstants getSoapcostants() {
+ return soapcostants;
+ }
/**
- * @return Returns the omelement.
+ * @param soapcostants The soapcostants to set.
*/
- public OMElement getOmelement() {
- return envelope;
+ public void setSoapcostants(SOAPConstants soapcostants) {
+ this.soapcostants = soapcostants;
}
/**
- * @param omelement The omelement to set.
+ * @return Returns the body.
*/
- public void setOmelement(OMElement omelement) {
- this.envelope = omelement;
+ public OMElement getBody() {
+ return body;
}
/**
- * @return Returns the soapcostants.
+ * @param body The body to set.
*/
- public SOAPConstants getSoapcostants() {
- return soapcostants;
+ public void setBody(OMElement body) {
+ this.body = body;
}
/**
- * @param soapcostants The soapcostants to set.
+ * @return Returns the headers.
*/
- public void setSoapcostants(SOAPConstants soapcostants) {
- this.soapcostants = soapcostants;
+ public SOAPHeaders getHeaders() {
+ return headers;
+ }
+ /**
+ * @param headers The headers to set.
+ */
+ public void setHeaders(SOAPHeaders headers) {
+ this.headers = headers;
}
}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/ASyncProvider.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/ASyncProvider.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003,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 org.apache.axis.providers;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Provider;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.engine.Sender;
+import org.apache.axis.handlers.AbstractHandler;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class ASyncProvider extends AbstractHandler{
+ private Provider doworkProvider;
+ public ASyncProvider(Provider doworkProvider){
+ this.doworkProvider = doworkProvider;
+ }
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ msgContext.getGlobalContext().getQueue().submitAJob(msgContext);
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SimpleJavaProvider.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SimpleJavaProvider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SimpleJavaProvider.java Thu Nov 4 23:07:23 2004
@@ -27,6 +27,7 @@
import org.apache.axis.context.MessageContext;
import org.apache.axis.context.SessionContext;
import org.apache.axis.engine.Service;
+import org.apache.axis.message.OMMessage;
import org.apache.axis.registry.Parameter;
/**
@@ -123,8 +124,7 @@
Object[] parms = deserializeParameters(msgContext,method);
//invoke the WebService
Object result = method.invoke(obj,parms);
- //TODO create a OM and put this back to the MessgaeContext
-
+ msgContext.setOutMessage(new OMMessage(parms));
} catch (SecurityException e) {
throw AxisFault.makeFault(e);
} catch (IllegalArgumentException e) {
@@ -132,6 +132,8 @@
} catch (IllegalAccessException e) {
throw AxisFault.makeFault(e);
} catch (InvocationTargetException e) {
+ throw AxisFault.makeFault(e);
+ } catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SyncProvider.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/providers/SyncProvider.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2003,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 org.apache.axis.providers;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Provider;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.engine.Sender;
+import org.apache.axis.handlers.AbstractHandler;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class SyncProvider extends AbstractHandler{
+ private Provider doworkProvider;
+ public SyncProvider(Provider doworkProvider){
+ this.doworkProvider = doworkProvider;
+ }
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ doworkProvider.invoke(msgContext);
+ Sender sender = new Sender();
+ //TODO .. do we create a new MsgContext
+ sender.send(msgContext);
+
+ }
+}
Added: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/TransportSender.java
==============================================================================
--- (empty file)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/TransportSender.java Thu Nov 4 23:07:23 2004
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2003,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 org.apache.axis.transport;
+
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.AxisFault;
+import org.apache.axis.Handler;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.handlers.AbstractHandler;
+import org.apache.axis.message.OMMessage;
+import org.apache.axis.registry.Parameter;
+
+/**
+ * @author Srinath Perera (hemapani@opensource.lk)
+ */
+public class TransportSender extends AbstractHandler implements Handler {
+ private OutputStream out;
+ public TransportSender(OutputStream out){
+ this.out = out;
+ }
+ public void invoke(MessageContext msgContext) throws AxisFault {
+ OMMessage message = msgContext.getOutMessage();
+ message.serialize(out);
+ }
+}
Modified: webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/http/SimpleAxisWorker.java
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/http/SimpleAxisWorker.java (original)
+++ webservices/axis/trunk/java/dev/scratch/srinath_eran_jaliya/src/java/org/apache/axis/transport/http/SimpleAxisWorker.java Thu Nov 4 23:07:23 2004
@@ -24,13 +24,10 @@
import org.apache.axis.context.MessageContext;
import org.apache.axis.encoding.Base64;
-import org.apache.axis.encoding.ConcreateDeserializationContext;
-import org.apache.axis.encoding.ConcreateSerializationContext;
-import org.apache.axis.encoding.DeseializationContext;
-import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.engine.AxisEngine;
-import org.apache.axis.engine.Message;
+import org.apache.axis.message.OMMessage;
import org.apache.axis.registry.EngineRegistry;
+import org.apache.axis.transport.TransportSender;
import org.apache.axis.utils.Messages;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -159,8 +156,7 @@
// create an Axis server
MessageContext msgContext = new MessageContext(engine.getRegistry());
- Message requestMessage = null;
- Message resposeMessage = null;
+
// Reusuable, buffered, content length controlled, InputStream
NonBlockingBufferedInputStream is =
@@ -271,43 +267,36 @@
msgContext.setUseSOAPAction(true);
msgContext.setSoapAction(soapActionString);
}
- DeseializationContext dc = new ConcreateDeserializationContext(is);
- msgContext.setSourceIn(dc);
- requestMessage = new Message(dc);
- }
- msgContext.setInMessage(requestMessage);
- EngineRegistry reg = engine.getRegistry();
+ // Send it on its way...
+ OutputStream out = socket.getOutputStream();
+ out.write(HTTP);
+ out.write(status);
+ log.info("status written");
+ msgContext.setTransportSender(new TransportSender(out));
+
+ msgContext.setInMessage(new OMMessage(is));
+ EngineRegistry reg = engine.getRegistry();
+ // invoke the Axis engine
+ engine.recive(msgContext);
+ log.info("revice done");
+ out.flush();
+ }
- // invoke the Axis engine
- engine.recive(msgContext);
- log.info("revice done");
- engine.send(msgContext);
- log.info("send done");
- // Retrieve the response from Axis
- resposeMessage = msgContext.getOutMessage();
} catch (Exception e) {
e.printStackTrace();
}
- // Send it on its way...
- OutputStream out = socket.getOutputStream();
- out.write(HTTP);
- out.write(status);
- log.info("status written");
-
- if (resposeMessage != null) {
-
- //out.write(XML_MIME_STUFF);
- out.write(("\r\n" + HTTPConstants.HEADER_CONTENT_TYPE + ": " +resposeMessage.getContentType()).getBytes());
-
- out.write(SEPARATOR);
- SerializationContext sc= new ConcreateSerializationContext(out);
- resposeMessage.serialize(sc);
- }
+
+// if (resposeMessage != null) {
+//
+// //out.write(XML_MIME_STUFF);
+// out.write(("\r\n" + HTTPConstants.HEADER_CONTENT_TYPE + ": " +resposeMessage.getContentType()).getBytes());
+//
+// }
// out.write(response);
- out.flush();
+
} catch (Exception e) {
log.info(Messages.getMessage("exception00"), e);
} finally {