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 du...@apache.org on 2006/02/14 00:36:50 UTC
svn commit: r377534 - in /webservices/axis/trunk/proposals/dug/java:
samples/wsa/ src/org/apache/axis/client/ src/org/apache/axis/server/
src/org/apache/axis/transport/http/ test/functional/
Author: dug
Date: Mon Feb 13 15:36:47 2006
New Revision: 377534
URL: http://svn.apache.org/viewcvs?rev=377534&view=rev
Log:
Adding new plug-points into proposal branch
Added:
webservices/axis/trunk/proposals/dug/java/samples/wsa/
webservices/axis/trunk/proposals/dug/java/samples/wsa/build.xml
webservices/axis/trunk/proposals/dug/java/samples/wsa/deploy.wsdd
webservices/axis/trunk/proposals/dug/java/samples/wsa/testit.cmd
webservices/axis/trunk/proposals/dug/java/samples/wsa/undeploy.wsdd
webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaClient.java
webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaService.java
Modified:
webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java
webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java
webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/server/AxisServer.java
webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
webservices/axis/trunk/proposals/dug/java/test/functional/FunctionalTests.java
webservices/axis/trunk/proposals/dug/java/test/functional/auto-deploy.wsdd
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/build.xml?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/build.xml (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/build.xml Mon Feb 13 15:36:47 2006
@@ -0,0 +1,63 @@
+<?xml version="1.0" ?>
+<!DOCTYPE project [
+ <!ENTITY properties SYSTEM "file:../../xmls/properties.xml">
+ <!ENTITY paths SYSTEM "file:../../xmls/path_refs.xml">
+ <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml">
+ <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml">
+ <!ENTITY targets SYSTEM "file:../../xmls/targets.xml">
+]>
+
+<!-- ===================================================================
+<description>
+ Test/Sample Component file for Axis
+
+Notes:
+ This is a build file for use with the Jakarta Ant build tool.
+
+Prerequisites:
+
+ jakarta-ant from http://jakarta.apache.org
+
+Build Instructions:
+ To compile
+ ant compile
+ To execute
+ ant run
+
+Copyright:
+ Copyright (c) 2002-2003 Apache Software Foundation.
+</description>
+==================================================================== -->
+
+<project default="compile">
+<property name="axis.home" location="../.." />
+<property name="componentName" value="samples/wsa" />
+
+ &properties;
+ &paths;
+ &taskdefs;
+ &taskdefs_post_compile;
+ &targets;
+
+<target name="clean"/>
+
+<target name="copy" depends="setenv"/>
+
+<target name="compile" depends="copy">
+ <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}">
+ <classpath>
+ <path refid="classpath"/>
+ </classpath>
+ <include name="samples/wsa/**/*.java"/>
+ <exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
+ <exclude name="**/old/**/*.java" />
+ </javac>
+</target>
+
+<target name="deploy"/>
+
+<target name="run"/>
+
+<target name="undeploy"/>
+
+</project>
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/deploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/deploy.wsdd?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/deploy.wsdd (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/deploy.wsdd Mon Feb 13 15:36:47 2006
@@ -0,0 +1,17 @@
+<!-- Use this file to deploy some handlers/chains and services -->
+<!-- Two ways to do this: -->
+<!-- java org.apache.axis.client.AdminClient deploy.wsdd -->
+<!-- after the axis server is running -->
+<!-- or -->
+<!-- java org.apache.axis.utils.Admin client|server deploy.wsdd -->
+<!-- from the same directory that the Axis engine runs -->
+
+<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
+ xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
+
+ <service name="wsaService" provider="java:RPC">
+ <parameter name="className" value="samples.wsa.wsaService"/>
+ <parameter name="allowedMethods" value="*"/>
+ </service>
+
+</deployment>
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/testit.cmd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/testit.cmd?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/testit.cmd (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/testit.cmd Mon Feb 13 15:36:47 2006
@@ -0,0 +1,10 @@
+rem this assumes webserver is running on port 8080
+
+@echo Deploy everything first
+java org.apache.axis.client.AdminClient deploy.wsdd %*
+
+@echo These next 3 should work...
+java samples.wsa.wsaClient
+
+@echo Now undeploy everything
+java org.apache.axis.client.AdminClient undeploy.wsdd %*
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/undeploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/undeploy.wsdd?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/undeploy.wsdd (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/undeploy.wsdd Mon Feb 13 15:36:47 2006
@@ -0,0 +1,3 @@
+<undeployment name="test" xmlns="http://xml.apache.org/axis/wsdd/">
+ <service name="wsaService"/>
+</undeployment>
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaClient.java?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaClient.java (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaClient.java Mon Feb 13 15:36:47 2006
@@ -0,0 +1,42 @@
+package samples.wsa ;
+
+import org.apache.axis.client.Call ;
+import org.apache.axis.client.Service ;
+import org.apache.axis.encoding.XMLType;
+import org.apache.axis.utils.Options;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.namespace.QName;
+import org.apache.axis.transport.http.SimpleAxisServer ;
+
+public class wsaClient {
+ static public void main(String[] args) throws Exception {
+ try {
+ Options opts = new Options( args );
+
+ args = opts.getRemainingArgs();
+
+ (new SimpleAxisServer()).startListening(88);
+
+ Service service = new Service();
+ Call call = (Call) service.createCall();
+
+ call.setTargetEndpointAddress( opts.getURL() );
+ call.setProperty( "useWSA", "true" );
+ call.addParameter( "text", XMLType.XSD_STRING, ParameterMode.IN );
+ call.setReturnType( XMLType.XSD_STRING );
+ call.setEncodingStyle("");
+
+ System.out.println( "Calling ping (one way)" );
+ call.invokeOneWay( "ping", new Object[] { "hi" } );
+
+ Thread.sleep(1000);
+
+ call.setReplyTo( "http://localhost:81/axis/services/asyncService" );
+ System.out.println( call.invoke( "echo", new Object[] { "hi" } ) );
+
+ }
+ catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+}
Added: webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaService.java?rev=377534&view=auto
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaService.java (added)
+++ webservices/axis/trunk/proposals/dug/java/samples/wsa/wsaService.java Mon Feb 13 15:36:47 2006
@@ -0,0 +1,16 @@
+package samples.wsa;
+
+import org.apache.axis.MessageContext ;
+
+public class wsaService {
+ public void ping(String str) {
+ System.out.println("Ping: " + str );
+ MessageContext.getCurrentContext().setIsOneWay(true);
+ MessageContext.getCurrentContext().setEncodingStyle("");
+ }
+
+ public String echo(String str) {
+ System.out.println("Echo: " + str );
+ return str ;
+ }
+}
Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/AxisClient.java Mon Feb 13 15:36:47 2006
@@ -29,10 +29,12 @@
import org.apache.axis.handlers.HandlerInfoChainFactory;
import org.apache.axis.handlers.soap.MustUnderstandChecker;
import org.apache.axis.handlers.soap.SOAPService;
+import org.apache.axis.security.WSSecInterface;
import org.apache.axis.utils.Messages;
import org.apache.axis.wsa.AsyncService;
import org.apache.axis.wsa.MIHeader;
import org.apache.axis.wsa.WSAHandler;
+import org.apache.axis.wsrm.RMInterface ;
import org.apache.commons.logging.Log;
import javax.xml.namespace.QName;
@@ -55,6 +57,8 @@
MustUnderstandChecker checker = new MustUnderstandChecker(null);
HandlerChain handlerImpl = null ;
+ RMInterface rmImpl = null ;
+ WSSecInterface secImpl = null ;
public AxisClient(EngineConfiguration config) {
super(config);
@@ -116,11 +120,8 @@
}
// Run the security code - Init security sessions if needed
- String secCls = msgContext.getStrProp( "WSSecurity" );
- if ( secCls == null )
- secCls = (String) msgContext.getAxisEngine().getOption("WSSecurity");
- // Add code here... Dug
- // securityCode.init();
+ if ( secImpl != null )
+ secImpl.init( msgContext );
}
public void invokeTransport(MessageContext msgContext) throws Exception {
@@ -138,12 +139,12 @@
if ( hName != null && (h = getTransport( hName )) != null ) {
// Piggy-back any RM headers (like ACKs)
- // add code here... Dug
- // rmcode.addRMHeaders();
+ if ( rmImpl != null )
+ rmImpl.addRMHeaders(msgContext);
// Run security - Protect
- // add code here... Dug
- // securityCode.protect();
+ if ( secImpl != null )
+ secImpl.protect( msgContext );
// Invoke the actual transport chain
h.invoke(msgContext);
@@ -153,8 +154,8 @@
WSAHandler.invoke( msgContext );
// Run security - Verify
- // add code here... Dug
- // securityCode.verify();
+ if ( secImpl != null )
+ secImpl.verify( msgContext );
}
else
throw new AxisFault(Messages.getMessage("noTransport00", hName));
@@ -239,6 +240,21 @@
// set active context
setCurrentMessageContext(msgContext);
+ // Look for WSSecurity impl
+ String cls = msgContext.getStrProp( "WSSecurityImpl" );
+ if ( cls == null )
+ cls = (String) msgContext.getAxisEngine()
+ .getOption("WSSecurityImpl");
+ if ( cls != null )
+ secImpl = (WSSecInterface) Class.forName(cls).newInstance();
+
+ // Look for WSRM impl
+ cls = msgContext.getStrProp( "WSRMImpl" );
+ if ( cls == null )
+ cls = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
+ if ( cls != null )
+ rmImpl = (RMInterface) Class.forName(cls).newInstance();
+
// Do WSA processing first
WSAHandler.invoke( msgContext );
@@ -277,12 +293,19 @@
msgContext.setPastPivot(false);
invokeOutbound(msgContext);
- // Add check for RM here - for now just do normal stuff... Dug
- // Normal transport flow
- if ( msgContext.getIsOneWay() )
- invokeTransportOneWay( msgContext );
- else
- invokeTransport( msgContext );
+ // Check to see if the RM code wants to deal with it
+ boolean skipTransport = false ;
+
+ if ( rmImpl != null )
+ skipTransport = rmImpl.sendMessage( msgContext );
+
+ if ( !skipTransport ) {
+ // Normal transport flow
+ if ( msgContext.getIsOneWay() )
+ invokeTransportOneWay( msgContext );
+ else
+ invokeTransport( msgContext );
+ }
// If there was no response message and we didn't call
// invokeOneWay() then wait for an async response
Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/client/Call.java Mon Feb 13 15:36:47 2006
@@ -3022,74 +3022,143 @@
operationSetManually = false;
}
+ /**
+ * Gets the WS-Addressing MessageID for the outgoing message.
+ *
+ * @param name the name of the property
+ */
public String getMessageID() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getMessageID();
}
+ /**
+ * Sets the WS-Addressing wsa:To value
+ *
+ * @param epr The EPR.
+ *
+ * Note: this does not set the transport URL. As of now they are
+ * treated as two independent entities.
+ */
public void setTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setTo( epr );
}
+ /**
+ * Sets the WS-Addressing wsa:To value based on the url passed in.
+ *
+ * @param epr The url to use for the wsa:To's Address element.
+ *
+ * Note: this does not set the transport URL. As of now they are
+ * treated as two independent entities.
+ */
public void setTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the WS-Addressing wsa:To EPR.
+ */
public EndpointReference getTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getTo();
}
+ /**
+ * Sets the WS-Addressing wsa:From value
+ *
+ * @param epr The epr to use for the wsa:From
+ */
public void setFrom(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFrom( epr );
}
+ /**
+ * Sets the WS-Addressing wsa:From value from a url
+ *
+ * @param epr The url to use for the wsa:From
+ */
public void setFrom(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFrom( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Get the wsa:From EPR
+ *
+ * @return The wsa:From EPR
+ */
public EndpointReference getFrom() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getFrom();
}
+ /**
+ * Sets the wsa:ReplyTo EPR
+ *
+ * @param epr The epr to use for the wsa:ReplyTo
+ */
public void setReplyTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setReplyTo( epr );
}
+ /**
+ * Sets the wsa:ReplyTo EPR from a url
+ *
+ * @param url The url to use for the wsa:ReplyTo Address field
+ */
public void setReplyTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setReplyTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the wsa:ReplyTo EPR
+ *
+ * @return the wsa:ReplyTo EPR
+ */
public EndpointReference getReplyTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getReplyTo();
}
+ /**
+ * Sets the wsa:FaultTo EPR
+ *
+ * @param epr he epr to use for the wsa:FaultTo
+ */
public void setFaultTo(EndpointReference epr) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFaultTo( epr );
}
+ /**
+ * Sets the wsa:FaultTo EPR from a url
+ *
+ * @param url The url to use for the wsa:FaultTo Address field
+ */
public void setFaultTo(String url) throws Exception {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
if ( mih == null ) mih = new MIHeader( this );
mih.setFaultTo( EndpointReference.fromLocation( url ) );
}
+ /**
+ * Gets the wsa:FaultTo EPR
+ *
+ * @param The wsa:FaultTo EPR
+ */
public EndpointReference getFaultTo() {
MIHeader mih = (MIHeader) getProperty(WSAConstants.REQ_MIH);
return mih == null ? null : mih.getFaultTo();
Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/server/AxisServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/server/AxisServer.java?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/server/AxisServer.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/server/AxisServer.java Mon Feb 13 15:36:47 2006
@@ -1,12 +1,12 @@
/*
* Copyright 2001-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.
@@ -25,19 +25,27 @@
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.SimpleTargetedChain;
-import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.client.AxisClient;
import org.apache.axis.components.logger.LogFactory;
import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.security.WSSecInterface ;
import org.apache.axis.utils.ClassUtils;
import org.apache.axis.utils.Messages;
import org.apache.commons.logging.Log;
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPHeaderElement;
+import org.apache.axis.wsrm.RMInterface ;
+import org.apache.axis.wsa.MIHeader;
+import org.apache.axis.wsa.WSAHandler;
import java.util.Map;
+import java.lang.reflect.Method ;
+
/**
*
- * @author Doug Davis (dug@us.ibm.com)
* @author Glen Daniels (gdaniels@allaire.com)
*/
public class AxisServer extends AxisEngine
@@ -48,7 +56,11 @@
LogFactory.getLog("org.apache.axis.TIME");
private static AxisServerFactory factory = null;
-
+ private long t0=0, t1=0, t2=0, t3=0, t4=0, t5=0;
+
+ private RMInterface rmImpl = null ;
+ private WSSecInterface secImpl = null ;
+
public static AxisServer getServer(Map environment) throws AxisFault
{
if (factory == null) {
@@ -124,13 +136,160 @@
return clientEngine;
}
+ public void invokeInboundTransport(MessageContext msgContext)
+ throws Exception
+ {
+ /* Process the Transport Specific Request Chain */
+ /**********************************************/
+ String hName = msgContext.getTransportName();
+ Handler h = null ;
+ SimpleTargetedChain transportChain = null ;
+
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage("transport01","AxisServer.invoke",hName));
+ t1=System.currentTimeMillis();
+ }
+
+ if ( hName != null && (h = getTransport( hName )) != null ) {
+ if (h instanceof SimpleTargetedChain) {
+ transportChain = (SimpleTargetedChain)h;
+ h = transportChain.getRequestHandler();
+ if (h != null)
+ h.invoke(msgContext);
+ }
+ }
+ // Run security
+ if ( secImpl != null )
+ secImpl.verify( msgContext );
+ }
+
+ public void invokeOutboundTransport(MessageContext msgContext)
+ throws Exception
+ {
+ String hName = msgContext.getTransportName();
+ Handler h = null ;
+ SimpleTargetedChain transportChain = null ;
+
+ // Run security
+ if ( secImpl != null )
+ secImpl.protect( msgContext );
+
+ /* Process the Transport Specific Response Chain */
+ /***********************************************/
+ if ( hName != null && (h = getTransport( hName )) != null ) {
+ if (h instanceof SimpleTargetedChain) {
+ transportChain = (SimpleTargetedChain)h;
+ h = transportChain.getResponseHandler();
+ if (h != null) {
+ // add call to RM code to add piggy-backed headers
+ if ( rmImpl != null )
+ rmImpl.addRMHeaders( msgContext );
+ h.invoke(msgContext);
+ }
+ }
+ }
+ }
+
+ public void invokeService(MessageContext msgContext) throws Exception {
+ Handler h = null ;
+
+ if ( tlog.isDebugEnabled() )
+ t2=System.currentTimeMillis();
+
+ try {
+ // Run WSA logic
+ WSAHandler.invoke( msgContext );
+
+ MIHeader mih = MIHeader.fromCurrentMessage();
+
+ if ( mih != null ) {
+ // See if it needs to be rerouted
+ // Dug - not yet // (new WSXHandler()).invoke( msgContext );
+ }
+
+ /* Process the Global Request Chain */
+ /************************************/
+ if ((h = getGlobalRequest()) != null ) {
+ h.invoke(msgContext);
+ }
+
+ /**
+ * At this point, the service should have been set by someone
+ * (either the originator of the MessageContext, or one of the
+ * transport or global Handlers). If it hasn't been set, we
+ * fault.
+ */
+ h = msgContext.getService();
+ if (h == null) {
+ // It's possible that we haven't yet parsed the
+ // message at this point. This is a kludge to
+ // make sure we have. There probably wants to be
+ // some kind of declarative "parse point" on the handler
+ // chain instead....
+ Message rm = msgContext.getRequestMessage();
+ rm.getSOAPEnvelope().getFirstBody();
+
+ h = msgContext.getService();
+ if (h == null)
+ throw new AxisFault("Server.NoService",
+ Messages.getMessage("noService05",
+ "" + msgContext.getTargetService()),
+ null, null );
+ }
+ if ( tlog.isDebugEnabled() )
+ t3=System.currentTimeMillis();
+
+ SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
+
+ // Only invoke the service is there's a body - sort of a hack
+ if ( env.getFirstBody() != null ) {
+ initSOAPConstants(msgContext);
+ try {
+ h.invoke(msgContext);
+ }
+ catch(AxisFault af) {
+ if ( (h= getGlobalRequest()) != null )
+ h.onFault(msgContext);
+ throw af ;
+ }
+ finally {
+ msgContext.setPastPivot( true );
+ }
+ }
+
+ if ( tlog.isDebugEnabled() )
+ t4=System.currentTimeMillis();
+ }
+ catch(Exception exp) {
+ // If WSA isn't turned on then just rethrow it
+ // Dug - fix this, it should not do this we need to make this
+ // work even when WSA is turned on
+ if ( MIHeader.fromRequest() == null ) throw exp ;
+
+ if ( !(exp instanceof AxisFault) )
+ exp = AxisFault.makeFault( exp );
+
+ msgContext.setPastPivot( true );
+ msgContext.setResponseMessage( new Message(exp) );
+
+ // WSA stuff
+ WSAHandler.fixAction( msgContext );
+ }
+ // WSA logic is run first
+ WSAHandler.invoke( msgContext );
+
+ /* Process the Global Response Chain */
+ /***********************************/
+ if ((h = getGlobalResponse()) != null)
+ h.invoke(msgContext);
+ }
+
/**
* Main routine of the AXIS server. In short we locate the appropriate
* handler for the desired service and invoke() it.
*/
public void invoke(MessageContext msgContext) throws AxisFault {
- long t0=0, t1=0, t2=0, t3=0, t4=0, t5=0;
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t0=System.currentTimeMillis();
}
@@ -154,6 +313,21 @@
// set active context
setCurrentMessageContext(msgContext);
+ // Look for WSSecurity impl
+ String tmp = msgContext.getStrProp( "WSSecurityImpl" );
+ if ( tmp == null )
+ tmp = (String) msgContext.getAxisEngine()
+ .getOption("WSSecurityImpl");
+ if ( tmp != null )
+ secImpl = (WSSecInterface) Class.forName(tmp).newInstance();
+
+ // Look for WSRM impl
+ tmp = msgContext.getStrProp( "WSRMImpl" );
+ if ( tmp == null )
+ tmp = (String) msgContext.getAxisEngine().getOption("WSRMImpl");
+ if ( tmp != null )
+ rmImpl = (RMInterface) Class.forName(tmp).newInstance();
+
hName = msgContext.getStrProp( MessageContext.ENGINE_HANDLER );
if ( hName != null ) {
if ( (h = getHandler(hName)) == null ) {
@@ -167,16 +341,23 @@
h = null ;
}
}
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t1=System.currentTimeMillis();
}
- if ( h != null )
+ if ( h != null ) {
+ try {
h.invoke(msgContext);
+ }
+ catch(Exception exp ) {
+ exp.printStackTrace();
+ throw exp ;
+ }
+ }
else
throw new AxisFault( "Server.error",
Messages.getMessage("noHandler00", hName),
null, null );
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t2=System.currentTimeMillis();
tlog.debug( "AxisServer.invoke " + hName + " invoke=" +
( t2-t1 ) + " pre=" + (t1-t0 ));
@@ -220,90 +401,62 @@
*/
- /* Process the Transport Specific Request Chain */
- /**********************************************/
- hName = msgContext.getTransportName();
- SimpleTargetedChain transportChain = null;
-
- if (log.isDebugEnabled())
- log.debug(Messages.getMessage("transport01", "AxisServer.invoke", hName));
-
- if( tlog.isDebugEnabled() ) {
- t1=System.currentTimeMillis();
- }
- if ( hName != null && (h = getTransport( hName )) != null ) {
- if (h instanceof SimpleTargetedChain) {
- transportChain = (SimpleTargetedChain)h;
- h = transportChain.getRequestHandler();
- if (h != null)
- h.invoke(msgContext);
+ invokeInboundTransport(msgContext);
+
+ boolean skipService = false ;
+ if ( rmImpl != null ) {
+ try {
+ skipService = rmImpl.processRMHeaders( msgContext );
+ }
+ catch(Exception exp) {
+ skipService = true ;
+ if ( !(exp instanceof AxisFault) )
+ exp = AxisFault.makeFault( exp );
+ msgContext.setPastPivot( true );
+ msgContext.setResponseMessage( new Message(exp) );
+
+ // Kind of a hack but Axis doesn't have any way for a
+ // handler to throw an exception AND include a fault
+ // header in the response message - so for now just
+ // have the RM code pass it back this way - hopefully
+ // we'll have a nicer solution in the WAS version
+ SOAPHeaderElement hdr ;
+ hdr = (SOAPHeaderElement) msgContext
+ .getProperty("HeaderFault");
+ if ( hdr != null ) {
+ SOAPEnvelope env = msgContext.getResponseMessage()
+ .getSOAPEnvelope();
+ env.addHeader( hdr );
}
+ // End of hack
+
+ /* Process the Global Response Chain */
+ /***********************************/
+ // Process global/hard-coded handlers
+ WSAHandler.fixAction( msgContext );
+ WSAHandler.invoke( msgContext );
+
+ if ((h = getGlobalResponse()) != null)
+ h.invoke(msgContext);
+ }
}
- if( tlog.isDebugEnabled() ) {
- t2=System.currentTimeMillis();
- }
- /* Process the Global Request Chain */
- /**********************************/
- if ((h = getGlobalRequest()) != null ) {
- h.invoke(msgContext);
- }
+ if ( !skipService )
+ invokeService(msgContext);
- /**
- * At this point, the service should have been set by someone
- * (either the originator of the MessageContext, or one of the
- * transport or global Handlers). If it hasn't been set, we
- * fault.
- */
- h = msgContext.getService();
- if (h == null) {
- // It's possible that we haven't yet parsed the
- // message at this point. This is a kludge to
- // make sure we have. There probably wants to be
- // some kind of declarative "parse point" on the handler
- // chain instead....
- Message rm = msgContext.getRequestMessage();
- rm.getSOAPEnvelope().getFirstBody();
-
- h = msgContext.getService();
- if (h == null)
- throw new AxisFault("Server.NoService",
- Messages.getMessage("noService05",
- "" + msgContext.getTargetService()),
- null, null );
- }
- if( tlog.isDebugEnabled() ) {
- t3=System.currentTimeMillis();
- }
+ msgContext.setPastPivot( true );
- initSOAPConstants(msgContext);
- try {
- h.invoke(msgContext);
- } catch (AxisFault ae) {
- if ((h = getGlobalRequest()) != null ) {
- h.onFault(msgContext);
- }
- throw ae;
- }
+ /*
+ if ( msgContext.getIsOneWay() )
+ msgContext.setResponseMessage( null );
+ */
- if( tlog.isDebugEnabled() ) {
- t4=System.currentTimeMillis();
- }
+ // Send async response if needed
+ WSAHandler.sendResponse( msgContext );
- /* Process the Global Response Chain */
- /***********************************/
- if ((h = getGlobalResponse()) != null)
- h.invoke(msgContext);
+ invokeOutboundTransport(msgContext);
- /* Process the Transport Specific Response Chain */
- /***********************************************/
- if (transportChain != null) {
- h = transportChain.getResponseHandler();
- if (h != null)
- h.invoke(msgContext);
- }
-
- if( tlog.isDebugEnabled() ) {
+ if ( tlog.isDebugEnabled() ) {
t5=System.currentTimeMillis();
tlog.debug( "AxisServer.invoke2 " +
" preTr=" +
@@ -337,7 +490,7 @@
* Extract ans store soap constants info from the envelope
* @param msgContext
* @throws AxisFault
- */
+ */
private void initSOAPConstants(MessageContext msgContext) throws AxisFault {
Message msg = msgContext.getRequestMessage();
if (msg == null)
@@ -466,9 +619,9 @@
// make sure we have. There probably wants to be
// some kind of declarative "parse point" on the handler
// chain instead....
- Message rm = msgContext.getRequestMessage();
- if (rm != null) {
- rm.getSOAPEnvelope().getFirstBody();
+ Message msg = msgContext.getRequestMessage();
+ if (msg != null) {
+ msg.getSOAPEnvelope().getFirstBody();
h = msgContext.getService();
}
if (h == null) {
Modified: webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/SimpleAxisServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/SimpleAxisServer.java?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/SimpleAxisServer.java (original)
+++ webservices/axis/trunk/proposals/dug/java/src/org/apache/axis/transport/http/SimpleAxisServer.java Mon Feb 13 15:36:47 2006
@@ -337,6 +337,12 @@
pool.shutdown();
}
+ public void startListening(int port) throws Exception {
+ ServerSocket ss = new ServerSocket(port);
+ setServerSocket(ss);
+ start( true );
+ }
+
/**
* Server process.
*/
Modified: webservices/axis/trunk/proposals/dug/java/test/functional/FunctionalTests.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/test/functional/FunctionalTests.java?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/test/functional/FunctionalTests.java (original)
+++ webservices/axis/trunk/proposals/dug/java/test/functional/FunctionalTests.java Mon Feb 13 15:36:47 2006
@@ -80,6 +80,8 @@
//suite.addTestSuite(TestMimeHeaders.class);
suite.addTestSuite(TestAutoTypes.class);
+
+ suite.addTestSuite(TestWSA.class);
return suite;
}
Modified: webservices/axis/trunk/proposals/dug/java/test/functional/auto-deploy.wsdd
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/proposals/dug/java/test/functional/auto-deploy.wsdd?rev=377534&r1=377533&r2=377534&view=diff
==============================================================================
--- webservices/axis/trunk/proposals/dug/java/test/functional/auto-deploy.wsdd (original)
+++ webservices/axis/trunk/proposals/dug/java/test/functional/auto-deploy.wsdd Mon Feb 13 15:36:47 2006
@@ -5,15 +5,18 @@
<globalConfiguration>
<parameter name="axis.doAutoTypes" value="true"/>
<parameter name="disablePrettyXML" value="true"/>
- <requestFlow>
- <handler type="java:org.apache.axis.handlers.JWSHandler">
- <parameter name="scope" value="session"/>
- </handler>
- <handler type="java:org.apache.axis.handlers.JWSHandler">
- <parameter name="scope" value="request"/>
- <parameter name="extension" value=".jwr"/>
- </handler>
- </requestFlow>
</globalConfiguration>
+
+ <transport name="SimpleHTTP">
+ <requestFlow>
+ <handler type="java:org.apache.axis.handlers.JWSHandler">
+ <parameter name="scope" value="session"/>
+ </handler>
+ <handler type="java:org.apache.axis.handlers.JWSHandler">
+ <parameter name="scope" value="request"/>
+ <parameter name="extension" value=".jwr"/>
+ </handler>
+ </requestFlow>
+ </transport>
</deployment>