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 ch...@apache.org on 2005/02/15 07:23:26 UTC
svn commit: r153902 [4/8] - in
webservices/axis/trunk/java/dev/scratch/prototype2/src:
java/org/apache/axis/addressing/ java/org/apache/axis/addressing/miheaders/
java/org/apache/axis/addressing/om/ java/org/apache/axis/clientapi/
java/org/apache/axis/context/ java/org/apache/axis/deployment/
java/org/apache/axis/deployment/listener/
java/org/apache/axis/deployment/repository/utill/
java/org/apache/axis/description/ java/org/apache/axis/engine/
java/org/apache/axis/handlers/ java/org/apache/axis/om/
java/org/apache/axis/om/impl/llom/ java/org/apache/axis/om/impl/llom/builder/
java/org/apache/axis/om/impl/llom/factory/
java/org/apache/axis/om/impl/llom/serialize/
java/org/apache/axis/om/impl/llom/traverse/
java/org/apache/axis/phaseresolver/ java/org/apache/axis/providers/
java/org/apache/axis/receivers/ java/org/apache/axis/transport/
java/org/apache/axis/transport/http/ java/org/apache/axis/wsdl/wsdltowom/
java/org/apache/wsdl/ java/org/apache/wsdl/impl/ java/org/apache/wsdl/util/
test/org/apache/axis/ test/org/apache/axis/addressing/
test/org/apache/axis/addressing/miheaders/ test/org/apache/axis/clientapi/
test/org/apache/axis/deployment/ test/org/apache/axis/description/
test/org/apache/axis/encoding/ test/org/apache/axis/engine/
test/org/apache/axis/integration/ test/org/apache/axis/misc/
test/org/apache/axis/om/ test/org/apache/axis/om/builder/
test/org/apache/axis/om/builder/dummy/ test/org/apache/axis/om/factory/
test/org/apache/axis/om/impl/builder/
test/org/apache/axis/om/impl/seriliazer/
test/org/apache/axis/om/impl/streamwrapper/
test/org/apache/axis/om/impl/traverse/ test/org/apache/axis/testUtils/
test/org/apache/axis/transport/ test/org/apache/wsdl/
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/phaseresolver/PhaseResolver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/phaseresolver/PhaseResolver.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/phaseresolver/PhaseResolver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/phaseresolver/PhaseResolver.java Mon Feb 14 22:22:34 2005
@@ -1,18 +1,12 @@
package org.apache.axis.phaseresolver;
-import java.util.*;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis.description.AxisGlobal;
-import org.apache.axis.description.AxisModule;
-import org.apache.axis.description.AxisService;
-import org.apache.axis.description.AxisTransport;
-import org.apache.axis.description.Flow;
-import org.apache.axis.description.HandlerMetaData;
+import org.apache.axis.description.*;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineRegistry;
+import javax.xml.namespace.QName;
+import java.util.*;
+
/**
* Copyright 2001-2004 The Apache Software Foundation.
* <p/>
@@ -27,14 +21,12 @@
* 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.
- *
*/
public class PhaseResolver {
- private EngineRegistry engineRegistry ;
+ private EngineRegistry engineRegistry;
private AxisService axisService;
- private PhaseHolder phaseHolder ;
-
+ private PhaseHolder phaseHolder;
/**
@@ -44,13 +36,13 @@
this.engineRegistry = engineRegistry;
}
- public PhaseResolver(EngineRegistry engineRegistry, AxisService axisService ) {
+ public PhaseResolver(EngineRegistry engineRegistry, AxisService axisService) {
this.engineRegistry = engineRegistry;
this.axisService = axisService;
}
public void buildchains() throws PhaseException, AxisFault {
- for(int i =1 ; i < 4 ; i++) {
+ for (int i = 1; i < 4; i++) {
buildExcutionChains(i);
}
@@ -60,14 +52,15 @@
/**
* this opeartion is used to build all the three cahins ,
* so type varible is used to difrenciate them
- * type = 1 inflow
- * type = 2 out flow
- * type = 3 fault flow
+ * type = 1 inflow
+ * type = 2 out flow
+ * type = 3 fault flow
+ *
* @param type
* @throws AxisFault
*/
- private void buildExcutionChains(int type) throws AxisFault, PhaseException {
- int flowtype = type;
+ private void buildExcutionChains(int type) throws AxisFault, PhaseException {
+ int flowtype = type;
ArrayList allHandlers = new ArrayList();
// int count = server.getModuleCount();
// QName moduleName;
@@ -105,32 +98,35 @@
// service module handlers
Collection collection = axisService.getModules();
Iterator itr = collection.iterator();
- while(itr.hasNext()){
- QName moduleref = (QName)itr.next();
+ while (itr.hasNext()) {
+ QName moduleref = (QName) itr.next();
// }
// Vector modules = (Vector)axisService.getModules();
// for (int i = 0; i < modules.size(); i++) {
// QName moduleref = (QName) modules.elementAt(i);
module = engineRegistry.getModule(moduleref);
- switch (flowtype){
- case 1 : {
- flow = module.getInFlow();
- break;
- }
- case 2 : {
- flow = module.getOutFlow();
- break;
- }
- case 3 : {
- flow = module.getFaultFlow();
- break;
- }
+ switch (flowtype) {
+ case 1:
+ {
+ flow = module.getInFlow();
+ break;
+ }
+ case 2:
+ {
+ flow = module.getOutFlow();
+ break;
+ }
+ case 3:
+ {
+ flow = module.getFaultFlow();
+ break;
+ }
}
- if(flow != null ){
- for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
+ if (flow != null) {
+ for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetaData metadata = flow.getHandler(j);
//todo change this in properway
- if (metadata.getRules().getPhaseName().equals("") ){
+ if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("service");
}
allHandlers.add(metadata);
@@ -138,31 +134,34 @@
}
}
- switch (flowtype){
- case 1 : {
- flow = axisService.getInFlow();
- break;
- }
- case 2 : {
- flow = axisService.getOutFlow();
- break;
- }
- case 3 : {
- flow = axisService.getFaultFlow();
- break;
- }
+ switch (flowtype) {
+ case 1:
+ {
+ flow = axisService.getInFlow();
+ break;
+ }
+ case 2:
+ {
+ flow = axisService.getOutFlow();
+ break;
+ }
+ case 3:
+ {
+ flow = axisService.getFaultFlow();
+ break;
+ }
}
- if(flow != null ){
- for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
+ if (flow != null) {
+ for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetaData metadata = flow.getHandler(j);
//todo change this in properway
- if (metadata.getRules().getPhaseName().equals("")){
+ if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("service");
}
allHandlers.add(metadata);
}
}
- phaseHolder = new PhaseHolder(engineRegistry,axisService);
+ phaseHolder = new PhaseHolder(engineRegistry, axisService);
for (int i = 0; i < allHandlers.size(); i++) {
HandlerMetaData handlerMetaData = (HandlerMetaData) allHandlers.get(i);
@@ -172,12 +171,12 @@
}
- public void buildTranspotsChains() throws PhaseException {
+ public void buildTranspotsChains() throws PhaseException {
try {
HashMap transports = engineRegistry.getTransports();
Collection coltrnsport = transports.values();
for (Iterator iterator = coltrnsport.iterator(); iterator.hasNext();) {
- AxisTransport transport = (AxisTransport)iterator.next();
+ AxisTransport transport = (AxisTransport) iterator.next();
buildTransportChains(transport);
}
} catch (AxisFault axisFault) {
@@ -186,70 +185,76 @@
}
- private void buildTransportChains(AxisTransport transport) throws PhaseException {
+ private void buildTransportChains(AxisTransport transport) throws PhaseException {
Flow flow = null;
- for(int type =1 ; type <4 ; type ++){
- phaseHolder = new PhaseHolder(engineRegistry,null);
- switch(type){
- case 1 : {
- flow = transport.getInFlow();
- break;
- }
- case 2 : {
- flow = transport.getOutFlow();
- break;
- }
- case 3 : {
- flow = transport.getFaultFlow();
- break;
- }
+ for (int type = 1; type < 4; type++) {
+ phaseHolder = new PhaseHolder(engineRegistry, null);
+ switch (type) {
+ case 1:
+ {
+ flow = transport.getInFlow();
+ break;
+ }
+ case 2:
+ {
+ flow = transport.getOutFlow();
+ break;
+ }
+ case 3:
+ {
+ flow = transport.getFaultFlow();
+ break;
+ }
}
- if(flow != null ){
- for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
+ if (flow != null) {
+ for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetaData metadata = flow.getHandler(j);
//todo change this in properway
- if (metadata.getRules().getPhaseName().equals("")){
+ if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("transport");
}
phaseHolder.addHandler(metadata);
}
}
- phaseHolder.buildTransportChain(transport, type);
+ phaseHolder.buildTransportChain(transport, type);
}
}
public void buildGlobalChains(AxisGlobal global) throws AxisFault, PhaseException {
- List modules = (List)global.getModules();
+ List modules = (List) global.getModules();
int count = modules.size();
QName moduleName;
AxisModule module;
Flow flow = null;
- for(int type = 1 ; type < 4 ; type ++){
- phaseHolder = new PhaseHolder(engineRegistry,null);
- for(int intA=0 ; intA < count; intA ++){
- moduleName = (QName)modules.get(intA);
+ for (int type = 1; type < 4; type++) {
+ phaseHolder = new PhaseHolder(engineRegistry, null);
+ for (int intA = 0; intA < count; intA++) {
+ moduleName = (QName) modules.get(intA);
module = engineRegistry.getModule(moduleName);
- switch (type){
- case 1 : {
- flow = module.getInFlow();
- break;
- }
- case 2 : {
- flow = module.getOutFlow();
- break;
- }
- case 3 : {
- flow = module.getFaultFlow();
- break;
- }
+ switch (type) {
+ case 1:
+ {
+ flow = module.getInFlow();
+ break;
+ }
+ case 2:
+ {
+ flow = module.getOutFlow();
+ break;
+ }
+ case 3:
+ {
+ flow = module.getFaultFlow();
+ break;
+ }
}
- if(flow != null ){
- for(int j= 0 ; j < flow.getHandlerCount() ; j++ ){
+ if (flow != null) {
+ for (int j = 0; j < flow.getHandlerCount(); j++) {
HandlerMetaData metadata = flow.getHandler(j);
//todo change this in properway
- if (metadata.getRules().getPhaseName().equals("")){
+ if (metadata.getRules().getPhaseName().equals("")) {
metadata.getRules().setPhaseName("global");
}
phaseHolder.addHandler(metadata);
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/AbstractProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/AbstractProvider.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/AbstractProvider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/AbstractProvider.java Mon Feb 14 22:22:34 2005
@@ -15,16 +15,16 @@
*/
package org.apache.axis.providers;
-import javax.xml.namespace.QName;
-
import org.apache.axis.context.MessageContext;
import org.apache.axis.engine.Provider;
+import javax.xml.namespace.QName;
+
/**
* This is the Absract provider. It is just a another handler. the
* protected abstract methods are only for the sake of braking down the logic
*/
-public abstract class AbstractProvider implements Provider{
+public abstract class AbstractProvider implements Provider {
protected QName name;
public QName getName() {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/RawXMLProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/RawXMLProvider.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/RawXMLProvider.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/providers/RawXMLProvider.java Mon Feb 14 22:22:34 2005
@@ -16,10 +16,6 @@
package org.apache.axis.providers;
-import java.lang.reflect.Method;
-
-import javax.xml.namespace.QName;
-
import org.apache.axis.context.MessageContext;
import org.apache.axis.context.SessionContext;
import org.apache.axis.description.AxisService;
@@ -33,6 +29,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.xml.namespace.QName;
+import java.lang.reflect.Method;
+
/**
* This is a Simple java Provider.
*/
@@ -55,18 +54,17 @@
try {
AxisService service = msgContext.getService();
classLoader = service.getClassLoader();
- Class implClass = service.getServiceClass();
+ Class implClass = service.getServiceClass();
return implClass.newInstance();
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
- public Object getTheImplementationObject(
- MessageContext msgContext)throws AxisFault{
- AxisService service = msgContext.getService();
- QName serviceName = service.getName();
- if(Constants.APPLICATION_SCOPE.equals(scope)){
+ public Object getTheImplementationObject(MessageContext msgContext) throws AxisFault {
+ AxisService service = msgContext.getService();
+ QName serviceName = service.getName();
+ if (Constants.APPLICATION_SCOPE.equals(scope)) {
return makeNewServiceObject(msgContext);
} else if (Constants.SESSION_SCOPE.equals(scope)) {
SessionContext sessionContext = msgContext.getSessionContext();
@@ -91,7 +89,6 @@
}
-
public MessageContext invoke(MessageContext msgContext) throws AxisFault {
try {
//get the implementation class for the Web Service
@@ -107,14 +104,14 @@
break;
}
}
-
+
OMElement methodElement = OMUtils.getFirstChildElement(msgContext.getEnvelope().getBody());
OMElement parmeter = OMUtils.getFirstChildElement(methodElement);
Object[] parms = new Object[]{parmeter};
//invoke the WebService
OMElement result = (OMElement) method.invoke(obj, parms);
- MessageContext msgContext1 = new MessageContext(msgContext.getGlobalContext().getRegistry(),msgContext.getProperties());
+ MessageContext msgContext1 = new MessageContext(msgContext.getGlobalContext().getRegistry(), msgContext.getProperties());
SOAPEnvelope envelope = OMFactory.newInstance().getDefaultEnvelope();
envelope.getBody().setFirstChild(result);
@@ -123,7 +120,7 @@
return msgContext1;
} catch (Exception e) {
throw AxisFault.makeFault(e);
- }
+ }
}
public void revoke(MessageContext msgContext) {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/receivers/InOutSyncReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/receivers/InOutSyncReceiver.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/receivers/InOutSyncReceiver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/receivers/InOutSyncReceiver.java Mon Feb 14 22:22:34 2005
@@ -16,8 +16,6 @@
package org.apache.axis.receivers;
-import javax.xml.namespace.QName;
-
import org.apache.axis.context.MessageContext;
import org.apache.axis.description.HandlerMetaData;
import org.apache.axis.engine.AxisFault;
@@ -28,14 +26,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.xml.namespace.QName;
+
public class InOutSyncReceiver extends AbstractHandler implements Receiver {
protected Log log = LogFactory.getLog(getClass());
- public static final QName NAME = new QName("http://axis.ws.apache.org","InOutSyncReceiver");
-
+ public static final QName NAME = new QName("http://axis.ws.apache.org", "InOutSyncReceiver");
+
+
+ public InOutSyncReceiver() {
+ init(new HandlerMetaData(NAME));
+ }
- public InOutSyncReceiver(){
- init(new HandlerMetaData(NAME));
- }
public void invoke(final MessageContext msgContext) throws AxisFault {
if (msgContext.isNewThreadRequired()) {
Runnable runner = new Runnable() {
@@ -57,11 +58,11 @@
public void invokeAndsend(MessageContext msgContext) throws AxisFault {
//org.TimeRecorder.BEFORE_INVOKE = System.currentTimeMillis();
- Provider provider = msgContext.getService().getProvider();
- log.info("start invoke the web service impl");
- MessageContext outMsgContext = provider.invoke(msgContext);
+ Provider provider = msgContext.getService().getProvider();
+ log.info("start invoke the web service impl");
+ MessageContext outMsgContext = provider.invoke(msgContext);
//org.TimeRecorder.AFTER_INVOKE = System.currentTimeMillis();
- log.info("Invoked the Web Servivces impl");
+ log.info("Invoked the Web Servivces impl");
Sender sender = new Sender();
sender.send(msgContext);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/AbstractTransportSender.java Mon Feb 14 22:22:34 2005
@@ -16,13 +16,6 @@
package org.apache.axis.transport;
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
import org.apache.axis.description.HandlerMetaData;
@@ -32,46 +25,49 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.OutputStream;
+import java.io.Writer;
+
/**
*/
public abstract class AbstractTransportSender
- extends AbstractHandler
- implements TransportSender {
+ extends AbstractHandler
+ implements TransportSender {
private Log log = LogFactory.getLog(getClass());
public static final QName NAME =
- new QName("http://axis.ws.apache.org", "TransportSender");
+ new QName("http://axis.ws.apache.org", "TransportSender");
protected OutputStream outS;
+
public AbstractTransportSender() {
init(new HandlerMetaData(NAME));
}
+
public void invoke(MessageContext msgContext) throws AxisFault {
Writer out = null;
if (msgContext.isProcessingFault()) {
//Means we are processing fault
if (msgContext.getFaultTo() != null) {
- log.info(
- "Obtain the output stream to send the fault flow to "
+ log.info("Obtain the output stream to send the fault flow to "
+ msgContext.getFaultTo().getAddress());
out = obtainOutputStream(msgContext, msgContext.getFaultTo());
} else {
- log.info(
- "Obtain the output stream to send the fault flow to ANONYMOUS");
+ log.info("Obtain the output stream to send the fault flow to ANONYMOUS");
out = obtainOutputStream(msgContext);
}
} else {
if (msgContext.getTo() != null) {
- log.info(
- "Obtain the output stream to send to To flow to "
+ log.info("Obtain the output stream to send to To flow to "
+ msgContext.getTo().getAddress());
out = obtainOutputStream(msgContext, msgContext.getTo());
} else if (msgContext.getReplyTo() != null) {
- log.info(
- "Obtain the output stream to send to ReplyTo flow to "
+ log.info("Obtain the output stream to send to ReplyTo flow to "
+ msgContext.getReplyTo().getAddress());
out = obtainOutputStream(msgContext, msgContext.getTo());
} else {
- log.info(
- "Obtain the output stream to send the fault flow to ANONYMOUS");
+ log.info("Obtain the output stream to send the fault flow to ANONYMOUS");
out = obtainOutputStream(msgContext);
}
}
@@ -82,7 +78,7 @@
try {
// org.TimeRecorder.BEFORE_SERIALIZE = System.currentTimeMillis();
outputWriter =
- XMLOutputFactory.newInstance().createXMLStreamWriter(out);
+ XMLOutputFactory.newInstance().createXMLStreamWriter(out);
envelope.serialize(outputWriter, false);
outputWriter.flush();
if (outS != null) {
@@ -103,15 +99,14 @@
protected void startSending(MessageContext msgContext) throws AxisFault {
}
- protected abstract Writer obtainOutputStream(
- MessageContext msgContext,
- EndpointReference epr)
- throws AxisFault;
+ protected abstract Writer obtainOutputStream(MessageContext msgContext,
+ EndpointReference epr)
+ throws AxisFault;
protected abstract Writer obtainOutputStream(MessageContext msgContext)
- throws AxisFault;
+ throws AxisFault;
protected void finalizeSending(MessageContext msgContext)
- throws AxisFault {
+ throws AxisFault {
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciver.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciver.java Mon Feb 14 22:22:34 2005
@@ -17,5 +17,5 @@
import org.apache.axis.handlers.AbstractHandler;
-public abstract class TransportReciver extends AbstractHandler{
+public abstract class TransportReciver extends AbstractHandler {
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciverLocator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciverLocator.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciverLocator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportReciverLocator.java Mon Feb 14 22:22:34 2005
@@ -25,13 +25,13 @@
public static final String TRANSPORT_HTTP = "http";
public static TransportReciver locate(MessageContext msgContext)
- throws AxisFault {
+ throws AxisFault {
String type =
- (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
+ (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
if (TransportReciverLocator.TRANSPORT_HTTP.equals(type)) {
return new HTTPTransportReciver();
- }else{
- throw new AxisFault("No tranport found");
+ } else {
+ throw new AxisFault("No tranport found");
}
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportSenderLocator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportSenderLocator.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportSenderLocator.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/TransportSenderLocator.java Mon Feb 14 22:22:34 2005
@@ -28,7 +28,7 @@
public static TransportSender locate(MessageContext msgContext) throws AxisFault {
String type = (String) msgContext.getProperty(MessageContext.TRANSPORT_TYPE);
if (TransportSenderLocator.TRANSPORT_HTTP.equals(type)) {
- return new HTTPTransportSender();
+ return new HTTPTransportSender();
}
throw new AxisFault("No tranport found");
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/AxisServlet.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/AxisServlet.java Mon Feb 14 22:22:34 2005
@@ -16,24 +16,6 @@
package org.apache.axis.transport.http;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
@@ -49,10 +31,25 @@
import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
import org.apache.axis.transport.TransportSenderLocator;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
-
-public class AxisServlet extends HttpServlet{
+public class AxisServlet extends HttpServlet {
private EngineRegistry engineRegistry;
private final String LISTSERVICES = "listServices";
@@ -66,6 +63,7 @@
throw new ServletException(e);
}
}
+
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
@@ -73,15 +71,15 @@
throws ServletException, IOException {
try {
res.setContentType("text/xml; charset=utf-8");
- AxisEngine engine = new AxisEngine(engineRegistry);
- MessageContext msgContext = new MessageContext(engineRegistry,null);
+ AxisEngine engine = new AxisEngine(engineRegistry);
+ MessageContext msgContext = new MessageContext(engineRegistry, null);
msgContext.setServerSide(true);
String filePart = req.getRequestURL().toString();
- if(filePart != null && filePart.endsWith(LISTSERVICES)) {
+ if (filePart != null && filePart.endsWith(LISTSERVICES)) {
listServices(res);
return;
}
- msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,filePart));
+ msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO, filePart));
String soapActionString = req.getHeader(HTTPConstants.HEADER_SOAP_ACTION);
@@ -90,20 +88,17 @@
}
XMLStreamReader reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new InputStreamReader(
- req.getInputStream()));
- StAXBuilder builder =
- new StAXSOAPModelBuilder(OMFactory.newInstance(), reader);
- msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
-
- msgContext.setProperty(
- MessageContext.TRANSPORT_TYPE,
- TransportSenderLocator.TRANSPORT_HTTP);
- msgContext.setProperty(
- MessageContext.TRANSPORT_WRITER,
- res.getWriter());
+ XMLInputFactory.newInstance().createXMLStreamReader(new InputStreamReader(req.getInputStream()));
+ StAXBuilder builder =
+ new StAXSOAPModelBuilder(OMFactory.newInstance(), reader);
+ msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
+
+ msgContext.setProperty(MessageContext.TRANSPORT_TYPE,
+ TransportSenderLocator.TRANSPORT_HTTP);
+ msgContext.setProperty(MessageContext.TRANSPORT_WRITER,
+ res.getWriter());
- engine.receive(msgContext);
+ engine.receive(msgContext);
} catch (AxisFault e) {
throw new ServletException(e);
} catch (XMLStreamException e) {
@@ -114,17 +109,16 @@
}
-
private void listServices(HttpServletResponse res) throws IOException {
HashMap services = engineRegistry.getServices();
HashMap operations;
String serviceName = "";
- Collection servicecol= services.values() ;
+ Collection servicecol = services.values();
Collection operationsList;
PrintWriter out = res.getWriter();
res.setContentType("text/html");
- String html = "<HTML>\n" +
+ String html = "<HTML>\n" +
"<HEAD><TITLE>Avalilable services</TITLE></HEAD>\n" +
"<BODY>\n" +
"<H1>Avalilable services</H1>\n";
@@ -135,20 +129,19 @@
operations = axisService.getOperations();
operationsList = operations.values();
serviceName = axisService.getName().getLocalPart();
- html += "<hr><h3><font color=\"blue\">"+ serviceName + "</font><h3>";
- if(operationsList.size() > 0){
- html += "<i> Availble operations</i>";
- }else {
+ html += "<hr><h3><font color=\"blue\">" + serviceName + "</font><h3>";
+ if (operationsList.size() > 0) {
+ html += "<i> Availble operations</i>";
+ } else {
html += "<i> There is no any opeartion specified</i>";
}
for (Iterator iterator1 = operationsList.iterator(); iterator1.hasNext();) {
AxisOperation axisOperation = (AxisOperation) iterator1.next();
- html += "<li>" + axisOperation.getName().getLocalPart()+ "</li>";
+ html += "<li>" + axisOperation.getName().getLocalPart() + "</li>";
}
}
out.println(html + "</BODY></HTML>");
}
-
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPConstants.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPConstants.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPConstants.java Mon Feb 14 22:22:34 2005
@@ -32,7 +32,7 @@
public static final String RESPONSE_WORD = "RESPONSE_WORD";
public static final String RESPONSE_ACK_CODE_VAL = "202";
public static final String SOCKET = "SOCKET";
-
+
public static final String HEADER_PROTOCOL_10 = "HTTP/1.0";
public static final String HEADER_PROTOCOL_11 = "HTTP/1.1";
@@ -129,8 +129,8 @@
public static final String PLUGIN_WRITER = "transport.http.plugin.writer";
public static final String PLUGIN_LOG = "transport.http.plugin.log";
public static final String PLUGIN_EXCEPTION_LOG = "transport.http.plugin.exceptionLog";
-
-
+
+
public static final char OK[] = ("200 OK").toCharArray();
public static final byte NOCONTENT[] = ("202 OK\n\n").getBytes();
public static final byte UNAUTH[] = ("401 Unauthorized").getBytes();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportReciver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportReciver.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportReciver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportReciver.java Mon Feb 14 22:22:34 2005
@@ -16,14 +16,6 @@
package org.apache.axis.transport.http;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
@@ -35,6 +27,13 @@
import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
import org.apache.axis.transport.TransportReciver;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
public class HTTPTransportReciver extends TransportReciver {
private static final int END = 1;
@@ -49,77 +48,71 @@
private boolean done = false;
public void invoke(MessageContext msgContext) throws AxisFault {
- Reader in =
- (Reader) msgContext.getProperty(
- MessageContext.TRANSPORT_READER);
- if (in != null) {
- boolean serverSide = msgContext.isServerSide();
- Map map = parseTheHeaders(in, serverSide);
- if (serverSide) {
- msgContext.setProperty(
- MessageContext.SOAP_ACTION,
+ Reader in =
+ (Reader) msgContext.getProperty(MessageContext.TRANSPORT_READER);
+ if (in != null) {
+ boolean serverSide = msgContext.isServerSide();
+ Map map = parseTheHeaders(in, serverSide);
+ if (serverSide) {
+ msgContext.setProperty(MessageContext.SOAP_ACTION,
map.get(HTTPConstants.HEADER_SOAP_ACTION));
- msgContext.setTo(
- new EndpointReference(
- AddressingConstants.WSA_TO,
- (String) map.get(HTTPConstants.REQUEST_URI)));
- //TODO see is it a Service request e.g. WSDL, list ....
- // TODO take care of the other HTTPHeaders
+ msgContext.setTo(new EndpointReference(AddressingConstants.WSA_TO,
+ (String) map.get(HTTPConstants.REQUEST_URI)));
+ //TODO see is it a Service request e.g. WSDL, list ....
+ // TODO take care of the other HTTPHeaders
- } else {
- if(HTTPConstants.RESPONSE_ACK_CODE_VAL.equals(map.get(HTTPConstants.RESPONSE_CODE))){
- //This is Ack
- return;
- }
- //TODO take care of other HTTP Headers
+ } else {
+ if (HTTPConstants.RESPONSE_ACK_CODE_VAL.equals(map.get(HTTPConstants.RESPONSE_CODE))) {
+ //This is Ack
+ return;
}
- AxisEngine axisEngine =
+ //TODO take care of other HTTP Headers
+ }
+ AxisEngine axisEngine =
new AxisEngine(msgContext.getGlobalContext().getRegistry());
- try {
- XMLStreamReader xmlreader =
+ try {
+ XMLStreamReader xmlreader =
XMLInputFactory.newInstance().createXMLStreamReader(in);
- StAXBuilder builder =
- new StAXSOAPModelBuilder(
- OMFactory.newInstance(),
- xmlreader);
- msgContext.setEnvelope(
- (SOAPEnvelope) builder.getDocumentElement());
- } catch (Exception e) {
- throw new AxisFault(e.getMessage(),e);
- }
-
- axisEngine.receive(msgContext);
+ StAXBuilder builder =
+ new StAXSOAPModelBuilder(OMFactory.newInstance(),
+ xmlreader);
+ msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentElement());
+ } catch (Exception e) {
+ throw new AxisFault(e.getMessage(), e);
+ }
+
+ axisEngine.receive(msgContext);
} else {
throw new AxisFault("Input reader not found");
}
}
- /** parses following two styles of HTTP stuff
- Server Side
- POST /axis2/services/echo HTTP/1.0
- Content-Type: text/xml; charset=utf-8
- Accept: application/soap+xml, application/dime, multipart/related, text/*
- User-Agent: Axis/1.2RC1
- Host: 127.0.0.1:8081
- Cache-Control: no-cache
- Pragma: no-cache
- SOAPAction: ""
- Content-Length: 73507
-
- HTTP/1.1 200 OK
- Content-Type: text/xml;charset=utf-8
- Date: Sat, 12 Feb 2005 10:39:39 GMT
- Server: Apache-Coyote/1.1
- Connection: close
-
-
+ /**
+ * parses following two styles of HTTP stuff
+ * Server Side
+ * POST /axis2/services/echo HTTP/1.0
+ * Content-Type: text/xml; charset=utf-8
+ * Accept: application/soap+xml, application/dime, multipart/related, text/*
+ * User-Agent: Axis/1.2RC1
+ * Host: 127.0.0.1:8081
+ * Cache-Control: no-cache
+ * Pragma: no-cache
+ * SOAPAction: ""
+ * Content-Length: 73507
+ * <p/>
+ * HTTP/1.1 200 OK
+ * Content-Type: text/xml;charset=utf-8
+ * Date: Sat, 12 Feb 2005 10:39:39 GMT
+ * Server: Apache-Coyote/1.1
+ * Connection: close
+ *
* @param reader
* @return
*/
public HashMap parseTheHeaders(Reader reader, boolean serverSide)
- throws AxisFault {
+ throws AxisFault {
HashMap map = new HashMap();
try {
@@ -135,9 +128,9 @@
length = readLine(reader, buf);
if (serverSide) {
if (buf[0] == 'P'
- && buf[1] == 'O'
- && buf[2] == 'S'
- && buf[3] == 'T') {
+ && buf[1] == 'O'
+ && buf[2] == 'S'
+ && buf[3] == 'T') {
index = 5;
value = readFirstLineArg(' ');
map.put(HTTPConstants.REQUEST_URI, value);
@@ -157,8 +150,8 @@
}
state = BEFORE_SEPERATOR;
-
-
+
+
while (!done) {
length = readLine(reader, buf);
if (length <= 0) {
@@ -166,7 +159,7 @@
}
for (int i = 0; i < length; i++) {
switch (state) {
- case BEFORE_SEPERATOR :
+ case BEFORE_SEPERATOR:
if (buf[i] == ':') {
key = str.toString();
str = new StringBuffer();
@@ -179,7 +172,7 @@
str.append(buf[i]);
}
break;
- case AFTER_SEPERATOR :
+ case AFTER_SEPERATOR:
if (buf[i] == '\n') {
value = str.toString();
map.put(key, value);
@@ -201,8 +194,7 @@
// case END:
// break;
default :
- throw new AxisFault(
- "Error Occured Unknown state " + state);
+ throw new AxisFault("Error Occured Unknown state " + state);
}
}
@@ -359,16 +351,16 @@
b[off++] = (char) c;
count++;
c = is.read();
- }else{
- if ('\n' == c) {
+ } else {
+ if ('\n' == c) {
c = is.read();
- if(c == '\r'){
+ if (c == '\r') {
c = is.read();
}
//If the next line begins with tab or space then this is a continuation.
if (c != ' ' && c != '\t') {
- if(c == '\n'){
- done = true;
+ if (c == '\n') {
+ done = true;
}
lastRead = c;
b[off++] = '\n';
@@ -376,11 +368,11 @@
break;
}
- }else{
+ } else {
c = is.read();
- }
+ }
}
-
+
}
if (c == -1) {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportSender.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportSender.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/HTTPTransportSender.java Mon Feb 14 22:22:34 2005
@@ -16,72 +16,68 @@
package org.apache.axis.transport.http;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.URL;
-
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.transport.AbstractTransportSender;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.net.*;
+
public class HTTPTransportSender extends AbstractTransportSender {
- protected Writer out;
+ protected Writer out;
private Socket socket;
-
+
protected Writer obtainOutputStream(MessageContext msgContext)
- throws AxisFault {
-
- if (!msgContext.isServerSide()) {
- EndpointReference toURL = msgContext.getTo();
-
- if(toURL != null){
- try {
- URL url = new URL(toURL.getAddress());
- SocketAddress add = new InetSocketAddress(url.getHost(),url.getPort());
- socket = new Socket();
- socket.connect(add);
-
- StringBuffer buf = new StringBuffer();
- buf.append("POST ").append(url.getFile()).append(" HTTP/1.0\n");
- buf.append("Content-Type: text/xml; charset=utf-8\n");
buf.append("Accept: application/soap+xml, application/dime, multipart/related, text/*\n");
- buf.append("Host: ").append(url.getHost()).append("\n");
- buf.append("Cache-Control: no-cache\n");
- buf.append("Pragma: no-cache\n");
- buf.append("SOAPAction: \"\"\n\n");
- outS = socket.getOutputStream();
- out = new OutputStreamWriter(outS);
- out.write(buf.toString().toCharArray());
+ throws AxisFault {
+
+ if (!msgContext.isServerSide()) {
+ EndpointReference toURL = msgContext.getTo();
+
+ if (toURL != null) {
+ try {
+ URL url = new URL(toURL.getAddress());
+ SocketAddress add = new InetSocketAddress(url.getHost(), url.getPort());
+ socket = new Socket();
+ socket.connect(add);
+
+ StringBuffer buf = new StringBuffer();
+ buf.append("POST ").append(url.getFile()).append(" HTTP/1.0\n");
+ buf.append("Content-Type: text/xml; charset=utf-8\n");
+ buf.append("Accept: application/soap+xml, application/dime, multipart/related, text/*\n");
+ buf.append("Host: ").append(url.getHost()).append("\n");
+ buf.append("Cache-Control: no-cache\n");
+ buf.append("Pragma: no-cache\n");
+ buf.append("SOAPAction: \"\"\n\n");
+ outS = socket.getOutputStream();
+ out = new OutputStreamWriter(outS);
+ out.write(buf.toString().toCharArray());
// URLConnection connection = url.openConnection();
// connection.setDoOutput(true);
// out = new OutputStreamWriter(connection.getOutputStream());
- msgContext.setProperty(MessageContext.TRANSPORT_READER,new InputStreamReader(socket.getInputStream()));
- msgContext.setProperty(HTTPConstants.SOCKET,socket);
- } catch (MalformedURLException e) {
- throw new AxisFault(e.getMessage(),e);
- } catch (IOException e) {
- throw new AxisFault(e.getMessage(),e);
- }
-
- }else{
- throw new AxisFault("to EPR must be specified");
+ msgContext.setProperty(MessageContext.TRANSPORT_READER, new InputStreamReader(socket.getInputStream()));
+ msgContext.setProperty(HTTPConstants.SOCKET, socket);
+ } catch (MalformedURLException e) {
+ throw new AxisFault(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new AxisFault(e.getMessage(), e);
}
-
- }else{
- out =
- (Writer) msgContext.getProperty(
- MessageContext.TRANSPORT_WRITER);
+
+ } else {
+ throw new AxisFault("to EPR must be specified");
}
+ } else {
+ out =
+ (Writer) msgContext.getProperty(MessageContext.TRANSPORT_WRITER);
+ }
+
if (out == null) {
throw new AxisFault("can not find the suffient information to find endpoint");
} else {
@@ -90,18 +86,17 @@
}
- protected Writer obtainOutputStream(
- MessageContext msgContext,
- EndpointReference epr)
- throws AxisFault {
+ protected Writer obtainOutputStream(MessageContext msgContext,
+ EndpointReference epr)
+ throws AxisFault {
//TODO this is temporay work around
return obtainOutputStream(msgContext);
}
- protected void finalizeSending(MessageContext msgContext)throws AxisFault {
+ protected void finalizeSending(MessageContext msgContext) throws AxisFault {
}
- protected void startSending(MessageContext msgContext)throws AxisFault {
+ protected void startSending(MessageContext msgContext) throws AxisFault {
// Content-Type: text/xml; charset=utf-8
// Accept: application/soap+xml, application/dime, multipart/related, text/*
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/SimpleHTTPServer.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/transport/http/SimpleHTTPServer.java Mon Feb 14 22:22:34 2005
@@ -16,14 +16,6 @@
package org.apache.axis.transport.http;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.ServerSocket;
-import java.net.Socket;
-
import org.apache.axis.context.MessageContext;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineRegistry;
@@ -32,6 +24,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.io.*;
+import java.net.ServerSocket;
+import java.net.Socket;
+
/**
* This is a simple implementation of an HTTP server for processing
* SOAP requests via Apache's xml-axis. This is not intended for production
@@ -101,11 +97,11 @@
throw new AxisFault("Engine Must be null");
}
Writer out =
- new OutputStreamWriter(socket.getOutputStream());
+ new OutputStreamWriter(socket.getOutputStream());
Reader in =
- new InputStreamReader(socket.getInputStream());
+ new InputStreamReader(socket.getInputStream());
MessageContext msgContext =
- new MessageContext(this.engineReg, null);
+ new MessageContext(this.engineReg, null);
msgContext.setServerSide(true);
out.write(HTTPConstants.HTTP);
@@ -114,17 +110,14 @@
log.info("status written");
//We do not have any Addressing Headers to put
//let us put the information about incoming transport
- msgContext.setProperty(
- MessageContext.TRANSPORT_TYPE,
- TransportSenderLocator.TRANSPORT_HTTP);
- msgContext.setProperty(
- MessageContext.TRANSPORT_WRITER,
- out);
- msgContext.setProperty(
- MessageContext.TRANSPORT_READER,
- in);
+ msgContext.setProperty(MessageContext.TRANSPORT_TYPE,
+ TransportSenderLocator.TRANSPORT_HTTP);
+ msgContext.setProperty(MessageContext.TRANSPORT_WRITER,
+ out);
+ msgContext.setProperty(MessageContext.TRANSPORT_READER,
+ in);
HTTPTransportReciver reciver =
- new HTTPTransportReciver();
+ new HTTPTransportReciver();
reciver.invoke(msgContext);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilder.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilder.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilder.java Mon Feb 14 22:22:34 2005
@@ -22,9 +22,8 @@
/**
* @author chathura@opensource.lk
- *
*/
public interface WOMBuilder {
- public WSDLDescription build(InputStream in)throws WSDLException;
+ public WSDLDescription build(InputStream in) throws WSDLException;
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WOMBuilderFactory.java Mon Feb 14 22:22:34 2005
@@ -27,71 +27,67 @@
/**
* @author chathura@opensource.lk
- *
*/
public class WOMBuilderFactory {
public static final int WSDL11 = 1;
public static final int wsdl20 = 2;
-
-
- public static WOMBuilder getBuilder(int wsdlDocumentType) throws WSDLException{
-
- if(wsdlDocumentType == WSDL11){
- return new WSDL1ToWOMBuilder();
- }
- if(wsdlDocumentType == wsdl20){
- return new WSDL2ToWOMBuilder();
- }
- throw new WSDLException(WSDLException.INVALID_WSDL, "The document type specified is not valid");
+
+
+ public static WOMBuilder getBuilder(int wsdlDocumentType) throws WSDLException {
+
+ if (wsdlDocumentType == WSDL11) {
+ return new WSDL1ToWOMBuilder();
+ }
+ if (wsdlDocumentType == wsdl20) {
+ return new WSDL2ToWOMBuilder();
+ }
+ throw new WSDLException(WSDLException.INVALID_WSDL, "The document type specified is not valid");
}
-
-
-
- public static WOMBuilder getBuilder(InputStream in) throws WSDLException{
+
+
+ public static WOMBuilder getBuilder(InputStream in) throws WSDLException {
// Load the wsdl as a DOM
Document doc;
- try{
+ try {
doc = Utils.newDocument(in);
- }
- catch(ParserConfigurationException e){
+ } catch (ParserConfigurationException e) {
throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Exception", e);
- }
- catch(IOException e1){
+ } catch (IOException e1) {
throw new WSDLException(WSDLException.PARSER_ERROR, "WSDL Document read error", e1);
- }
- catch(SAXException e2){
+ } catch (SAXException e2) {
throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Exception", e2);
}
//Check the target namespace of the WSDL and determine the WSDL version.
int version = getWSDLVersion(doc);
-
- if(version == WSDL11){
- return (WOMBuilder)new WSDL1ToWOMBuilder();
- }
- else if(version == wsdl20){
- return (WOMBuilder)new WSDL2ToWOMBuilder();
+
+ if (version == WSDL11) {
+ return (WOMBuilder) new WSDL1ToWOMBuilder();
+ } else if (version == wsdl20) {
+ return (WOMBuilder) new WSDL2ToWOMBuilder();
}
-
- throw new WSDLException(WSDLException.OTHER_ERROR,"Unable to Figure out the WSDL vesion of the Document");
+
+ throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to Figure out the WSDL vesion of the Document");
}
+
/**
- * Will return an int that will represent the wsdl version and the int will correspond to the static
+ * Will return an int that will represent the wsdl version and the int will correspond to the static
* variables defined in this class.
- * @param doc
+ *
+ * @param doc
* @return
* @throws WSDLException If the version cannot be determined
*/
- private static int getWSDLVersion(Document doc) throws WSDLException{
+ private static int getWSDLVersion(Document doc) throws WSDLException {
//TODO check weather the namespaces are correct and the / problem too
- if(WSDLConstants.WSDL2_0_NAMESPACE.equals(doc.getDocumentElement().getNamespaceURI())){
+ if (WSDLConstants.WSDL2_0_NAMESPACE.equals(doc.getDocumentElement().getNamespaceURI())) {
return wsdl20;
- }else if(WSDLConstants.WSDL1_1_NAMESPACE.equals(doc.getDocumentElement().getNamespaceURI())){
+ } else if (WSDLConstants.WSDL1_1_NAMESPACE.equals(doc.getDocumentElement().getNamespaceURI())) {
return WSDL11;
}
-
+
throw new WSDLException(WSDLException.OTHER_ERROR, "Unable to Figure out the WSDL vesion of the Document");
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL1ToWOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL1ToWOMBuilder.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL1ToWOMBuilder.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL1ToWOMBuilder.java Mon Feb 14 22:22:34 2005
@@ -31,24 +31,23 @@
/**
* @author chathura@opensource.lk
- *
*/
public class WSDL1ToWOMBuilder implements WOMBuilder {
-
- public WSDLDescription build(InputStream in)throws WSDLException{
-
+
+ public WSDLDescription build(InputStream in) throws WSDLException {
+
WSDLDescription wsdlDefinitions = new WSDLDescriptionImpl();
-
+
WSDLPump pump = new WSDLPump(wsdlDefinitions, this.readInTheWSDLFile(in));
pump.pump();
-
+
return wsdlDefinitions;
}
-
- private Definition readInTheWSDLFile(InputStream in) throws WSDLException{
-
+
+ private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
+
WSDLReader reader =
- WSDLFactory.newInstance().newWSDLReader();
+ WSDLFactory.newInstance().newWSDLReader();
Document doc;
try {
doc = Utils.newDocument(in);
@@ -56,13 +55,13 @@
throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Error", e);
} catch (SAXException e) {
throw new WSDLException(WSDLException.PARSER_ERROR, "Parser SAX Error", e);
-
+
} catch (IOException e) {
throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e);
}
-
+
return reader.readWSDL(null, doc);
}
-
-
+
+
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL2ToWOMBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL2ToWOMBuilder.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL2ToWOMBuilder.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL2ToWOMBuilder.java Mon Feb 14 22:22:34 2005
@@ -22,14 +22,13 @@
/**
* @author chathura@opensource.lk
- *
*/
-public class WSDL2ToWOMBuilder implements WOMBuilder{
+public class WSDL2ToWOMBuilder implements WOMBuilder {
+
+ public WSDLDescription build(InputStream in) throws WSDLException {
- public WSDLDescription build(InputStream in ) throws WSDLException{
-
throw new UnsupportedOperationException("Fill the imps");
-
-
+
+
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL4JtoWOMPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL4JtoWOMPump.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL4JtoWOMPump.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDL4JtoWOMPump.java Mon Feb 14 22:22:34 2005
@@ -25,24 +25,23 @@
/**
* @author chathura@opensource.lk
- *
*/
public class WSDL4JtoWOMPump {
-
- public void pump(WSDLDescription wsdlDefinitiios, Definition wsdl4jDefinition){
+
+ public void pump(WSDLDescription wsdlDefinitiios, Definition wsdl4jDefinition) {
//Copy the Definition's Attrebute Information items and pump the
- wsdlDefinitiios.setTargetNameSpace( wsdl4jDefinition.getTargetNamespace());
+ wsdlDefinitiios.setTargetNameSpace(wsdl4jDefinition.getTargetNamespace());
//wsdl4jDefinition.getNamespace()
//top level components
}
-
- private void pumpInterface(WSDLInterface wsdlInterface, PortType wsdl4jPortType){
+
+ private void pumpInterface(WSDLInterface wsdlInterface, PortType wsdl4jPortType) {
// Copy The PortType Info to WSDLInterface info.
}
-
-
- private void pumpBinding(WSDLBinding wsdlBinding, Binding wsdl4jBinding){
-
+
+
+ private void pumpBinding(WSDLBinding wsdlBinding, Binding wsdl4jBinding) {
+
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/wsdl/wsdltowom/WSDLPump.java Mon Feb 14 22:22:34 2005
@@ -25,75 +25,71 @@
/**
* @author chathura@opensource.lk
- *
*/
public class WSDLPump {
- private static final String BOUND_INTERFACE_NAME = "BoundInterface";
+ private static final String BOUND_INTERFACE_NAME = "BoundInterface";
private WSDLDescription womDefinition;
private Definition wsdl4jParsedDefinition;
- public WSDLPump(
- WSDLDescription womDefinition,
- Definition wsdl4jParsedDefinition) {
+ public WSDLPump(WSDLDescription womDefinition,
+ Definition wsdl4jParsedDefinition) {
this.womDefinition = womDefinition;
this.wsdl4jParsedDefinition = wsdl4jParsedDefinition;
}
public void pump() {
- if(null != this.wsdl4jParsedDefinition && null != this.womDefinition ){
- this.populateDefinition(this.womDefinition, this.wsdl4jParsedDefinition);
- }else{
+ if (null != this.wsdl4jParsedDefinition && null != this.womDefinition) {
+ this.populateDefinition(this.womDefinition, this.wsdl4jParsedDefinition);
+ } else {
throw new WSDLProcessingException("Properties not set properly");
}
}
- private void populateDefinition(
- WSDLDescription wsdlDefinition,
- Definition wsdl4JDefinition) {
+ private void populateDefinition(WSDLDescription wsdlDefinition,
+ Definition wsdl4JDefinition) {
//Go through the WSDL4J Definition and pump it to the WOM
wsdlDefinition.setWSDL1DefinitionName(wsdl4JDefinition.getQName());
- wsdlDefinition.setTargetNameSpace(
- wsdl4JDefinition.getTargetNamespace());
+ wsdlDefinition.setTargetNameSpace(wsdl4JDefinition.getTargetNamespace());
- /////////////////////////////////////////////////////////////////////////////
- //Order of the following itmes shouldn't be changed unless you really know //
- //what you are doing. Reason being the components that are copied(pumped) //
- //towards the end depend on the components that has already being pumped. //
- //Following Lists some of the dependencies //
- //1) The Binding refers to the Interface //
- //1) Thw Endpoint refers tot he Bindings //
- // .... //
- // //
- /////////////////////////////////////////////////////////////////////////////
-
-
-
- //////////////////////////(1)First pump the Types////////////////////////////
- //Types may get changed inside the Operation pumping.
+ /////////////////////////////////////////////////////////////////////////////
+ //Order of the following itmes shouldn't be changed unless you really know //
+ //what you are doing. Reason being the components that are copied(pumped) //
+ //towards the end depend on the components that has already being pumped. //
+ //Following Lists some of the dependencies //
+ //1) The Binding refers to the Interface //
+ //1) Thw Endpoint refers tot he Bindings //
+ // .... //
+ // //
+ /////////////////////////////////////////////////////////////////////////////
+
+
+
+ //////////////////////////(1)First pump the Types////////////////////////////
+ //Types may get changed inside the Operation pumping.
Types wsdl4jTypes = wsdl4JDefinition.getTypes();
WSDLTypes wsdlTypes = new WSDLTypesImpl();
Iterator wsdl4jelmentsIterator = wsdl4jTypes.getExtensibilityElements().iterator();
ExtensibilityElement wsdl4jElement;
ExtensionElement womElement;
- while(wsdl4jelmentsIterator.hasNext()){
- wsdl4jElement = (ExtensibilityElement)wsdl4jelmentsIterator.next();
+ while (wsdl4jelmentsIterator.hasNext()) {
+ wsdl4jElement = (ExtensibilityElement) wsdl4jelmentsIterator.next();
womElement = new ExtensionElementImpl();
- if(null != wsdl4jElement.getRequired())
+ if (null != wsdl4jElement.getRequired())
womElement.setRequired(wsdl4jElement.getRequired().booleanValue());
//TODO
- wsdlTypes.addElement(wsdl4jElement.getElementType(), womElement);
+ wsdlTypes.addElement(wsdl4jElement.getElementType(), womElement);
}
this.womDefinition.setTypes(wsdlTypes);
-
-
-
-
- //////////////////////////(2)Pump the Interfaces/////////////////////////////
+
+
+
+
+ //////////////////////////(2)Pump the Interfaces/////////////////////////////
//pump the Interfaces: Get the PortTypes from WSDL4J parse OM and pump it to the
//WOM's WSDLInterface Components
@@ -101,17 +97,16 @@
WSDLInterface wsdlInterface;
while (portTypeIterator.hasNext()) {
wsdlInterface = new WSDLInterfaceImpl();
- this.populateInterfaces(
- wsdlInterface,
- (PortType) portTypeIterator.next());
+ this.populateInterfaces(wsdlInterface,
+ (PortType) portTypeIterator.next());
wsdlDefinition.addInterface(wsdlInterface);
}
-
-
-
- //////////////////////////(3)Pump the Bindings///////////////////////////////
+
+
+
+ //////////////////////////(3)Pump the Bindings///////////////////////////////
//pump the Bindings: Get the Bindings map from WSDL4J and create a new map of
//WSDLBinding elements
@@ -124,18 +119,18 @@
wsdlDefinition.addBinding(wsdlBinding);
}
-
-
- //////////////////////////(4)Pump the Service///////////////////////////////
-
- Iterator serviceIterator = wsdl4JDefinition.getServices().values().iterator();
- WSDLService wsdlService;
- while(serviceIterator.hasNext()){
- wsdlService = new WSDLServiceImpl();
- this.populateServices(wsdlService, (Service)serviceIterator.next());
- wsdlDefinition.addService(wsdlService);
- }
-
+
+
+ //////////////////////////(4)Pump the Service///////////////////////////////
+
+ Iterator serviceIterator = wsdl4JDefinition.getServices().values().iterator();
+ WSDLService wsdlService;
+ while (serviceIterator.hasNext()) {
+ wsdlService = new WSDLServiceImpl();
+ this.populateServices(wsdlService, (Service) serviceIterator.next());
+ wsdlDefinition.addService(wsdlService);
+ }
+
}
//////////////////////////////////////////////////////////////////////////////
@@ -145,6 +140,7 @@
/**
* Simply Copy information.
+ *
* @param wsdlInterface
* @param wsdl4jPortType
*/
@@ -152,72 +148,69 @@
private void populateInterfaces(WSDLInterface wsdlInterface, PortType wsdl4jPortType) {
//Copy the Attrebute information items
- //Copied with the Same QName so it will reqire no Query in Binding pumping.
- wsdlInterface.setName(wsdl4jPortType.getQName());
-
+ //Copied with the Same QName so it will reqire no Query in Binding pumping.
+ wsdlInterface.setName(wsdl4jPortType.getQName());
+
Iterator wsdl4JOperationsIterator = wsdl4jPortType.getOperations().iterator();
- WSDLOperation wsdloperation ;
+ WSDLOperation wsdloperation;
while (wsdl4JOperationsIterator.hasNext()) {
wsdloperation = new WSDLOperationImpl();
- this.populateOperations( wsdloperation, (Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType.getQName().getNamespaceURI());
+ this.populateOperations(wsdloperation, (Operation) wsdl4JOperationsIterator.next(), wsdl4jPortType.getQName().getNamespaceURI());
wsdlInterface.setOperation(wsdloperation);
}
-
+
}
-
-
- /**
- * Pre Condition: The Interface Components must be copied by now.
- */
- private void populateBindings(WSDLBinding wsdlBinding, Binding wsdl4JBinding) {
- //Copy attrebutes
- wsdlBinding.setName(wsdl4JBinding.getQName());
- QName interfaceName = wsdl4JBinding.getPortType().getQName();
- WSDLInterface wsdlInterface = this.womDefinition.getInterface(interfaceName);
- //FIXME Do We need this eventually???
- if(null == wsdlInterface) throw new WSDLProcessingException("Interface/PortType not found for the Binding :" +wsdlBinding.getName());
-
- wsdlBinding.setBoundInterface(wsdlInterface);
-
- Iterator bindingoperationsIterator = wsdl4JBinding.getBindingOperations().iterator();
-
- WSDLBindingOperation wsdlBindingOperation;
- while(bindingoperationsIterator.hasNext()){
- wsdlBindingOperation = new WSDLBindingOperationImpl();
- this.populateBindingOperation(wsdlBindingOperation, (BindingOperation)bindingoperationsIterator.next(), wsdl4JBinding.getQName().getNamespaceURI());
- wsdlBinding.addBindingOperation(wsdlBindingOperation);
- }
-
-
- }
-
-
-
- public void populateServices(WSDLService wsdlService, Service wsdl4jService){
- wsdlService.setName(wsdl4jService.getQName());
- Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values().iterator();
- wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
- WSDLEndpoint wsdlEndpoint;
- while(wsdl4jportsIterator.hasNext()){
- wsdlEndpoint = new WSDLEndpointImpl();
- this.populatePorts(wsdlEndpoint, (Port)wsdl4jportsIterator.next(), wsdl4jService.getQName().getNamespaceURI());
- wsdlService.setEndpoint(wsdlEndpoint);
- }
-
- }
-
-
+
+
+ /**
+ * Pre Condition: The Interface Components must be copied by now.
+ */
+ private void populateBindings(WSDLBinding wsdlBinding, Binding wsdl4JBinding) {
+ //Copy attrebutes
+ wsdlBinding.setName(wsdl4JBinding.getQName());
+ QName interfaceName = wsdl4JBinding.getPortType().getQName();
+ WSDLInterface wsdlInterface = this.womDefinition.getInterface(interfaceName);
+ //FIXME Do We need this eventually???
+ if (null == wsdlInterface) throw new WSDLProcessingException("Interface/PortType not found for the Binding :" + wsdlBinding.getName());
+
+ wsdlBinding.setBoundInterface(wsdlInterface);
+
+ Iterator bindingoperationsIterator = wsdl4JBinding.getBindingOperations().iterator();
+
+ WSDLBindingOperation wsdlBindingOperation;
+ while (bindingoperationsIterator.hasNext()) {
+ wsdlBindingOperation = new WSDLBindingOperationImpl();
+ this.populateBindingOperation(wsdlBindingOperation, (BindingOperation) bindingoperationsIterator.next(), wsdl4JBinding.getQName().getNamespaceURI());
+ wsdlBinding.addBindingOperation(wsdlBindingOperation);
+ }
+
+
+ }
+
+
+ public void populateServices(WSDLService wsdlService, Service wsdl4jService) {
+ wsdlService.setName(wsdl4jService.getQName());
+ Iterator wsdl4jportsIterator = wsdl4jService.getPorts().values().iterator();
+ wsdlService.setServiceInterface(this.getBoundInterface(wsdlService));
+ WSDLEndpoint wsdlEndpoint;
+ while (wsdl4jportsIterator.hasNext()) {
+ wsdlEndpoint = new WSDLEndpointImpl();
+ this.populatePorts(wsdlEndpoint, (Port) wsdl4jportsIterator.next(), wsdl4jService.getQName().getNamespaceURI());
+ wsdlService.setEndpoint(wsdlEndpoint);
+ }
+
+ }
+
/////////////////////////////////////////////////////////////////////////////
//////////////////////////// Internal Component Copying ///////////////////
//TODO Faults ??
public void populateOperations(WSDLOperation wsdlOperation, Operation wsdl4jOperation, String nameSpaceOfTheOperation) {
//Copy Name Attrebute
- wsdlOperation.setName(
- new QName(nameSpaceOfTheOperation, wsdl4jOperation.getName()));
+ wsdlOperation.setName(new QName(nameSpaceOfTheOperation, wsdl4jOperation.getName()));
//OperationType wsdl4jOperation.getStyle()
// Create the Input Message and add
@@ -244,40 +237,37 @@
//Set the MEP
wsdlOperation.setMessageExchangePattern(this.getRelaventMEPForTheMessageStyle(wsdl4jOperation.getStyle()));
-
+
}
-
-
- private void populateBindingOperation(WSDLBindingOperation wsdlBindingOperation, BindingOperation wsdl4jBindingOperation, String nameSpaceOfTheBindingOperation){
+
+
+ private void populateBindingOperation(WSDLBindingOperation wsdlBindingOperation, BindingOperation wsdl4jBindingOperation, String nameSpaceOfTheBindingOperation) {
wsdlBindingOperation.setName(new QName(nameSpaceOfTheBindingOperation, wsdl4jBindingOperation.getName()));
-
+
BindingInput wsdl4jInputBinding = wsdl4jBindingOperation.getBindingInput();
- WSDLBindingMessageReference wsdlInputBinding = new WSDLBindingMessageReferenceImpl();
-
+ WSDLBindingMessageReference wsdlInputBinding = new WSDLBindingMessageReferenceImpl();
+
wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
//TODO
wsdlBindingOperation.setInput(wsdlInputBinding);
-
-
-
+
+
BindingOutput wsdl4jOutputBinding = wsdl4jBindingOperation.getBindingOutput();
- WSDLBindingMessageReference wsdlOutputBinding = new WSDLBindingMessageReferenceImpl();
-
+ WSDLBindingMessageReference wsdlOutputBinding = new WSDLBindingMessageReferenceImpl();
+
wsdlInputBinding.setDirection(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
//TODO
wsdlBindingOperation.setInput(wsdlOutputBinding);
-
-
-
+
+
}
-
-
-
- public void populatePorts(WSDLEndpoint wsdlEndpoint, Port wsdl4jPort, String targetNamspace){
- wsdlEndpoint.setName(new QName(targetNamspace, wsdl4jPort.getName()));
-
- wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort.getBinding().getQName()));
- ///Extesibility elements.
+
+
+ public void populatePorts(WSDLEndpoint wsdlEndpoint, Port wsdl4jPort, String targetNamspace) {
+ wsdlEndpoint.setName(new QName(targetNamspace, wsdl4jPort.getName()));
+
+ wsdlEndpoint.setBinding(this.womDefinition.getBinding(wsdl4jPort.getBinding().getQName()));
+ ///Extesibility elements.
}
@@ -288,62 +278,63 @@
* Will return the URI for the MEP. if null will retun the IN_OUT as default
* pattern.
*/
- private String getRelaventMEPForTheMessageStyle(OperationType operationType){
-
- if(null != operationType){
-
- if(operationType.equals(OperationType.REQUEST_RESPONSE))
- return WSDLConstants.MEP_URI_IN_OUT;
-
- if(operationType.equals(OperationType.ONE_WAY))
- return WSDLConstants.MEP_URI_IN_ONLY;
-
- if(operationType.equals(OperationType.NOTIFICATION))
- return WSDLConstants.MEP_URI_OUT_ONLY;
-
- if(operationType.equals(OperationType.SOLICIT_RESPONSE))
- return WSDLConstants.MEP_URI_OUT_IN;
+ private String getRelaventMEPForTheMessageStyle(OperationType operationType) {
+
+ if (null != operationType) {
+
+ if (operationType.equals(OperationType.REQUEST_RESPONSE))
+ return WSDLConstants.MEP_URI_IN_OUT;
+
+ if (operationType.equals(OperationType.ONE_WAY))
+ return WSDLConstants.MEP_URI_IN_ONLY;
+
+ if (operationType.equals(OperationType.NOTIFICATION))
+ return WSDLConstants.MEP_URI_OUT_ONLY;
+
+ if (operationType.equals(OperationType.SOLICIT_RESPONSE))
+ return WSDLConstants.MEP_URI_OUT_IN;
}
//TODO
return WSDLConstants.MEP_URI_OUT_IN;
}
-
+
/**
- * This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
+ * This method will fill up the gap of WSDL 1.1 and WSDL 2.0 w.r.t. the
* bound interface for the Service Component Defined in the WSDL 2.0.
* Logic being if there exist only one PortType in the WSDL 1.1 file
- * then that will be set as the bound interface of the Service. If more than one
+ * then that will be set as the bound interface of the Service. If more than one
* Porttype exist in the WSDl 1.1 file this will create a dummy Interface
- * with the available PortTypes and will return that interface so that it
+ * with the available PortTypes and will return that interface so that it
* will inherit all those interfaces.
- *
- * Eventuall this will have to be fixed using user input since
+ * <p/>
+ * Eventuall this will have to be fixed using user input since
+ *
* @param service
* @return
*/
- private WSDLInterface getBoundInterface(WSDLService service){
-
- // Throw an exception if there are no interfaces defined as at yet.
- if(0 ==this.womDefinition.getWsdlInterfaces().size())
- throw new WSDLProcessingException( "There are no " +
- "Interfaces/PortTypes identified in the current partially built" +
- "WOM");
-
- //If there is only one Interface available hten return that because normally
- // that interface must be the one to the service should get bound.
- if(1 == this.womDefinition.getWsdlInterfaces().size())
- return (WSDLInterface)this.womDefinition.getWsdlInterfaces().values().iterator().next();
-
- //If there are more than one interface available... For the time being create a
- // new interface and set all those existing interfaces as superinterfaces of it
- // and return.
- WSDLInterface newBoundInterface = this.womDefinition.createInterface();
- newBoundInterface.setName(new QName(service.getNamespace(), service.getName().getLocalPart()+ BOUND_INTERFACE_NAME));
- Iterator interfaceIterator = this.womDefinition.getWsdlInterfaces().values().iterator();
- while(interfaceIterator.hasNext()){
- newBoundInterface.addSuperInterface((WSDLInterface)interfaceIterator.next());
- }
- return newBoundInterface;
+ private WSDLInterface getBoundInterface(WSDLService service) {
+
+ // Throw an exception if there are no interfaces defined as at yet.
+ if (0 == this.womDefinition.getWsdlInterfaces().size())
+ throw new WSDLProcessingException("There are no " +
+ "Interfaces/PortTypes identified in the current partially built" +
+ "WOM");
+
+ //If there is only one Interface available hten return that because normally
+ // that interface must be the one to the service should get bound.
+ if (1 == this.womDefinition.getWsdlInterfaces().size())
+ return (WSDLInterface) this.womDefinition.getWsdlInterfaces().values().iterator().next();
+
+ //If there are more than one interface available... For the time being create a
+ // new interface and set all those existing interfaces as superinterfaces of it
+ // and return.
+ WSDLInterface newBoundInterface = this.womDefinition.createInterface();
+ newBoundInterface.setName(new QName(service.getNamespace(), service.getName().getLocalPart() + BOUND_INTERFACE_NAME));
+ Iterator interfaceIterator = this.womDefinition.getWsdlInterfaces().values().iterator();
+ while (interfaceIterator.hasNext()) {
+ newBoundInterface.addSuperInterface((WSDLInterface) interfaceIterator.next());
+ }
+ return newBoundInterface;
}
-
+
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/Component.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/Component.java?view=diff&r1=153901&r2=153902
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/Component.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/wsdl/Component.java Mon Feb 14 22:22:34 2005
@@ -19,12 +19,10 @@
/**
* @author chathura@opensource.lk
- *
*/
public interface Component {
/**
* Returns the properties that are specific to this WSDL Component.
- *
*/
public HashMap getComponentProperties();
@@ -35,6 +33,7 @@
/**
* Will set the property keyed with the relavent key
+ *
* @param key Key in the map
* @param obj Object to be put
*/
@@ -42,6 +41,7 @@
/**
* Gets the component property
+ *
* @param key key for the map search.
* @return
*/