You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/07 21:21:33 UTC
svn commit: r230690 - in /beehive/trunk/system-controls:
src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/
test/src/webservice/ test/src/webservice/schemas/
test/src/webservice/schemas/rpcEncoded/
test/src/webservice/servers/webapp/W...
Author: ekoneil
Date: Sun Aug 7 12:21:27 2005
New Revision: 230690
URL: http://svn.apache.org/viewcvs?rev=230690&view=rev
Log:
Change the service control from being free-threaded and managing state in ThreadLocals to managing state internally. Controls are meant to be stateful, and things like the JdbcControl aren't intended to be free-threaded. This change makes the state management consistent with the other system controls shipped in Beehive.
Fix for BEEHIVE-869.
Differences from the original patch:
- switched to using commons-logging instead of Log4J in some of the tests
- fixed some of the tests to use StringHolder rather than GenericHolder. Apparently, this was necessitated by the change to Velocity. I think this was the right thing to do (the tests pass...), but Chad, can you take a look at this and sanity check the changes? Thanks!
Contribution from Chad Schoettger.
BB: self
DRT: Beehive / web service control pass
Added:
beehive/trunk/system-controls/test/src/webservice/schemas/HandlerDocLitEndpoint.wsdl
beehive/trunk/system-controls/test/src/webservice/schemas/HandlerRpcLitEndpoint.wsdl
beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/HandlerRpcEncEndpoint.wsdl
beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/
beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java (with props)
beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcEncEndpoint.jws
beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcLitEndpoint.jws
beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java (with props)
beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java (with props)
beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java (with props)
Modified:
beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
beehive/trunk/system-controls/test/src/webservice/build.xml
Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java?rev=230690&r1=230689&r2=230690&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/HeaderHandler.java Sun Aug 7 12:21:27 2005
@@ -20,10 +20,11 @@
import java.util.ArrayList;
import java.util.Iterator;
import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.Handler;
-import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.rpc.JAXRPCException;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
@@ -35,21 +36,35 @@
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Element;
-public class HeaderHandler
- implements Handler {
-
+/*
+ * This class provides some minimal support for handlers from the service control.
+ * Eventually it would be nice to add new annotations to the service control which
+ * would allow a user to set their own handlers on the client, once that happens
+ * this class should be removed from the source tree.
+ */
+public class HeaderHandler extends GenericHandler
+{
private static Log LOGGER = LogFactory.getLog(HeaderHandler.class);
- static ThreadLocal localInHeaders = new ThreadLocal();
+ static final String OUTPUT_ELEMENTS_KEY = "handlerOutputElements";
+ static final String INPUT_ELEMENTS_KEY = "handlerInputElements";
- static ThreadLocal localOutHeaders = new ThreadLocal();
+ private HandlerInfo _handlerInfo;
/**
- * Sign outgoing request message.
+ * Add the header values from the HandlerInfo.HandlerConfig Map to the outgoing message.
+ *
+ * @param mc MessageContext.
+ * @return true if handler chain processing should continue.
*/
- public boolean handleRequest(MessageContext mc) {
- System.out.println("In HeaderHandler's handleRequest myOutHeaders: "
- + localOutHeaders.get());
+ public boolean handleRequest(MessageContext mc)
+ {
+ final Element[] outHeaders = (Element[])_handlerInfo.getHandlerConfig().get(OUTPUT_ELEMENTS_KEY);
+ if(outHeaders == null || outHeaders.length == 0) {
+ return true;
+ }
+
+ LOGGER.debug("In HeaderHandler's handleRequest myOutHeaders: " + outHeaders);
try {
SOAPMessageContext smc = (SOAPMessageContext)mc;
@@ -61,45 +76,27 @@
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
- /**
- * Create new header element. We don't specify a role on this header
- * element, meaning the target role is the "ultimate destination".
- */
- Element[] elemsToAdd = (Element[])localOutHeaders.get();
-
- if(null == elemsToAdd) {
- LOGGER.debug("no header to send");
- return true;
- }
- for(Element nxtElement : elemsToAdd) {
- header
- .addChildElement(new org.apache.axis.message.SOAPHeaderElement(
- nxtElement)); // NOTE: Axis specific
+ for(Element nxtElement : outHeaders ) {
+ header.addChildElement(new org.apache.axis.message.SOAPHeaderElement(nxtElement));
}
- }
- catch(SOAPException e) {
+ } catch(SOAPException e) {
e.printStackTrace();
LOGGER.error("Failed to add header.", e);
+ throw new JAXRPCException(e);
}
return true;
}
/**
- *
- */
- static public void reset() {
- localInHeaders = new ThreadLocal();
- localOutHeaders = new ThreadLocal();
-
- }
-
- /**
- * Check incoming response message.
- */
- public boolean handleResponse(MessageContext mc) {
- System.out.println("In HeaderHandler's handleResponse");
+ * Build a list of SOAPHeaders found in the response.
+ * @param mc MessageContext.
+ * @return true if the next handler in the chain should be invoked.
+ */
+ public boolean handleResponse(MessageContext mc)
+ {
+ LOGGER.debug("In HeaderHandler's handleResponse");
try {
SOAPMessageContext smc = (SOAPMessageContext)mc;
@@ -120,25 +117,19 @@
list.add((Element)nxtSoapElement.cloneNode(true));
}
- Element[] elems = (Element[])list
- .toArray(new Element[list.size()]); // Use generics
- localInHeaders.set(elems);
+ Element[] inHeaders = list.toArray(new Element[list.size()]);
+ // TODO: This is a hack to enable support of the current service control API
+ // Once the service control API has been modified to allow users to set their
+ // own handlers this (HeaderHandler) should just go away.
+ _handlerInfo.getHandlerConfig().put(INPUT_ELEMENTS_KEY, inHeaders);
+ LOGGER.debug("myInHeaders: " + inHeaders);
}
catch(SOAPException e) {
e.printStackTrace();
LOGGER.error("Error extracting the header.", e);
+ throw new JAXRPCException(e);
}
-
- LOGGER.debug("myInHeaders: " + localInHeaders.get());
- return true;
- }
-
- /**
- * Check incoming response message.
- */
- public boolean handleFault(MessageContext mc) {
- System.out.println("In HeaderHandler's handleFault");
return true;
}
@@ -147,42 +138,17 @@
*
* @see javax.xml.rpc.handler.Handler#init(javax.xml.rpc.handler.HandlerInfo)
*/
- public void init(HandlerInfo arg0) {
- System.out.println("In HeaderHandler's init");
-
+ public void init(HandlerInfo handlerInfo)
+ {
+ _handlerInfo = handlerInfo;
}
- /*
- * (non-Javadoc)
- *
- * @see javax.xml.rpc.handler.Handler#destroy()
- */
- public void destroy() {
- LOGGER.debug("In HeaderHandler's destroy");
-
- }
-
- /*
- * (non-Javadoc)
+ /**
*
- * @see javax.xml.rpc.handler.Handler#getHeaders()
+ * @return array of headers
*/
- public QName[] getHeaders() {
- // TODO Auto-generated method stub
+ public QName[] getHeaders()
+ {
return null;
- }
-
- /**
- * @return Returns the inHeaders.
- */
- static public Element[] getInHeaders() {
- return (Element[])localInHeaders.get();
- }
-
- /**
- * @param outHeaders The outHeaders to set.
- */
- static public void setOutHeaders(Element[] outHeaders) {
- localOutHeaders.set(outHeaders);
}
}
Modified: beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs?rev=230690&r1=230689&r2=230690&view=diff
==============================================================================
--- beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs (original)
+++ beehive/trunk/system-controls/src/webservice/org/apache/beehive/controls/system/webservice/jaxrpc/ServiceControlImpl.jcs Sun Aug 7 12:21:27 2005
@@ -20,7 +20,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
@@ -31,6 +30,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import javax.jws.WebParam;
import javax.jws.soap.SOAPBinding;
import javax.xml.namespace.QName;
@@ -45,10 +45,11 @@
import org.apache.axis.constants.Use;
import org.apache.beehive.controls.api.ControlException;
+import org.apache.beehive.controls.api.events.EventHandler;
import org.apache.beehive.controls.api.bean.ControlImplementation;
import org.apache.beehive.controls.api.bean.Extensible;
-import org.apache.beehive.controls.api.context.Context;
import org.apache.beehive.controls.api.context.ControlBeanContext;
+import org.apache.beehive.controls.api.context.ResourceContext;
import org.apache.beehive.controls.system.webservice.ServiceControl;
import org.apache.beehive.controls.system.webservice.utils.HolderUtils;
import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
@@ -67,65 +68,113 @@
import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
@ControlImplementation
-public class ServiceControlImpl
- implements ServiceControl, Extensible, Serializable {
-
+public class ServiceControlImpl implements ServiceControl, Extensible, java.io.Serializable
+{
+ private static final int TIMOUT_DEFAULT = 1000;
private static final Log LOGGER = LogFactory.getLog(ServiceControlImpl.class);
- @Context
- public ControlBeanContext cbContext;
-
- BindingLookupService lookupService = null;
-
- TypeRegistrar registrar = null;
-
- Service service = null;
+ //
+ // contexts provided by the beehive controls runtime
+ //
+ @org.apache.beehive.controls.api.context.Context
+ protected ControlBeanContext _context;
+ @org.apache.beehive.controls.api.context.Context
+ protected ResourceContext _resourceContext;
- QName portType;
- BeehiveWsTypeMetadata mWSTM;
+ private QName _portType;
+ private BeehiveWsTypeMetadata _beehiveTypeMetadata;
+ private URL _endPoint;
+ private QName _wsdlPort;
+ private QName _serviceName;
+ private String _username;
+ private String _password;
+ private int _timeout = TIMOUT_DEFAULT;
- URL endPoint = null;
+ private transient TypeRegistrar _registrar;
+ private transient Service _service;
+ private transient HashMap<BeehiveWsMethodMetadata, Call> _callCache;
- QName wsdlPort = null;
+ private Element[] _handlerOutputHeaders;
+ private HandlerInfo _handlerInfo;
- String username = null;
+ /**
+ * Constructor.
+ */
+ public ServiceControlImpl() { }
- String password = null;
+ /**
+ * Invoked by the controls runtime when a new instance of this class is aquired by the runtime.
+ */
+ @EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onAcquire")
+ public void onAquire()
+ {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Enter: onAquire()");
+ }
- int timeout = 1000;
+ if (_service == null) {
+ initialize();
+ }
+ }
- boolean initialized = false;
+ /**
+ * Invoked by the controls runtime when an instance of this class is released by the runtime.
+ */
+ @EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease")
+ public void onRelease()
+ {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Enter: onRelease()");
+ }
- public ServiceControlImpl() {
+ _service = null;
+ _callCache = null;
}
/**
- * @param method
- * @param args
- * @throws Exception
+ * Called by the Controls runtime to handle calls to methods of an extensible control.
+ *
+ * @param method The extended operation that was called.
+ * @param args Parameters of the operation.
+ * @return The value that should be returned by the operation.
+ * @throws Throwable any exception declared on the extended operation may be
+ * thrown. If a checked exception is thrown from the implementation that is not declared
+ * on the original interface, it will be wrapped in a ControlException.
*/
- public Object invoke(Method method, Object[] args)
- throws NoSuchMethodException, Exception {
+ public Object invoke(Method method, Object[] args) throws Throwable
+ {
LOGGER.debug("invoke method: " + method.getName());
- initialize();
+
+ HashMap<String, Element[]> handlerConfig = new HashMap<String, Element[]>();
+ handlerConfig.put(HeaderHandler.OUTPUT_ELEMENTS_KEY, _handlerOutputHeaders);
+ handlerConfig.put(HeaderHandler.INPUT_ELEMENTS_KEY, null);
+ _handlerInfo.setHandlerConfig(handlerConfig);
+
String operationName = method.getName();
String alternateOperationName = getAlternateOperationName(method);
- if(null != alternateOperationName)
+ if(alternateOperationName != null) {
operationName = alternateOperationName;
+ }
BeehiveWsMethodMetadata wmm = findMethodInOM(method, operationName);
+ Call call;
+ if (getCallCache().containsKey(wmm)) {
+ call = getCallCache().get(wmm);
+ } else {
+ call = buildCallObject(method, wmm);
+ getCallCache().put(wmm, call);
+ }
- Call call = buildCallObject(method, wmm);
+ initCallObject(call);
Object[] callArgs = prepareArgsForSend(method, wmm, args);
- Object res = null;
+ Object res;
try {
res = call.invoke(callArgs);
- }
- catch(RemoteException e) {
+ } catch(RemoteException e) {
throw new ControlException(e.getMessage(), e);
}
@@ -133,8 +182,120 @@
return res;
}
- // create a new copy of the args where holders value have been extracted.
- // ignore the out values
+ /**
+ * @return Returns the endPoint.
+ */
+ public URL getEndPoint() {
+ if (_endPoint == null) {
+ configureEndPoint();
+ }
+ return _endPoint;
+ }
+
+ /**
+ * @param endPoint The endPoint to set.
+ */
+ public void setEndPoint(URL endPoint) {
+ this._endPoint = endPoint;
+ }
+
+ /**
+ * @return Returns the password.
+ */
+ public String getPassword() {
+ return _password;
+ }
+
+ /**
+ * @param password The password to set.
+ */
+ public void setPassword(String password) {
+ this._password = password;
+ }
+
+ /**
+ * @return Returns the timeout.
+ */
+ public int getTimeout() {
+ return _timeout;
+ }
+
+ /**
+ * @param timeout The timeout to set.
+ */
+ public void setTimeout(int timeout) {
+ this._timeout = timeout;
+ }
+
+ /**
+ * @return Returns the username.
+ */
+ public String getUsername() {
+ return _username;
+ }
+
+ /**
+ * @param username The username to set.
+ */
+ public void setUsername(String username) {
+ this._username = username;
+ }
+
+ /**
+ * @return Returns the wsdlPort.
+ */
+ public QName getWsdlPort() {
+ return _wsdlPort;
+ }
+
+ /**
+ * @param wsdlPort The wsdlPort to set.
+ */
+ public void setWsdlPort(QName wsdlPort) {
+ this._wsdlPort = wsdlPort;
+ }
+
+ /**
+ *
+ */
+ public void reset() {
+ _endPoint = null;
+ _wsdlPort = null;
+ _username = null;
+ _password = null;
+ _timeout = TIMOUT_DEFAULT;
+ }
+
+ /**
+ * Contains the list of headers recived from the web service, processed by HeaderHandler.
+ */
+ public Element[] getInputHeaders()
+ {
+ return (Element[])_handlerInfo.getHandlerConfig().get(HeaderHandler.INPUT_ELEMENTS_KEY);
+ }
+
+ /**
+ * Set the list of output headers to add to the call's request to the webservice.
+ * @param headers
+ */
+ public void setOutputHeaders(Element[] headers)
+ {
+ _handlerOutputHeaders = headers;
+ }
+
+ /* --------------------------------------------------------------------------------------- */
+ /* PRIVATE METHODS */
+ /* --------------------------------------------------------------------------------------- */
+
+ /**
+ * Create a new copy of the args where holders value have been extracted.
+ * Ignore the out values.
+ *
+ * @param method Method being processed.
+ * @param wmm beehive ws object model.
+ * @param args call arguments.
+ * @return An argument list with all OUT mode parameters removed.
+ */
private Object[] prepareArgsForSend(Method method,
BeehiveWsMethodMetadata wmm,
Object[] args) {
@@ -168,16 +329,20 @@
argsList.add(args[i]);
}
}
- Object[] res = (Object[])argsList.toArray(new Object[argsList.size()]);
- return res;
+ return argsList.toArray(new Object[argsList.size()]);
}
- // fill the hodlers in the argument array with the result of the call
- private void fillHolders(Method method,
- BeehiveWsMethodMetadata wmm,
- Call call,
- Object[] args) {
+ /**
+ * Fill the hodlers in the argument array with the result of the call.
+ * @param method Method being processed.
+ * @param wmm beehive object model
+ * @param call Call
+ * @param args call arguments.
+ */
+ private void fillHolders(Method method, BeehiveWsMethodMetadata wmm,
+ Call call, Object[] args)
+ {
Map outParam = call.getOutputParams();
if(outParam.isEmpty())
@@ -203,10 +368,10 @@
try {
LOGGER.info("Fill the holder object: " + nxtParamMetaData.getWpName());
Holder holder = (Holder)args[i];
- Object value = null; // find the value, only check for
- // localpart of the name, as the
- // namespace
- // may not be filled
+ Object value = null;
+
+ // find the value, only check for
+ // localpart of the name, as the namespace may not be filled
boolean hasReturnValue = false;
for(Object nxtOutParamKey : outParam.keySet()) {
if(((QName)nxtOutParamKey).getLocalPart().equals(nxtParamMetaData.getWpName())) {
@@ -223,86 +388,83 @@
catch(Exception e) {
throw new ControlException("Failed in getting holder value for: " + nxtParamMetaData.getWpName());
}
-
- }
- else {
- continue;
}
}
}
+ /**
+ * Stuff a value into a holder.
+ * @param holder Holder to recive the value.
+ * @param value The value.
+ * @throws NoSuchFieldException
+ * @throws IllegalAccessException
+ */
private void stuffHolderValue(Holder holder, Object value)
throws NoSuchFieldException, IllegalAccessException {
HolderUtils.stuffHolderValue(holder, value);
}
- /**
- * @param method
- * @param wmm
- * @return
- * @throws ServiceException
- * @throws Exception
- */
- private Call buildCallObject(Method method, BeehiveWsMethodMetadata wmm)
- throws ServiceException, Exception {
-
- // TODO: Later cache the call objects for each method.
- Call call = null;
- try {
- call = service.createCall();
- }
- catch(ServiceException se) {
- throw new ControlException(se.getMessage(), se);
- }
+ private void initCallObject(Call call) {
- if(getWsdlPort() != null) {
- call.setPortTypeName(getWsdlPort());
- }
+ call.setPortTypeName(getWsdlPort());
if(getUsername() != null) {
call.setProperty(Call.USERNAME_PROPERTY, getUsername());
+ } else {
+ call.removeProperty(Call.USERNAME_PROPERTY);
}
if(getPassword() != null) {
call.setProperty(Call.PASSWORD_PROPERTY, getPassword());
+ } else {
+ call.removeProperty(Call.PASSWORD_PROPERTY);
}
- call.setOperationName(
- new javax.xml.namespace.QName(mWSTM.getWsTargetNamespace(), wmm.getWmOperationName()));
-
- // The target endpoint
LOGGER.debug("endpoint: " + getEndPoint().toExternalForm());
call.setTargetEndpointAddress(getEndPoint().toExternalForm());
+ }
+
+ /**
+ * Build a call object for the specified web method.
+ * @param method
+ * @param wmm
+ * @return Call
+ */
+ private Call buildCallObject(Method method, BeehiveWsMethodMetadata wmm) {
+
+ Call call;
+
+ try {
+ call = getService(_serviceName).createCall();
+ } catch(ServiceException se) {
+ throw new ControlException(se.getMessage(), se);
+ }
+
+ call.setOperationName(new QName(_beehiveTypeMetadata.getWsTargetNamespace(), wmm.getWmOperationName()));
- // set style
- SOAPBinding.Style omStyle = mWSTM.getSoapBinding().getStyle();
- String style;
+ SOAPBinding.Style omStyle = _beehiveTypeMetadata.getSoapBinding().getStyle();
+ final String style;
if(omStyle == SOAPBinding.Style.DOCUMENT) {
- if(mWSTM.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED) {
- // wrapped implies document
+ if(_beehiveTypeMetadata.getSoapBinding().getParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED) {
style = "wrapped";
- }
- else {
+ } else {
style = "document";
}
- }
- else if(omStyle == SOAPBinding.Style.RPC) {
+ } else if(omStyle == SOAPBinding.Style.RPC) {
style = "rpc";
- }
- else {
+ } else {
throw new ControlException("Invalid Binding style: " + omStyle);
}
LOGGER.debug("Call style: " + style);
call.setProperty(Call.OPERATION_STYLE_PROPERTY, style);
- if("rpc".equals(style) && SOAPBinding.Use.LITERAL == mWSTM.getSoapBinding().getUse()) {
+ if("rpc".equals(style) && SOAPBinding.Use.LITERAL == _beehiveTypeMetadata.getSoapBinding().getUse()) {
((org.apache.axis.client.Call)call).setOperationUse(Use.LITERAL);
}
// walk the argument meta data list, register type of parameters, add
// parameters to the call object
- // TODO: Make sure there is nothing special that needs to be done about holder objects.
List<BeehiveWsParameterMetadata> omArgMetaDataList = new ArrayList<BeehiveWsParameterMetadata>();
omArgMetaDataList.addAll(wmm.getParams());
@@ -347,10 +509,10 @@
}
registeredTypeQName =
- registrar.registerType(javaTypeFromClass,
+ getRegistrar().registerType(javaTypeFromClass,
nxtArgMetaData.getXmlType(),
- mWSTM.getSoapBinding().getStyle(),
- mWSTM.getSoapBinding().getUse());
+ _beehiveTypeMetadata.getSoapBinding().getStyle(),
+ _beehiveTypeMetadata.getSoapBinding().getUse());
final QName headerParamQName;
if(omStyle == SOAPBinding.Style.RPC) {
@@ -380,26 +542,27 @@
// register the return type
final Class javaTypeFromClass = method.getReturnType();
if(!wmm.isOneWay() && javaTypeFromClass != void.class) {
- QName resultsRegisteredTypeQName = registrar.registerType(
+ QName resultsRegisteredTypeQName = _registrar.registerType(
javaTypeFromClass,
wmm.getXmlReturnType(),
- mWSTM.getSoapBinding().getStyle(),
- mWSTM.getSoapBinding().getUse());
+ _beehiveTypeMetadata.getSoapBinding().getStyle(),
+ _beehiveTypeMetadata.getSoapBinding().getUse());
call.setReturnType(resultsRegisteredTypeQName, javaTypeFromClass);
} else {
- call.setReturnType(registrar.getVoidType());
+ call.setReturnType(_registrar.getVoidType());
}
// AXIS dependecy... this is needed for the Handlers
- call.setProperty(org.apache.axis.client.Call.JAXRPC_PORTTYPE_NAME,
- portType);
+ call.setProperty(org.apache.axis.client.Call.WSDL_PORT_NAME, _portType);
return call;
}
/**
- * @param method
- * @param operationName
+ * Find the method which we are processing in the ws object model.
+ * @param method Method being processed.
+ * @param operationName Name of operation.
+ * @return BeehiveWsMethodMetadata
*/
private BeehiveWsMethodMetadata findMethodInOM(Method method, String operationName) {
@@ -416,7 +579,7 @@
paramTypes[i] = TypeRegistrar.getHoldersValueClass(genericParamTypes[i]);
}
}
- BeehiveWsMethodMetadata wmm = mWSTM.getMethod(operationName, paramTypes);
+ BeehiveWsMethodMetadata wmm = _beehiveTypeMetadata.getMethod(operationName, paramTypes);
if(wmm == null) {
StringBuffer sb = new StringBuffer("No Jsr181MethodMetadata found for " + operationName + '(');
boolean first = true;
@@ -436,90 +599,80 @@
return wmm;
}
- private synchronized void initialize() {
-
- if(initialized)
- return;
-
- XmlBeanWSDLProcessor wsdlProcessor = null;
-
- lookupService = new SystemTypeLookupService();
- wsdlProcessor = new XmlBeanWSDLProcessor(parseWSDL(), lookupService);
+ /**
+ * Initialize the service control. Invoked during onAquire() event.
+ */
+ private void initialize() {
- assert wsdlProcessor != null : "Did not find a valid WSDL processor";
+ BindingLookupService lookupService = new SystemTypeLookupService();
+ XmlBeanWSDLProcessor wsdlProcessor = new XmlBeanWSDLProcessor(parseWSDL(), lookupService);
+ _serviceName = wsdlProcessor.getServiceName();
try {
- mWSTM = wsdlProcessor.getObjectModel();
- service = ServiceFactory.newInstance().createService(wsdlProcessor.getServiceName());
- }
- catch(ServiceException se) {
- throw new ControlException(se.getMessage(), se);
- }
- catch(Exception e) {
+ _beehiveTypeMetadata = wsdlProcessor.getObjectModel();
+ } catch(Exception e) {
throw new ControlException(e.getMessage(), e);
}
- HandlerInfo hInfo = new HandlerInfo();
- hInfo.setHandlerClass(HeaderHandler.class);
-
- TypeMapping tm = service.getTypeMappingRegistry().getDefaultTypeMapping();
- registrar = new AxisTypeRegistrar((org.apache.axis.encoding.TypeMapping)tm, lookupService);
+ _handlerInfo = new HandlerInfo();
+ _handlerInfo.setHandlerClass(HeaderHandler.class);
+ _portType = new QName(_beehiveTypeMetadata.getWsTargetNamespace(), _beehiveTypeMetadata.getWsName());
configureEndPoint();
-
- // porttype
- portType = new QName(mWSTM.getWsTargetNamespace(), mWSTM.getWsName());
-
- // name
- service.getHandlerRegistry().getHandlerChain(portType).add(hInfo);
-
- initialized = true;
-
}
- private String getAlternateOperationName(Method method) {
-
- ServiceControl.OperationName opName =
- cbContext.getMethodPropertySet(method, ServiceControl.OperationName.class);
-
+ /**
+ * Get the alternate operation name (if OperationName annoation has been set).
+ * @param method Service control method we are processing.
+ * @return Alternate operation name, null if not defined.
+ */
+ private String getAlternateOperationName(Method method)
+ {
+ ServiceControl.OperationName opName = _context.getMethodPropertySet(method, ServiceControl.OperationName.class);
if(opName != null) {
return opName.value();
}
+
return null;
}
- private DefinitionsDocument parseWSDL() {
-
+ /**
+ * Load the serialized object model from disk.
+ * @return DefinitionsDocument
+ */
+ private DefinitionsDocument parseWSDL()
+ {
File f = null;
URL url = null;
InputStream wsdlStream = null;
try {
- ServiceControl.WSDL wsdl = (ServiceControl.WSDL)cbContext.getControlPropertySet(ServiceControl.WSDL.class);
+
+ ServiceControl.WSDL wsdl = _context.getControlPropertySet(ServiceControl.WSDL.class);
assert(wsdl != null) : "The control is mising the required @WSDL annotations";
assert(wsdl.path() != null) : "The control is missing the required path attribute for the @WSDL annotations";
- if(wsdl == null)
+ if(wsdl == null) {
throw new ControlException("No WSDL annotation found.");
+ }
LOGGER.debug("read wsdl from: " + wsdl.path());
if(wsdl.path().startsWith("http://") || wsdl.path().startsWith("file:/")) {
url = new URL(wsdl.path());
wsdlStream = url.openStream();
- }
- else { // it is a local file name
- wsdlStream = cbContext.getBeanContext().getResourceAsStream(wsdl.path(), null);
+
+ } else {
+
+ // it is a local file name
+ wsdlStream = _context.getBeanContext().getResourceAsStream(wsdl.path(), null);
if(wsdlStream == null) {
LOGGER.info("Failed to load the wsdl from context, will try classloader!");
wsdlStream = this.getClass().getClassLoader().getResourceAsStream(wsdl.path());
- /*
- todo: why does this try to load from a hard file path?
- this value is generally unstable in a running server
- */
+ //todo: why does this try to load from a hard file path? this value is generally unstable in a running server
if(null == wsdlStream) {
f = new File(wsdl.path());
wsdlStream = new FileInputStream(f);
@@ -538,6 +691,7 @@
fpath = f.getCanonicalPath();
}
catch(IOException ioe) {
+ // noop
}
LOGGER.error("ERROR: WSDL File not found: " + fpath);
throw new ControlException("ERROR: WSDL File not found: " + fpath, e);
@@ -551,20 +705,20 @@
}
finally {
if(wsdlStream != null) {
- try {
- wsdlStream.close();
- }
- catch(IOException ioe) {
- }
+ try { wsdlStream.close(); } catch(IOException ioe) { /* noop */ }
}
}
}
- private void configureEndPoint() {
-
- if(getEndPoint() == null) {
- ServiceControl.Location location =
- (ServiceControl.Location)cbContext.getControlPropertySet(ServiceControl.Location.class);
+ /**
+ * Configure the endpoint for the web service. If an endpoint has been explicitly set by the user,
+ * use that endpoint. If an endpoint has not been set get the endpoint from the ServiceControl.Location
+ * annotation.
+ */
+ private void configureEndPoint()
+ {
+ if(_endPoint == null) {
+ ServiceControl.Location location = _context.getControlPropertySet(ServiceControl.Location.class);
if(location != null) {
assert location.urls() != null;
@@ -572,140 +726,60 @@
try {
setEndPoint(new URL(location.urls()[0]));
- }
- catch(MalformedURLException e) {
+ } catch(MalformedURLException e) {
throw new ControlException(e.getMessage(), e);
}
- }
- else {
+
+ } else {
throw new ControlException("No Location annotation found.");
}
}
}
/**
- * @return Returns the endPoint.
- */
- public URL getEndPoint() {
- return endPoint;
- }
-
- /**
- * @param endPoint The endPoint to set.
+ * The callCache is transient so may need to create a new one
+ * if a serialization has occured.
+ * @return HashMap
*/
- public void setEndPoint(URL endPoint) {
- this.endPoint = endPoint;
- }
-
- /**
- * @return Returns the password.
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * @param password The password to set.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- /**
- * @return Returns the registrar.
- */
- public TypeRegistrar getRegistrar() {
- return registrar;
- }
-
- /**
- * @param registrar The registrar to set.
- */
- public void setRegistrar(TypeRegistrar registrar) {
- this.registrar = registrar;
- }
-
- /**
- * @return Returns the service.
- */
- public Service getService() {
- return service;
- }
-
- /**
- * @param service The service to set.
- */
- public void setService(Service service) {
- this.service = service;
- }
-
- /**
- * @return Returns the timeout.
- */
- public int getTimeout() {
- return timeout;
- }
-
- /**
- * @param timeout The timeout to set.
- */
- public void setTimeout(int timeout) {
- this.timeout = timeout;
- }
-
- /**
- * @return Returns the username.
- */
- public String getUsername() {
- return username;
+ private HashMap<BeehiveWsMethodMetadata, Call> getCallCache() {
+ if (_callCache == null) {
+ _callCache = new HashMap<BeehiveWsMethodMetadata, Call>();
+ }
+ return _callCache;
}
/**
- * @param username The username to set.
+ * Get the service, service is transient so may need to create a new one
+ * if a serialization has occurec.
+ *
+ * @param serviceName QName of service.
+ * @return Service
*/
- public void setUsername(String username) {
- this.username = username;
- }
+ private Service getService(QName serviceName) {
- /**
- * @return Returns the wsdlPort.
- */
- public QName getWsdlPort() {
- return wsdlPort;
+ if (_service == null) {
+ try {
+ _service = ServiceFactory.newInstance().createService(serviceName);
+ } catch (ServiceException e) {
+ throw new ControlException(e.getMessage(), e);
+ }
+ _service.getHandlerRegistry().getHandlerChain(_portType).add(_handlerInfo);
+ }
+ return _service;
}
/**
- * @param wsdlPort The wsdlPort to set.
+ * Get a TypeRegistrar, TypeRegistrar is transient so may need to create a new one
+ * if a serialization has occured.
+ * @return TypeRegistrar
*/
- public void setWsdlPort(QName wsdlPort) {
- this.wsdlPort = wsdlPort;
- }
+ private TypeRegistrar getRegistrar() {
- /**
- *
- */
- public void reset() {
- endPoint = null;
- wsdlPort = null;
- username = null;
- password = null;
- timeout = 0;
- HeaderHandler.reset();
- }
-
- /*
- * @see org.apache.beehive.controls.system.webservice.ServiceControl#getInputHeaders()
- *
- * If there are any input header it is stored on my thread's Handler.
- */
- public Element[] getInputHeaders() {
- return HeaderHandler.getInHeaders();
- }
-
- /*
- * @see org.apache.beehive.controls.system.webservice.ServiceControl#setOutputHeaders(org.w3c.dom.Element[])
- */
- public void setOutputHeaders(Element[] headers) {
- HeaderHandler.setOutHeaders(headers);
+ if (_registrar == null) {
+ BindingLookupService lookupService = new SystemTypeLookupService();
+ TypeMapping tm = getService(_serviceName).getTypeMappingRegistry().getDefaultTypeMapping();
+ _registrar = new AxisTypeRegistrar((org.apache.axis.encoding.TypeMapping)tm, lookupService);
+ }
+ return _registrar;
}
}
Modified: beehive/trunk/system-controls/test/src/webservice/build.xml
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/build.xml?rev=230690&r1=230689&r2=230690&view=diff
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/build.xml (original)
+++ beehive/trunk/system-controls/test/src/webservice/build.xml Sun Aug 7 12:21:27 2005
@@ -98,6 +98,12 @@
</target>
+ <target name="build">
+ <ant dir="jcxgen-tests" target="build" inheritAll="false"/>
+ <antcall target="build-webapp"/>
+ <antcall target="build-client"/>
+ </target>
+
<!-- =================================================================== -->
<!-- drt - run the webservice control DRTs -->
<!-- =================================================================== -->
@@ -305,6 +311,10 @@
<check-wsdl webservicePath="header" webserviceName="HeaderDocLitEndpoint" drtWsdlDir="${wsdls.dir}"/>
<check-wsdl webservicePath="header" webserviceName="HeaderRpcLitEndpoint" drtWsdlDir="${wsdls.dir}"/>
<check-wsdl webservicePath="header" webserviceName="HeaderRpcEncEndpoint" drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
+
+ <check-wsdl webservicePath="handlers" webserviceName="HandlerDocLitEndpoint" drtWsdlDir="${wsdls.dir}"/>
+ <check-wsdl webservicePath="handlers" webserviceName="HandlerRpcLitEndpoint" drtWsdlDir="${wsdls.dir}"/>
+ <check-wsdl webservicePath="handlers" webserviceName="HandlerRpcEncEndpoint" drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
<check-wsdl webservicePath="soapMarshalling" webserviceName="SoapMarshallingRpcEnc"
drtWsdlDir="${rpc.encoded.wsdls.dir}"/>
Added: beehive/trunk/system-controls/test/src/webservice/schemas/HandlerDocLitEndpoint.wsdl
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/schemas/HandlerDocLitEndpoint.wsdl?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/schemas/HandlerDocLitEndpoint.wsdl (added)
+++ beehive/trunk/system-controls/test/src/webservice/schemas/HandlerDocLitEndpoint.wsdl Sun Aug 7 12:21:27 2005
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://handlers" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://handlers" xmlns:intf="http://handlers" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2
+Built on May 03, 2005 (02:20:24 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://handlers" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="inputHeader" type="xsd:string"/>
+ <element name="modifyStringHeader">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="inputHeader1" type="xsd:string"/>
+ <element name="modifyStringHeaderResponse">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="setHeaderStrings">
+ <complexType>
+ <sequence>
+ <element name="setValue" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="header1" type="xsd:string"/>
+ <element name="header2" type="xsd:string"/>
+ <element name="setHeaderStringsResponse">
+ <complexType>
+ <sequence/>
+ </complexType>
+ </element>
+ <element name="inputHeader2" type="xsd:int"/>
+ <element name="echointHeader">
+ <complexType>
+ <sequence>
+ <element name="inputint" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element name="inputHeader3" type="xsd:int"/>
+ <element name="echointHeaderResponse">
+ <complexType>
+ <sequence>
+ <element name="return" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="setHeaderStringsRequest">
+
+ <wsdl:part element="impl:setHeaderStrings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderRequest">
+
+ <wsdl:part element="impl:inputHeader2" name="inputHeader"/>
+
+ <wsdl:part element="impl:echointHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="setHeaderStringsResponse">
+
+ <wsdl:part element="impl:header1" name="header1"/>
+
+ <wsdl:part element="impl:header2" name="header2"/>
+
+ <wsdl:part element="impl:setHeaderStringsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderRequest">
+
+ <wsdl:part element="impl:inputHeader" name="inputHeader"/>
+
+ <wsdl:part element="impl:modifyStringHeader" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderResponse">
+
+ <wsdl:part element="impl:inputHeader1" name="inputHeader"/>
+
+ <wsdl:part element="impl:modifyStringHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderResponse">
+
+ <wsdl:part element="impl:inputHeader3" name="inputHeader"/>
+
+ <wsdl:part element="impl:echointHeaderResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HandlerDocLitEndpoint">
+
+ <wsdl:operation name="modifyStringHeader">
+
+ <wsdl:input message="impl:modifyStringHeaderRequest" name="modifyStringHeaderRequest"/>
+
+ <wsdl:output message="impl:modifyStringHeaderResponse" name="modifyStringHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings">
+
+ <wsdl:input message="impl:setHeaderStringsRequest" name="setHeaderStringsRequest"/>
+
+ <wsdl:output message="impl:setHeaderStringsResponse" name="setHeaderStringsResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader">
+
+ <wsdl:input message="impl:echointHeaderRequest" name="echointHeaderRequest"/>
+
+ <wsdl:output message="impl:echointHeaderResponse" name="echointHeaderResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="HandlerDocLitEndpointSoapBinding" type="impl:HandlerDocLitEndpoint">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="modifyStringHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="modifyStringHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:modifyStringHeaderRequest" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="modifyStringHeaderResponse">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:modifyStringHeaderResponse" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="setHeaderStringsRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="setHeaderStringsResponse">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header1" use="literal">
+
+ </wsdlsoap:header>
+
+ <wsdlsoap:header message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header2" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="echointHeaderRequest">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:echointHeaderRequest" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="echointHeaderResponse">
+
+ <wsdlsoap:body parts="parameters" use="literal"/>
+
+ <wsdlsoap:header message="impl:echointHeaderResponse" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HandlerDocLitEndpointService">
+
+ <wsdl:port binding="impl:HandlerDocLitEndpointSoapBinding" name="HandlerDocLitEndpoint">
+
+ <wsdlsoap:address location="http://localhost:8080/ServiceControlDRT/handlers/HandlerDocLitEndpoint.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: beehive/trunk/system-controls/test/src/webservice/schemas/HandlerRpcLitEndpoint.wsdl
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/schemas/HandlerRpcLitEndpoint.wsdl?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/schemas/HandlerRpcLitEndpoint.wsdl (added)
+++ beehive/trunk/system-controls/test/src/webservice/schemas/HandlerRpcLitEndpoint.wsdl Sun Aug 7 12:21:27 2005
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://handlers" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://handlers" xmlns:intf="http://handlers" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2
+Built on May 03, 2005 (02:20:24 EDT)-->
+
+ <wsdl:message name="setHeaderStringsRequest">
+
+ <wsdl:part name="setValue" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderRequest">
+
+ <wsdl:part name="inputHeader" type="xsd:int"/>
+
+ <wsdl:part name="inputint" type="xsd:int"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="setHeaderStringsResponse">
+
+ <wsdl:part name="header1" type="xsd:string"/>
+
+ <wsdl:part name="header2" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echoStringHeaderAndResultResponse">
+
+ <wsdl:part name="inputHeader" type="xsd:string"/>
+
+ <wsdl:part name="return" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echoStringHeaderAndResultRequest">
+
+ <wsdl:part name="inputHeader" type="xsd:string"/>
+
+ <wsdl:part name="inputString" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderRequest">
+
+ <wsdl:part name="inputHeader" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderResponse">
+
+ <wsdl:part name="inputHeader" type="xsd:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderResponse">
+
+ <wsdl:part name="inputHeader" type="xsd:int"/>
+
+ <wsdl:part name="return" type="xsd:int"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HandlerRpcLitEndpoint">
+
+ <wsdl:operation name="modifyStringHeader" parameterOrder="inputHeader">
+
+ <wsdl:input message="impl:modifyStringHeaderRequest" name="modifyStringHeaderRequest"/>
+
+ <wsdl:output message="impl:modifyStringHeaderResponse" name="modifyStringHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echoStringHeaderAndResult" parameterOrder="inputHeader inputString">
+
+ <wsdl:input message="impl:echoStringHeaderAndResultRequest" name="echoStringHeaderAndResultRequest"/>
+
+ <wsdl:output message="impl:echoStringHeaderAndResultResponse" name="echoStringHeaderAndResultResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings" parameterOrder="header1 header2 setValue">
+
+ <wsdl:input message="impl:setHeaderStringsRequest" name="setHeaderStringsRequest"/>
+
+ <wsdl:output message="impl:setHeaderStringsResponse" name="setHeaderStringsResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader" parameterOrder="inputHeader inputint">
+
+ <wsdl:input message="impl:echointHeaderRequest" name="echointHeaderRequest"/>
+
+ <wsdl:output message="impl:echointHeaderResponse" name="echointHeaderResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="HandlerRpcLitEndpointSoapBinding" type="impl:HandlerRpcLitEndpoint">
+
+ <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="modifyStringHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="modifyStringHeaderRequest">
+
+ <wsdlsoap:body namespace="http://handlers" parts="" use="literal"/>
+
+ <wsdlsoap:header message="impl:modifyStringHeaderRequest" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="modifyStringHeaderResponse">
+
+ <wsdlsoap:body namespace="http://handlers" parts="null" use="literal"/>
+
+ <wsdlsoap:header message="impl:modifyStringHeaderResponse" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echoStringHeaderAndResult">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="echoStringHeaderAndResultRequest">
+
+ <wsdlsoap:body namespace="http://handlers" parts="inputString" use="literal"/>
+
+ <wsdlsoap:header message="impl:echoStringHeaderAndResultRequest" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="echoStringHeaderAndResultResponse">
+
+ <wsdlsoap:body namespace="http://handlers" parts="return" use="literal"/>
+
+ <wsdlsoap:header message="impl:echoStringHeaderAndResultResponse" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="setHeaderStringsRequest">
+
+ <wsdlsoap:body namespace="http://handlers" use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="setHeaderStringsResponse">
+
+ <wsdlsoap:body namespace="http://handlers" parts="null" use="literal"/>
+
+ <wsdlsoap:header message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header1" use="literal">
+
+ </wsdlsoap:header>
+
+ <wsdlsoap:header message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header2" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="echointHeaderRequest">
+
+ <wsdlsoap:body namespace="http://handlers" parts="inputint" use="literal"/>
+
+ <wsdlsoap:header message="impl:echointHeaderRequest" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="echointHeaderResponse">
+
+ <wsdlsoap:body namespace="http://handlers" parts="return" use="literal"/>
+
+ <wsdlsoap:header message="impl:echointHeaderResponse" namespace="http://handlers" part="inputHeader" use="literal">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HandlerRpcLitEndpointService">
+
+ <wsdl:port binding="impl:HandlerRpcLitEndpointSoapBinding" name="HandlerRpcLitEndpoint">
+
+ <wsdlsoap:address location="http://localhost:8080/ServiceControlDRT/handlers/HandlerRpcLitEndpoint.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/HandlerRpcEncEndpoint.wsdl
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/HandlerRpcEncEndpoint.wsdl?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/HandlerRpcEncEndpoint.wsdl (added)
+++ beehive/trunk/system-controls/test/src/webservice/schemas/rpcEncoded/HandlerRpcEncEndpoint.wsdl Sun Aug 7 12:21:27 2005
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://handlers" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://handlers" xmlns:intf="http://handlers" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<!--WSDL created by Apache Axis version: 1.2
+Built on May 03, 2005 (02:20:24 EDT)-->
+
+ <wsdl:message name="setHeaderStringsRequest">
+
+ <wsdl:part name="setValue" type="soapenc:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderRequest">
+
+ <wsdl:part name="inputHeader" type="xsd:int"/>
+
+ <wsdl:part name="inputint" type="xsd:int"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="setHeaderStringsResponse">
+
+ <wsdl:part name="header1" type="soapenc:string"/>
+
+ <wsdl:part name="header2" type="soapenc:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderRequest">
+
+ <wsdl:part name="inputHeader" type="soapenc:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="modifyStringHeaderResponse">
+
+ <wsdl:part name="inputHeader" type="soapenc:string"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="echointHeaderResponse">
+
+ <wsdl:part name="inputHeader" type="xsd:int"/>
+
+ <wsdl:part name="return" type="xsd:int"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HandlerRpcEncEndpoint">
+
+ <wsdl:operation name="modifyStringHeader" parameterOrder="inputHeader">
+
+ <wsdl:input message="impl:modifyStringHeaderRequest" name="modifyStringHeaderRequest"/>
+
+ <wsdl:output message="impl:modifyStringHeaderResponse" name="modifyStringHeaderResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings" parameterOrder="header1 header2 setValue">
+
+ <wsdl:input message="impl:setHeaderStringsRequest" name="setHeaderStringsRequest"/>
+
+ <wsdl:output message="impl:setHeaderStringsResponse" name="setHeaderStringsResponse"/>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader" parameterOrder="inputHeader inputint">
+
+ <wsdl:input message="impl:echointHeaderRequest" name="echointHeaderRequest"/>
+
+ <wsdl:output message="impl:echointHeaderResponse" name="echointHeaderResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="HandlerRpcEncEndpointSoapBinding" type="impl:HandlerRpcEncEndpoint">
+
+ <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="modifyStringHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="modifyStringHeaderRequest">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" parts="" use="encoded"/>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:modifyStringHeaderRequest" namespace="http://handlers" part="inputHeader" use="encoded">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="modifyStringHeaderResponse">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" parts="null" use="encoded"/>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:modifyStringHeaderResponse" namespace="http://handlers" part="inputHeader" use="encoded">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="setHeaderStrings">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="setHeaderStringsRequest">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" use="encoded"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="setHeaderStringsResponse">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" parts="null" use="encoded"/>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header1" use="encoded">
+
+ </wsdlsoap:header>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:setHeaderStringsResponse" namespace="http://handlers" part="header2" use="encoded">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ <wsdl:operation name="echointHeader">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="echointHeaderRequest">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" parts="inputint" use="encoded"/>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:echointHeaderRequest" namespace="http://handlers" part="inputHeader" use="encoded">
+
+ </wsdlsoap:header>
+
+ </wsdl:input>
+
+ <wsdl:output name="echointHeaderResponse">
+
+ <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://handlers" parts="return" use="encoded"/>
+
+ <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" message="impl:echointHeaderResponse" namespace="http://handlers" part="inputHeader" use="encoded">
+
+ </wsdlsoap:header>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="HandlerRpcEncEndpointService">
+
+ <wsdl:port binding="impl:HandlerRpcEncEndpointSoapBinding" name="HandlerRpcEncEndpoint">
+
+ <wsdlsoap:address location="http://localhost:8080/ServiceControlDRT/handlers/HandlerRpcEncEndpoint.jws"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java (added)
+++ beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java Sun Aug 7 12:21:27 2005
@@ -0,0 +1,46 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package handlers;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+
+/**
+ * extremely simple handler web service -- service does not use handler's on the client does.
+ */
+@WebService()
+public class HandlerDocLitEndpoint {
+ static final long serialVersionUID = 1L;
+
+ /* set the value of an INOUT header */
+ public void modifyStringHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) StringHolder inputHeader) {
+ inputHeader.value = "Header Set By Service!";
+ }
+
+ /* set two OUT headers to setValue */
+ public void setHeaderStrings(@WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header1,
+ @WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header2,
+ String setValue) {
+ header1.value = setValue;
+ header2.value = setValue;
+ }
+
+ public int echointHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) IntHolder inputHeader, int inputint) {
+ inputHeader.value = inputint;
+ return inputint;
+ }
+}
Propchange: beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerDocLitEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcEncEndpoint.jws
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcEncEndpoint.jws?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcEncEndpoint.jws (added)
+++ beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcEncEndpoint.jws Sun Aug 7 12:21:27 2005
@@ -0,0 +1,45 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package handlers;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+
+@WebService()
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.ENCODED)
+public class HandlerRpcEncEndpoint {
+ static final long serialVersionUID = 1L;
+
+ /* set the value of an INOUT header */
+ public void modifyStringHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) StringHolder inputHeader) {
+ inputHeader.value = "Header Set By Service!";
+ }
+
+ /* set two OUT headers to setValue */
+ public void setHeaderStrings(@WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header1,
+ @WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header2,
+ String setValue) {
+ header1.value = setValue;
+ header2.value = setValue;
+ }
+
+ public int echointHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) IntHolder inputHeader, int inputint) {
+ inputHeader.value = inputint;
+ return inputint;
+ }
+}
Added: beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcLitEndpoint.jws
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcLitEndpoint.jws?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcLitEndpoint.jws (added)
+++ beehive/trunk/system-controls/test/src/webservice/servers/webapp/WEB-INF/webservices/handlers/HandlerRpcLitEndpoint.jws Sun Aug 7 12:21:27 2005
@@ -0,0 +1,52 @@
+/* Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package handlers;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+
+@WebService()
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
+public class HandlerRpcLitEndpoint {
+
+ static final long serialVersionUID = 1L;
+
+ /* set the value of an INOUT header */
+ public void modifyStringHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) StringHolder inputHeader) {
+ inputHeader.value = "Header Set By Service!";
+ }
+
+ /* echo a string, set the the value of an INOUT header */
+ public String echoStringHeaderAndResult(@WebParam(header = true, mode = WebParam.Mode.INOUT) StringHolder inputHeader, String inputString) {
+ inputHeader.value = "Header Set By Service!";
+ return inputString;
+ }
+
+ /* set two OUT headers to setValue */
+ public void setHeaderStrings(@WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header1,
+ @WebParam(header = true, mode = WebParam.Mode.OUT) StringHolder header2,
+ String setValue) {
+ header1.value = setValue;
+ header2.value = setValue;
+ }
+
+ public int echointHeader(@WebParam(header = true, mode = WebParam.Mode.INOUT) IntHolder inputHeader, int inputint) {
+ inputHeader.value = inputint;
+ return inputint;
+ }
+}
Added: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java (added)
+++ beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java Sun Aug 7 12:21:27 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.units;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.system.webservice.units.utils.ControlTestCase;
+import org.apache.beehive.wsm.databinding.GenericHolder;
+import org.apache.log4j.Logger;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import test.HandlerDocLitEndpointService;
+
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+
+public class HandlerDocLitEndpointTest
+ extends ControlTestCase {
+
+ private static Log LOGGER = LogFactory.getLog(HandlerDocLitEndpointTest.class);
+
+ @Control
+ public HandlerDocLitEndpointService client;
+
+ public void testModifyStringHeader() throws Exception {
+
+ StringHolder sh = new StringHolder("foo");
+ client.modifyStringHeader(sh);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(1, handlerHeaders.length);
+ assertEquals("Header Set By Service!", nodeValue);
+
+ }
+
+ public void testSetHeaderStrings() throws Exception {
+ String headerValue = "foo/bar";
+ StringHolder h1 = new StringHolder("empty");
+ StringHolder h2 = new StringHolder("empty");
+
+ client.setHeaderStrings(headerValue, h1, h2);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ assertEquals(2, handlerHeaders.length);
+
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+
+ nl = handlerHeaders[1].getChildNodes();
+ n = nl.item(0);
+ nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+ }
+
+ public void testEchointInHeader() throws Exception {
+ final int value = 1234;
+ IntHolder ih = new IntHolder(-1);
+ client.echointHeader(ih, value);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ assertEquals(1, handlerHeaders.length);
+
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(Integer.toString(value), nodeValue);
+ }
+
+ public void setUp() throws Exception {
+ try {
+ super.setUp();
+ initializeControls(this);
+ setMyControlObject(client);
+
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ public static Test suite() {
+ return new TestSuite(HandlerDocLitEndpointTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
\ No newline at end of file
Propchange: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerDocLitEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java (added)
+++ beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java Sun Aug 7 12:21:27 2005
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.units;
+
+import javax.xml.rpc.holders.StringHolder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.system.webservice.units.utils.ControlTestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+
+import test.HandlerRpcEncEndpointService;
+
+public class HandlerRpcEncEndpointTest
+ extends ControlTestCase {
+
+ private static Log LOGGER = LogFactory.getLog(HandlerRpcEncEndpointTest.class);
+
+ @Control
+ public HandlerRpcEncEndpointService client;
+
+ public void testModifyStringHeader() throws Exception {
+
+ StringHolder sh = new StringHolder("foo");
+ client.modifyStringHeader(sh);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(1, handlerHeaders.length);
+ assertEquals("Header Set By Service!", nodeValue);
+
+ }
+
+ public void testSetHeaderStrings() throws Exception {
+ String headerValue = "foo/bar";
+ StringHolder h1 = new StringHolder("empty");
+ StringHolder h2 = new StringHolder("empty");
+
+ client.setHeaderStrings(headerValue, h1, h2);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ assertEquals(2, handlerHeaders.length);
+
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+
+ nl = handlerHeaders[1].getChildNodes();
+ n = nl.item(0);
+ nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+ }
+
+// TODO: Fails - due to axis 1.2 bug -- need to verify
+// public void testEchointInHeader() throws Exception {
+// final int value = 1234;
+// IntHolder ih = new IntHolder(-1);
+// client.echointHeader(ih, value);
+//
+// Element[] handlerHeaders = client.getInputHeaders();
+// assertEquals(1, handlerHeaders.length);
+//
+// NodeList nl = handlerHeaders[0].getChildNodes();
+// Node n = nl.item(0);
+// String nodeValue = n.getNodeValue();
+// assertEquals(Integer.toString(value), nodeValue);
+// }
+
+ public void setUp() throws Exception {
+ try {
+ super.setUp();
+ initializeControls(this);
+ setMyControlObject(client);
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ public static Test suite() {
+ return new TestSuite(HandlerRpcEncEndpointTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
\ No newline at end of file
Propchange: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcEncEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java?rev=230690&view=auto
==============================================================================
--- beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java (added)
+++ beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java Sun Aug 7 12:21:27 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.controls.system.webservice.units;
+
+import javax.xml.rpc.holders.IntHolder;
+import javax.xml.rpc.holders.StringHolder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.beehive.controls.api.bean.Control;
+import org.apache.beehive.controls.system.webservice.units.utils.ControlTestCase;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.Log;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+
+import test.HandlerRpcLitEndpointService;
+
+public class HandlerRpcLitEndpointTest
+ extends ControlTestCase {
+
+ private static Log LOGGER = LogFactory.getLog(HandlerRpcLitEndpointTest.class);
+
+ @Control
+ public HandlerRpcLitEndpointService client;
+
+ public void testModifyStringHeader() throws Exception {
+
+ StringHolder sh = new StringHolder("foo");
+ client.modifyStringHeader(sh);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(1, handlerHeaders.length);
+ assertEquals("Header Set By Service!", nodeValue);
+
+ }
+
+ public void testSetHeaderStrings() throws Exception {
+ String headerValue = "foo/bar";
+ StringHolder h1 = new StringHolder("empty");
+ StringHolder h2 = new StringHolder("empty");
+
+ client.setHeaderStrings(headerValue, h1, h2);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ assertEquals(2, handlerHeaders.length);
+
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+
+ nl = handlerHeaders[1].getChildNodes();
+ n = nl.item(0);
+ nodeValue = n.getNodeValue();
+ assertEquals(headerValue, nodeValue);
+ }
+
+ public void testEchointInHeader() throws Exception {
+ final int value = 1234;
+ IntHolder ih = new IntHolder(-1);
+ client.echointHeader(ih, value);
+
+ Element[] handlerHeaders = client.getInputHeaders();
+ assertEquals(1, handlerHeaders.length);
+
+ NodeList nl = handlerHeaders[0].getChildNodes();
+ Node n = nl.item(0);
+ String nodeValue = n.getNodeValue();
+ assertEquals(Integer.toString(value), nodeValue);
+ }
+
+ public void setUp() throws Exception {
+ try {
+ super.setUp();
+ initializeControls(this);
+ setMyControlObject(client);
+
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
+ public static Test suite() {
+ return new TestSuite(HandlerRpcLitEndpointTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+}
\ No newline at end of file
Propchange: beehive/trunk/system-controls/test/src/webservice/tests/org/apache/beehive/controls/system/webservice/units/HandlerRpcLitEndpointTest.java
------------------------------------------------------------------------------
svn:eol-style = native