You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ri...@apache.org on 2006/03/02 05:25:34 UTC

svn commit: r382293 [2/3] - in /incubator/tuscany/java/sca/binding.axis2: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/binding/ src/main/java/org/apache...

Added: incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceEntryPointServlet.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceEntryPointServlet.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceEntryPointServlet.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceEntryPointServlet.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,401 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.tuscany.binding.axis2.handler;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.transport.http.HTTPTransportUtils;
+import org.apache.axis2.transport.http.ListingAgent;
+import org.apache.axis2.transport.http.ServletBasedOutTransportInfo;
+import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
+import org.apache.tuscany.core.context.AggregateContext;
+import org.apache.tuscany.core.context.EntryPointContext;
+import org.apache.tuscany.core.context.webapp.TuscanyWebAppRuntime;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+
+/**
+ * Class AxisServlet
+ */
+public class WebServiceEntryPointServlet extends HttpServlet  {
+
+
+    private static final long serialVersionUID = -2085869393709833372L;
+    private static final String CONFIGURATION_CONTEXT = "CONFIGURATION_CONTEXT";
+    public static final String SESSION_ID = "SessionId";
+    private ConfigurationContext configContext;
+    private AxisConfiguration axisConfiguration;
+    private ListingAgent lister;
+
+    private MessageContext createAndSetInitialParamsToMsgCtxt(Object sessionContext,
+                                                              MessageContext msgContext, HttpServletResponse httpServletResponse,
+                                                              HttpServletRequest httpServletRequest)
+            throws AxisFault {
+        msgContext = new MessageContext();
+        msgContext.setConfigurationContext(configContext);
+        msgContext.setSessionContext((SessionContext) sessionContext);
+        msgContext.setTransportIn(axisConfiguration.getTransportIn(new QName(Constants
+                .TRANSPORT_HTTP)));
+        msgContext.setTransportOut(axisConfiguration.getTransportOut(new QName(Constants.TRANSPORT_HTTP)));
+
+        msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
+                new ServletBasedOutTransportInfo(httpServletResponse));
+        msgContext.setProperty(MessageContext.TRANSPORT_HEADERS,
+                getTransportHeaders(httpServletRequest));
+        msgContext.setProperty(SESSION_ID, httpServletRequest.getSession().getId());
+
+        return msgContext;
+    }
+
+    public void destroy() {
+        super.destroy();
+    }
+
+    /**
+     * Method doGet
+     *
+     * @param httpServletRequest
+     * @param httpServletResponse
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void doGet(HttpServletRequest httpServletRequest,
+                         HttpServletResponse httpServletResponse)
+            throws ServletException, IOException {
+        MessageContext msgContext = null;
+        OutputStream out = null;
+
+        try {
+            Object sessionContext = getSessionContext(httpServletRequest);
+            HashMap map = getHTTPParameters(httpServletRequest);
+
+            msgContext = createAndSetInitialParamsToMsgCtxt(sessionContext, msgContext,
+                    httpServletResponse, httpServletRequest);
+            msgContext.setDoingREST(true);
+            msgContext.setServerSide(true);
+            out = httpServletResponse.getOutputStream();
+
+            boolean processed = HTTPTransportUtils.processHTTPGetRequest(msgContext,
+                    httpServletRequest.getInputStream(), out,
+                    httpServletRequest.getContentType(),
+                    httpServletRequest.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    httpServletRequest.getRequestURL().toString(), configContext,
+                    map);
+
+            if (!processed) {
+                lister.handle(httpServletRequest, httpServletResponse, out);
+            }
+        } catch (AxisFault e) {
+            if (msgContext != null) {
+                handleFault(msgContext, out, e);
+            } else {
+                throw new ServletException(e);
+            }
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+
+    /**
+     * Method doPost
+     *
+     * @param req
+     * @param res
+     * @throws ServletException
+     * @throws IOException
+     */
+    protected void doPost(HttpServletRequest req, HttpServletResponse res)
+            throws ServletException, IOException {
+        MessageContext msgContext = null;
+        OutputStream out = null;
+
+        try {
+            Object sessionContext = getSessionContext(req);
+
+            msgContext = createAndSetInitialParamsToMsgCtxt(sessionContext, msgContext, res, req);
+
+            // adding ServletContext into msgContext;
+            msgContext.setProperty(Constants.SERVLET_CONTEXT, sessionContext);
+            out = res.getOutputStream();
+            HTTPTransportUtils.processHTTPPostRequest(msgContext, req.getInputStream(), out,
+                    req.getContentType(), req.getHeader(HTTPConstants.HEADER_SOAP_ACTION),
+                    req.getRequestURL().toString());
+
+            Object contextWritten =
+                    msgContext.getOperationContext().getProperty(Constants.RESPONSE_WRITTEN);
+
+            res.setContentType("text/xml; charset="
+                    + msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING));
+
+            if ((contextWritten == null) || !Constants.VALUE_TRUE.equals(contextWritten)) {
+                res.setStatus(HttpServletResponse.SC_ACCEPTED);
+            }
+        } catch (AxisFault e) {
+            if (msgContext != null) {
+                res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+                handleFault(msgContext, out, e);
+            } else {
+                throw new ServletException(e);
+            }
+        }
+    }
+
+    private void handleFault(MessageContext msgContext, OutputStream out, AxisFault e)
+            throws AxisFault {
+        msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
+
+        AxisEngine engine = new AxisEngine(configContext);
+        MessageContext faultContext = engine.createFaultMessageContext(msgContext, e);
+
+        engine.sendFault(faultContext);
+    }
+
+    /**
+     * Method init
+     *
+     * @param config
+     * @throws ServletException
+     */
+    public void init(ServletConfig config) throws ServletException {
+        try {
+            configContext = initConfigContext(config);
+            initTuscany(configContext.getAxisConfiguration(),config);
+            lister = new ListingAgent(configContext);
+            axisConfiguration = configContext.getAxisConfiguration();
+            config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new ServletException(e);
+        }
+    }
+   
+
+    RuntimeContext getTuscanyWebAppRuntime(ServletConfig config) {
+
+        Object ret = (RuntimeContext) (config).getServletContext().getAttribute("org.apache.tuscany.core.runtime.RuntimeContext");
+        if (!( ret instanceof RuntimeContext)) {
+            RuntimeException rete= new RuntimeException("Tuscany configuration not found! " + ((ret == null) ? "" : "unexpected class" + ret.getClass()));
+            rete.printStackTrace();//pretty majar make sure something gets logged.
+            throw rete;
+
+        }
+        return (RuntimeContext)ret;
+    }
+    
+    
+    
+    void initTuscany(final AxisConfiguration axisConfig, ServletConfig config) throws AxisFault{
+        
+
+        // Register all the Web service entry points
+        RuntimeContext tuscanyRuntime = getTuscanyWebAppRuntime(config);
+        
+        // Get the current SCA module context
+        AggregateContext moduleContext = tuscanyRuntime.getRootContext();//.getModuleComponentContext();
+        try {
+            tuscanyRuntime.start();
+            Module module = (Module) moduleContext.getAggregate();
+//           AssemblyModelContext modelContext = module.getAssemblyModelContext();
+            
+
+            for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
+                EntryPoint entryPoint = (EntryPoint) i.next();
+                final String epName = entryPoint.getName();
+                Binding binding = (Binding) entryPoint.getBindings().get(0);
+                if (binding instanceof WebServiceBinding) {
+
+                    WebServiceBinding wsBinding = (WebServiceBinding) binding;
+                    Definition definition = wsBinding.getWSDLDefinition();
+                    Port port = wsBinding.getWSDLPort();
+                    QName qname = new QName(definition.getTargetNamespace(), port.getName());
+                    if (qname != null) {
+                        
+                        WebServiceEntryPointInOutSyncMessageReceiver msgrec = new WebServiceEntryPointInOutSyncMessageReceiver(moduleContext,
+                                entryPoint, (EntryPointContext)moduleContext.getContext(epName));
+                        WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(definition, port, null, false);
+
+                        AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
+                        axisConfig.addMessageReceiver(WebServiceEntryPointInOutSyncMessageReceiver.MEP_URL, msgrec);
+                        serviceGroup.setServiceGroupName(wsdlPortInfo.getServiceName().getLocalPart());
+
+                        // to create service from wsdl stream --->
+                        // AxisServiceBuilder axisServiceBuilder = new AxisServiceBuilder();
+                        // return axisServiceBuilder.getAxisService(in);
+
+ 
+                        
+                        AxisService axisService = new AxisService(epName);
+                        axisService.setParent(serviceGroup);
+                        axisService.setServiceDescription("Tuscany configured service EntryPoint name '" + epName + "'");
+                        // axisService.setTargetNamespace(wsdlPortInfo.getPortName().getNamespaceURI());
+                        axisService.addMessageReceiver(WebServiceEntryPointInOutSyncMessageReceiver.MEP_URL, msgrec);
+
+ 
+
+                        // Create operation descriptions for all the operations
+                        PortType wsdlPortType = wsdlPortInfo.getPortType();
+                        for (Iterator j = wsdlPortType.getOperations().iterator(); j.hasNext();) {
+                            Operation wsdlOperation = (Operation) j.next();
+                            String operationName = wsdlOperation.getName();
+                            AxisOperation axisOp = new InOutAxisOperation(new javax.xml.namespace.QName(qname.getNamespaceURI(), operationName));
+                            axisOp.setMessageReceiver(msgrec);
+                            axisService.addOperation(axisOp);
+                            axisOp.setMessageExchangePattern(WebServiceEntryPointInOutSyncMessageReceiver.MEP_URL);
+
+                            axisConfig.addService(axisService);
+ 
+                        }
+                        axisConfig.addServiceGroup(serviceGroup);
+
+                    }
+
+                }
+            }
+        } finally{
+            tuscanyRuntime.stop();
+        }
+    }
+
+
+    /**
+     * Initialize the Axis configuration context
+     *
+     * @param config Servlet configuration
+     * @throws ServletException
+     */
+    protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException {
+        try {
+            ServletContext context = config.getServletContext();
+            String repoDir = context.getRealPath("/WEB-INF");
+            ConfigurationContextFactory erfac = new ConfigurationContextFactory();
+            ConfigurationContext configContext = erfac.createConfigurationContextFromFileSystem(repoDir);
+            configContext.setProperty(Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE);
+            configContext.setRootDir(new File(context.getRealPath("/WEB-INF")));
+            return configContext;
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+    }
+
+    private HashMap getHTTPParameters(HttpServletRequest httpServletRequest) {
+        HashMap map = new HashMap();
+        Enumeration enu = httpServletRequest.getParameterNames();
+
+        while (enu.hasMoreElements()) {
+            String name = (String) enu.nextElement();
+            String value = httpServletRequest.getParameter(name);
+
+            map.put(name, value);
+        }
+
+        return map;
+    }
+
+    private Object getSessionContext(HttpServletRequest httpServletRequest) {
+        Object sessionContext =
+                httpServletRequest.getSession(true).getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
+
+        if (sessionContext == null) {
+            sessionContext = new SessionContext(null);
+            httpServletRequest.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
+                    sessionContext);
+        }
+
+        return sessionContext;
+    }
+
+    private Map getTransportHeaders(HttpServletRequest req) {
+        HashMap headerMap = new HashMap();
+        Enumeration headerNames = req.getHeaderNames();
+
+        while (headerNames.hasMoreElements()) {
+            String key = (String) headerNames.nextElement();
+            String value = req.getHeader(key);
+
+            headerMap.put(key, value);
+        }
+
+        return headerMap;
+    }
+    //RRFOO
+    //TODO get axis2.xml in
+    /*
+     * 
+            // Get the current SCA module context
+        AggregateContext moduleContext = tuscanyRuntime.getModuleComponentContext();
+        tuscanyRuntime.start();
+        try {
+
+            Module module = (Module)moduleContext.getAggregate();
+            AssemblyModelContext modelContext = module.getAssemblyModelContext();
+
+            // Load the .wsdd configuration
+            ResourceLoader bundleContext = modelContext.getResourceLoader();
+            InputStream wsdd;
+            try {
+                URL url = bundleContext.getResource("org/apache/tuscany/binding/axis/engine/config/server-config.wsdd");
+                wsdd = url.openStream();
+            } catch (IOException e1) {
+                throw new ServiceRuntimeException(e1);
+            }
+
+     * 
+     */
+}
+

Added: incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceOperationMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceOperationMetaData.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceOperationMetaData.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServiceOperationMetaData.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,484 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+/**
+ * Metadata for a WSDL operation
+ *
+ */
+public class WebServiceOperationMetaData {
+    // WSDL Binding and BindingOperation
+    private Binding binding;
+    private BindingOperation bindingOperation;
+
+    // Fields to cache derived metadata
+    private transient Set inputHeaderParts;
+    private transient Set outputHeaderParts;
+    private transient String style;
+    private transient String use;
+    private transient String soapAction;
+    private transient List signature;
+    private String encoding;
+    private transient QName rpcOperationName;
+
+    public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation) {
+        this.binding = binding;
+        this.bindingOperation = bindingOperation;
+    }
+
+    public WebServiceOperationMetaData(Binding binding, BindingOperation bindingOperation, String style, String use, String encoding, String soapAction) {
+        this.binding = binding;
+        this.bindingOperation = bindingOperation;
+        this.style = style;
+        this.use = use;
+        this.encoding = encoding;
+        this.soapAction = soapAction;
+    }
+
+    public Set getInputHeaderParts() {
+        if (inputHeaderParts == null) {
+            // Build a set of header parts that we need to exclude
+            inputHeaderParts = new HashSet();
+            BindingInput bindingInput = bindingOperation.getBindingInput();
+
+            if (bindingInput != null) {
+                Operation operation = bindingOperation.getOperation();
+                javax.wsdl.Message message = operation.getInput().getMessage();
+                List elements = bindingInput.getExtensibilityElements();
+                for (Iterator i = elements.iterator(); i.hasNext();) {
+                    Object extensibilityElement = i.next();
+                    Part part = getPartFromSOAPHeader(message, extensibilityElement);
+                    if (part != null) {
+                        inputHeaderParts.add(part);
+                    }
+                }
+            }
+        }
+        return inputHeaderParts;
+    }
+
+    public Set getOutputHeaderParts() {
+        if (outputHeaderParts == null) {
+            // Build a set of header parts that we need to exclude
+            outputHeaderParts = new HashSet();
+            BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+            if (bindingOutput != null) {
+                Operation operation = bindingOperation.getOperation();
+                javax.wsdl.Message message = operation.getOutput().getMessage();
+                List elements = bindingOutput.getExtensibilityElements();
+                for (Iterator i = elements.iterator(); i.hasNext();) {
+                    Object extensibilityElement = i.next();
+                    Part part = getPartFromSOAPHeader(message, extensibilityElement);
+                    if (part != null) {
+                        outputHeaderParts.add(part);
+                    }
+                }
+            }
+        }
+        return outputHeaderParts;
+    }
+
+    private Part getPartFromSOAPHeader(Message message, Object extensibilityElement) {
+        Part part = null;
+        if (extensibilityElement instanceof SOAPHeader) {
+            SOAPHeader soapHeader = (SOAPHeader) extensibilityElement;
+            QName msgName = soapHeader.getMessage();
+            if (message.getQName().equals(msgName)) {
+                part = message.getPart(soapHeader.getPart());
+            }
+        } else if (extensibilityElement instanceof SOAPHeader) {
+            SOAPHeader soapHeader = (SOAPHeader) extensibilityElement;
+            QName msgName = soapHeader.getMessage();
+            if (message.getQName().equals(msgName)) {
+                part = message.getPart(soapHeader.getPart());
+            }
+        }
+        return part;
+    }
+
+    public String getStyle() {
+        if (style == null) {
+            SOAPOperation soapOperation = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(bindingOperation.getExtensibilityElements(), SOAPOperation.class);
+            if (soapOperation != null)
+                style = soapOperation.getStyle();
+            if (style == null) {
+                SOAPBinding soapBinding = (SOAPBinding) WebServicePortMetaData.getExtensibilityElement(binding.getExtensibilityElements(), SOAPBinding.class);
+                if (soapBinding != null)
+                    style = soapBinding.getStyle();
+            }
+            if (style == null)
+                style = "document";
+        }
+        return style;
+    }
+
+    /**
+     * Returns the SOAP action for the given operation.
+     *
+     * @param wsdlBindingOperation
+     * @return
+     */
+    public String getSOAPAction() {
+        if (soapAction == null) {
+            final List wsdlBindingOperationExtensions = bindingOperation.getExtensibilityElements();
+            final SOAPOperation soapOp = (SOAPOperation) WebServicePortMetaData.getExtensibilityElement(wsdlBindingOperationExtensions, SOAPOperation.class);
+            if (soapOp != null)
+                soapAction = soapOp.getSoapActionURI();
+        }
+        return soapAction;
+    }
+
+    public QName getRPCOperationName() {
+        if (rpcOperationName == null) {
+            javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+            String ns = (soapBody != null) ? soapBody.getNamespaceURI() : binding.getPortType().getQName().getNamespaceURI();
+            String name = bindingOperation.getOperation().getName();
+            rpcOperationName = new QName(ns, name);
+        }
+        return rpcOperationName;
+    }
+
+    private List getSOAPBodyParts(boolean input) {
+        javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(input);
+        if (soapBody != null) {
+            List parts = soapBody.getParts();
+            if (parts!=null) {
+                List names = new ArrayList();
+                for (Iterator i = parts.iterator(); i.hasNext();) {
+                    Object part = i.next();
+                    if (part instanceof String)
+                        names.add(part);
+                    else if (part instanceof Part) {
+                        names.add(((Part) part).getName());
+                    }
+                }
+                return names;
+            } else
+                return null;
+        } else
+            return null;
+    }
+
+    private javax.wsdl.extensions.soap.SOAPBody getSOAPBody(boolean input) {
+        List elements = null;
+        if (input) {
+            BindingInput bindingInput = bindingOperation.getBindingInput();
+            if (bindingInput == null)
+                return null;
+            elements = bindingInput.getExtensibilityElements();
+        } else {
+            BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+            if (bindingOutput == null)
+                return null;
+            elements = bindingOutput.getExtensibilityElements();
+        }
+        javax.wsdl.extensions.soap.SOAPBody soapBody = (javax.wsdl.extensions.soap.SOAPBody) WebServicePortMetaData.getExtensibilityElement(elements,
+                javax.wsdl.extensions.soap.SOAPBody.class);
+        return soapBody;
+    }
+
+    /**
+     * Returns the use attribute
+     *
+     * @param wsdlOperation
+     * @return
+     */
+    public String getUse() {
+        if (use == null) {
+            javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+            if (soapBody != null) {
+                use = soapBody.getUse();
+            }
+            if (use == null)
+                use = "literal";
+        }
+        return use;
+    }
+
+    public String getEncoding() {
+        if (encoding == null) {
+            javax.wsdl.extensions.soap.SOAPBody soapBody = getSOAPBody(true);
+            if (soapBody != null) {
+                List<String> styles=(List<String>)soapBody.getEncodingStyles();
+                if (styles!=null && !styles.isEmpty())
+                    encoding = styles.get(0);
+            }
+            if (encoding == null)
+                encoding = "";
+        }
+        return encoding;
+    }
+    
+    public boolean isDocLitWrapped() {
+        boolean flag = getStyle().equals("document") && getUse().equals("literal");
+        if (!flag)
+            return false;
+        Message msg = getMessage(true);
+        if (msg == null)
+            return false;
+        List parts = msg.getOrderedParts(null);
+        if (parts.size() != 1)
+            return false;
+        Part part = (Part) parts.get(0);
+        QName element = part.getElementName();
+        if (element == null)
+            return false;
+        return element.getLocalPart().equals(bindingOperation.getOperation().getName());
+    }
+
+    /*
+      public SOAPMediator createMediator(boolean serverMode)
+      throws SOAPException {
+      // create a new mediator for each invoke for thread-safety
+      boolean rpcStyle = getStyle().equals("rpc");
+      boolean rpcEncoded = isEncoded();
+
+      SOAPMediator mediator = null;
+
+      if (!rpcStyle) {
+      // Document
+      mediator = new SOAPDocumentLiteralMediatorImpl(this, serverMode);
+      } else {
+      if (!rpcEncoded)
+      mediator = new SOAPRPCLiteralMediatorImpl(this, serverMode); // RPC-literal
+      else
+      mediator = new SOAPRPCEncodedMediatorImpl(this, serverMode); // RPC-encoded
+      }
+      return mediator;
+      }
+      */
+
+    /**
+     * Get the operation signature from the WSDL operation
+     *
+     * @param wsdlBinding
+     * @param bindingOperation
+     * @return
+     */
+    public List getOperationSignature() {
+        if (signature == null) {
+            signature = new ArrayList();
+
+            Operation operation = bindingOperation.getOperation();
+            if (operation == null)
+                return signature;
+
+            final Input input = operation.getInput();
+            if (input == null) {
+                return signature;
+            }
+
+            String style = getStyle();
+
+            if (style.equals("rpc")) {
+                Collection partNames = input.getMessage().getParts().values();
+                for (Iterator i = partNames.iterator(); i.hasNext();) {
+                    Part part = (Part) i.next();
+                    signature.add(part.getName());
+                }
+            } else {
+                /*
+                     * WS-I Basic Profile 1.1 4.7.6 Operation Signatures
+                     * Definition: operation signature
+                     *
+                     * The profile defines the "operation signature" to be the
+                     * fully qualified name of the child element of SOAP body of
+                     * the SOAP input message described by an operation in a
+                     * WSDL binding.
+                     *
+                     * In the case of rpc-literal binding, the operation name is
+                     * used as a wrapper for the part accessors. In the
+                     * document-literal case, since a wrapper with the operation
+                     * name is not present, the message signatures must be
+                     * correctly designed so that they meet this requirement.
+                     *
+                     * An endpoint that supports multiple operations must
+                     * unambiguously identify the operation being invoked based
+                     * on the input message that it receives. This is only
+                     * possible if all the operations specified in the
+                     * wsdl:binding associated with an endpoint have a unique
+                     * operation signature.
+                     *
+                     * R2710 The operations in a wsdl:binding in a DESCRIPTION
+                     * MUST result in operation signatures that are different
+                     * from one another.
+                     */
+                List bodyParts = getSOAPBodyParts(true);
+
+                Collection parts = input.getMessage().getParts().values();
+                // Exclude the parts to be transmitted in SOAP header
+                if (bodyParts == null)
+                    parts.removeAll(getInputHeaderParts());
+                for (Iterator i = parts.iterator(); i.hasNext();) {
+                    Part part = (Part) i.next();
+                    if (bodyParts == null) {
+                        // All parts
+                        QName elementName = part.getElementName();
+                        if (elementName == null) {
+                            elementName = new QName("", part.getName());
+                            // TODO: [rfeng] throw new
+                            // ServiceRuntimeException("Message part for
+                            // document style must refer to an XSD element
+                            // using a QName: " + part);
+                        }
+                        signature.add(elementName);
+                    } else {
+                        // "parts" in soap:body
+                        if (bodyParts.contains(part.getName())) {
+                            QName elementName = part.getElementName();
+                            if (elementName == null) {
+                                elementName = new QName("", part.getName());
+                                // TODO: [rfeng] throw new
+                                // ServiceRuntimeException("Message part for
+                                // document style must refer to an XSD
+                                // element using a QName: " + part);
+                            }
+                            signature.add(elementName);
+                        }
+
+                    }
+                }
+            }
+        }
+        return signature;
+    }
+
+    public Message getMessage(boolean isInput) {
+        Operation operation = bindingOperation.getOperation();
+        if (operation == null)
+            return null;
+
+        if (isInput) {
+            final Input input = operation.getInput();
+            return input == null ? null : input.getMessage();
+        } else {
+            final Output output = operation.getOutput();
+            return output == null ? null : output.getMessage();
+        }
+    }
+
+    public Part getInputPart(int index) {
+        Part part = null;
+        Message message = getMessage(true);
+        if (message == null)
+            return part;
+
+        List parts = message.getOrderedParts(null);
+        return (Part) parts.get(index);
+
+    }
+
+    public Part getOutputPart(int index) {
+        Part part = null;
+        Message message = getMessage(false);
+        if (message == null)
+            return part;
+
+        List parts = message.getOrderedParts(null);
+        return (Part) parts.get(index);
+
+    }
+
+    /**
+     * Get a list of indexes for each part in the SOAP body
+     *
+     * @param isInput TODO
+     * @return
+     */
+    public List getBodyPartIndexes(boolean isInput) {
+        List indexes = new ArrayList();
+
+        Message message = getMessage(isInput);
+        if (message == null)
+            return indexes;
+
+        List bodyParts = getSOAPBodyParts(isInput);
+        List parts = message.getOrderedParts(null);
+        Set headerParts = (isInput) ? getInputHeaderParts() : getOutputHeaderParts();
+
+        int index = 0;
+        for (Iterator i = parts.iterator(); i.hasNext(); index++) {
+            Part part = (Part) i.next();
+            if (headerParts.contains(part))
+                continue;
+            if (bodyParts == null) {
+                // All parts
+                indexes.add(new Integer(index));
+            } else {
+                // "parts" in soap:body
+                if (bodyParts.contains(part.getName()))
+                    indexes.add(new Integer(index));
+
+            }
+        }
+        return indexes;
+    }
+
+    /**
+     * Get the corresponding index for a part in the SOAP header by element
+     * name
+     *
+     * @param elementName
+     * @param isInput     TODO
+     * @return
+     */
+    public int getHeaderPartIndex(QName elementName, boolean isInput) {
+
+        Message message = getMessage(isInput);
+        if (message == null)
+            return -1;
+
+        List parts = message.getOrderedParts(null);
+        Set headerParts = isInput ? getInputHeaderParts() : getOutputHeaderParts();
+
+        int index = 0;
+        for (Iterator i = parts.iterator(); i.hasNext(); index++) {
+            Part part = (Part) i.next();
+            // Test if the part is in header section
+            if (headerParts.contains(part) && elementName.equals(part.getElementName())) {
+                return index;
+            }
+        }
+        return -1;
+    }
+
+    public BindingOperation getBindingOperation() {
+        return bindingOperation;
+	}
+
+}
\ No newline at end of file

Added: incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServicePortMetaData.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServicePortMetaData.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServicePortMetaData.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/handler/WebServicePortMetaData.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,362 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.handler;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.xml.namespace.QName;
+//import javax.xml.soap.Name;
+//import javax.xml.soap.SOAPBodyElement;
+//import javax.xml.soap.SOAPElement;
+
+import org.apache.tuscany.model.types.wsdl.WSDLServiceContract;
+
+/**
+ * Metadata for a WSDL port
+ *
+ */
+public class WebServicePortMetaData {
+    
+    private final static String SOAP_ENCODING_URI = "http://schemas.xmlsoap.org/wsdl/soap/";
+    
+    private Service wsdlService;
+    private QName wsdlServiceName;
+    private Port wsdlPort;
+    private Binding wsdlBinding;
+    private QName wsdlPortName;
+    private PortType wsdlPortType;
+    private QName wsdlPortTypeName;
+    private String endpoint;
+    private boolean managed;
+    private List allOperationMetaData;
+    private WSDLServiceContract interfaceType;
+
+    /**
+     * Constructor
+     *
+     * @param wsdlDefinition
+     * @param portName
+     */
+    public WebServicePortMetaData(Definition wsdlDefinition, Port wsdlPort, String endpoint, boolean managed) {
+
+        // Lookup the named port
+        this.wsdlPort=wsdlPort;
+        wsdlPortName = new QName(wsdlDefinition.getTargetNamespace(), wsdlPort.getName());
+        
+        Collection<Service> services=(Collection<Service>)wsdlDefinition.getServices().values();
+        for (Service service : services) {
+            if (service.getPorts().containsValue(wsdlPort)) {
+                wsdlService = service;
+                wsdlServiceName = service.getQName();
+                break;
+            }
+        }
+
+        // Save the binding
+        wsdlBinding = wsdlPort.getBinding();
+        if (wsdlBinding == null) {
+            throw new IllegalArgumentException("WSDL binding cannot be found for " + wsdlPortName);
+        }
+
+        // Save the portType
+        wsdlPortType = wsdlBinding.getPortType();
+        if (wsdlPortType == null) {
+            throw new IllegalArgumentException("WSDL portType cannot be found for " + wsdlPortName);
+        }
+        wsdlPortTypeName = wsdlPortType.getQName();
+
+        // Save the endpoint
+        this.endpoint = endpoint;
+
+        // Track if this endpoint is managed or not
+        this.managed = managed;
+    }
+
+    /**
+     * Constructor
+     *
+     * @param serviceName
+     * @param portName
+     * @param portType
+     */
+    public WebServicePortMetaData(QName serviceName, String portName, QName portTypeName, String endpoint) {
+        wsdlServiceName = serviceName;
+        wsdlPortName = new QName(serviceName.getNamespaceURI(), portName);
+        wsdlPortTypeName = portTypeName;
+        this.endpoint = endpoint;
+    }
+
+    /**
+     * @return Returns the wsdlPort.
+     */
+    public javax.wsdl.Port getPort() {
+        return wsdlPort;
+    }
+
+    /**
+     * @return Returns the wsdlService.
+     */
+    public QName getServiceName() {
+        return wsdlServiceName;
+    }
+
+    /**
+     * @return Returns the wsdlService.
+     */
+    public javax.wsdl.Service getService() {
+        return wsdlService;
+    }
+
+    /**
+     * @return Returns the wsdlPortType.
+     */
+    public PortType getPortType() {
+        return wsdlPortType;
+    }
+
+    /**
+     * @return Returns the wsdlPortType.
+     */
+    public QName getPortTypeName() {
+        return wsdlPortTypeName;
+    }
+
+    /**
+     * @return Returns the wsdlBinding.
+     */
+    public Binding getBinding() {
+        return wsdlBinding;
+    }
+
+    /**
+     * @return Returns the wsdlPortName.
+     */
+    public QName getPortName() {
+        return wsdlPortName;
+    }
+
+    /**
+     * Returns the endpoint of a given port.
+     *
+     * @param wsdlPort
+     * @return
+     */
+    public String getEndpoint() {
+
+        // Return the specified endpoint
+        if (endpoint != null)
+            return endpoint;
+
+        // Find the target endpoint on the port
+        if (wsdlPort != null) {
+            final List wsdlPortExtensions = wsdlPort.getExtensibilityElements();
+            for (Iterator i = wsdlPortExtensions.iterator(); i.hasNext();) {
+                final Object extension = i.next();
+                if (extension instanceof SOAPAddress) {
+                    final SOAPAddress address = (SOAPAddress) extension;
+                    return address.getLocationURI();
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * Returns the SOAP binding style.
+     * @return
+     */
+    public String getStyle() {
+
+        // Find the binding style
+        String style = null;
+        if (wsdlBinding != null) {
+            final List wsdlBindingExtensions = wsdlBinding.getExtensibilityElements();
+            SOAPBinding soapBinding = (SOAPBinding) getExtensibilityElement(wsdlBindingExtensions, SOAPBinding.class);
+            if (soapBinding != null)
+                style = soapBinding.getStyle();
+        }
+
+        // Default to document
+        return (style == null) ? "document" : style;
+    }
+
+    /**
+     * Returns the use attribute
+     * @return
+     */
+    public String getUse() {
+        List list = getAllOperationMetaData();
+        WebServiceOperationMetaData operationMetaData = (WebServiceOperationMetaData) list.get(0);
+        return operationMetaData.getUse();
+    }
+
+    /**
+     * Returns the encoding attribute
+     * @return
+     */
+    public String getEncoding() {
+        List list = getAllOperationMetaData();
+        WebServiceOperationMetaData operationMetaData = (WebServiceOperationMetaData) list.get(0);
+        return operationMetaData.getEncoding();
+    }
+
+    /**
+     * @return Returns true if this is a managed web service.
+     */
+    public boolean isManaged() {
+        return managed;
+    }
+
+    /**
+     * Returns the first extensibility element of the given type.
+     * @param elements
+     * @param type
+     * @return
+     */
+    public static Object getExtensibilityElement(List elements, Class type) {
+        for (Iterator i = elements.iterator(); i.hasNext();) {
+            Object element = i.next();
+            if (type.isInstance(element))
+                return element;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the extensibility elements of the given type.
+     * @param elements
+     * @param type
+     * @return
+     */
+    public static List getExtensibilityElements(List elements, Class type) {
+        List result = new ArrayList();
+        for (Iterator i = elements.iterator(); i.hasNext();) {
+            Object element = i.next();
+            if (type.isInstance(element))
+                result.add(element);
+        }
+        return result;
+    }
+
+    /**
+     * Get the operation signature from the SOAP Body
+     * @param body
+     * @return A list of QNames
+     */
+//    public static List getOperationSignature(javax.xml.soap.SOAPBody body) {
+//        List signature = new ArrayList();
+//        for (Iterator i = body.getChildElements(); i.hasNext();) {
+//            Object child = i.next();
+//            if (child instanceof SOAPBodyElement) {
+//                Name name = ((SOAPBodyElement) child).getElementName();
+//                QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
+//                signature.add(qname);
+//            }
+//        }
+//        return signature;
+//    }
+
+//    public static List getRPCOperationSignature(javax.xml.soap.SOAPBody body) {
+//        List signature = new ArrayList();
+//        for (Iterator i = body.getChildElements(); i.hasNext();) {
+//            Object child = i.next();
+//            if (child instanceof SOAPBodyElement) {
+//                SOAPBodyElement op = ((SOAPBodyElement) child);
+//                for (Iterator j = op.getChildElements(); j.hasNext();) {
+//                    Object part = i.next();
+//                    if (part instanceof SOAPElement) {
+//                        SOAPElement p = (SOAPElement) part;
+//                        signature.add(p.getLocalName());
+//                    }
+//                }
+//            }
+//        }
+//        return signature;
+//    }
+
+//    public WebServiceOperationMetaData getOperationMetaData(javax.xml.soap.SOAPBody body) {
+//        List s1 = getOperationSignature(body);
+//        // List rpcParts = getRPCOperationSignature(body);
+//        for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) {
+//            WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next();
+//
+//            String style = descriptor.getStyle();
+//
+//            if (style.equals("document")) {
+//                List s2 = descriptor.getOperationSignature();
+//                if (s1.equals(s2))
+//                    return descriptor;
+//            } else {
+//                QName op1 = (QName) s1.get(0);
+//                QName op2 = descriptor.getRPCOperationName();
+//                if (op1.equals(op2)) {
+//                    /*
+//                          * // FIXME: [rfeng] We don't support method overloading
+//                          * List partNames = getOperationSignature(binding,
+//                          * bindingOperation); if (rpcParts.equals(partNames))
+//                          */
+//                    return descriptor;
+//                }
+//            }
+//        }
+//        return null;
+//    }
+
+    public List getAllOperationMetaData() {
+        if (allOperationMetaData == null) {
+            allOperationMetaData = new ArrayList();
+            for (Iterator it = wsdlBinding.getBindingOperations().iterator(); it.hasNext();) {
+                final BindingOperation bindingOperation = (BindingOperation) it.next();
+                if (bindingOperation.getOperation() != null)
+                    allOperationMetaData.add(new WebServiceOperationMetaData(wsdlBinding, bindingOperation));
+            }
+        }
+        return allOperationMetaData;
+    }
+
+    public WebServiceOperationMetaData getOperationMetaData(String operationName) {
+        for (Iterator it = getAllOperationMetaData().iterator(); it.hasNext();) {
+            WebServiceOperationMetaData descriptor = (WebServiceOperationMetaData) it.next();
+            String opName = descriptor.getBindingOperation().getOperation().getName();
+
+            if (opName.equals(operationName))
+                return descriptor;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the WSDL service contract
+     * @return
+     */
+    public WSDLServiceContract getInterfaceType() {
+        return interfaceType;
+	}
+
+}
\ No newline at end of file

Added: incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceSCDLModelLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceSCDLModelLoader.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceSCDLModelLoader.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/loader/WebServiceSCDLModelLoader.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,74 @@
+package org.apache.tuscany.binding.axis2.loader;
+
+import org.apache.tuscany.binding.axis2.assembly.WebServiceAssemblyFactory;
+import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
+import org.apache.tuscany.binding.axis2.assembly.impl.WebServiceAssemblyFactoryImpl;
+import org.apache.tuscany.binding.axis2.assembly.impl.WebServiceBindingImpl;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.core.loader.SCDLModelLoaderRegistry;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.AssemblyModelObject;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * Populates the assembly model from an SCDL model
+ */
+@org.osoa.sca.annotations.Scope("MODULE")
+public class WebServiceSCDLModelLoader implements SCDLModelLoader {
+
+    private RuntimeContext runtimeContext;
+    private SCDLModelLoaderRegistry loaderRegistry;
+    private WebServiceAssemblyFactory wsFactory;
+
+    /**
+     * Constructs a new WebServiceSCDLModelLoader.
+     */
+    public WebServiceSCDLModelLoader() {
+        this.wsFactory=new WebServiceAssemblyFactoryImpl();
+    }
+
+    /**
+     * @param runtimeContext The runtimeContext to set.
+     */
+    @Autowire
+    public void setRuntimeContext(RuntimeContext runtimeContext) {
+        this.runtimeContext = runtimeContext;
+    }
+
+    // @Autowire
+    public void setLoaderRegistry(SCDLModelLoaderRegistry registry) {
+        this.loaderRegistry = registry;
+    }
+
+    @Init(eager=true)
+    public void init() {
+        runtimeContext.addLoader(this);
+//        loaderRegistry.registerLoader(this);
+    }
+
+    @Destroy
+    public void destroy() {
+        loaderRegistry.unregisterLoader(this);
+    }
+
+    /**
+     * @see org.apache.tuscany.model.scdl.loader.SCDLModelLoader#load(org.apache.tuscany.model.assembly.AssemblyModelContext, java.lang.Object)
+     */
+    public AssemblyModelObject load(AssemblyModelContext modelContext, Object object) {
+        if (object instanceof org.apache.tuscany.model.scdl.WebServiceBinding) {
+            org.apache.tuscany.model.scdl.WebServiceBinding scdlBinding=(org.apache.tuscany.model.scdl.WebServiceBinding)object;
+            WebServiceBinding binding=wsFactory.createWebServiceBinding();
+            binding.setURI(scdlBinding.getUri());
+
+            // Set the port URI into the assembly binding, it'll be resolved in the initialize method
+            ((WebServiceBindingImpl)binding).setPortURI(scdlBinding.getPort());
+
+            return binding;
+
+        } else
+            return null;
+    }
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/AxiomHelper.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/AxiomHelper.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/AxiomHelper.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/AxiomHelper.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,171 @@
+/**
+ * 
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.util;
+
+import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.tuscany.binding.axis2.handler.WebServicePortMetaData;
+import org.osoa.sca.ServiceRuntimeException;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Sequence;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class AxiomHelper {
+
+    public static OMElement toOMElement(DataObject dataObject, String nsURI, String name) throws XMLStreamException, IOException {
+
+        PipedOutputStream pos = new PipedOutputStream();
+        PipedInputStream pis = new PipedInputStream(pos);
+        XMLHelper.INSTANCE.save(dataObject, nsURI, name, pos);
+        pos.close();
+
+        // create the parser
+        XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(pis);
+        // create the builder
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
+        // get the root element (in this case the envelope)
+        OMElement root = builder.getDocumentElement();
+
+        /*
+         * // get the writer XMLStreamWriter writer = XMLOutputFactory.newInstance() .createXMLStreamWriter(System.out); // dump the out put to
+         * console with caching root.serialize(writer); writer.flush();
+         */
+
+        return root;
+
+    }
+
+    public static DataObject fromOMElement(OMElement root) throws IOException, XMLStreamException {
+        PipedOutputStream pos = new PipedOutputStream();
+        PipedInputStream pis = new PipedInputStream(pos);
+
+        root.serialize(pos);
+        pos.flush();
+        pos.close(); // We have to close the pos to avoid the reader being
+        // blocked
+
+        XMLDocument document = XMLHelper.INSTANCE.load(pis);
+
+        return document.getRootObject();
+
+    }
+
+    /**
+     * Serialize Java Objects into an AXIOM OMElement
+     * 
+     * @param method
+     * @param args
+     * @param wsPortMetaData
+     * @return the AXIOM OMElement
+     */
+    public static OMElement toOMElement(Method method, Object[] args, WebServicePortMetaData wsPortMetaData) {
+
+        // TODO: toDataObject() doesn't work, ask Frank how it should be done
+        // DataObject dataObject = toDataObject(method, args, wsPortMetaData);
+        // String operationName = method.getName();
+        // String serviceNamespace = wsPortMetaData.getServiceName().getNamespaceURI();
+        // String xml = XMLHelper.INSTANCE.save(dataObject,serviceNamespace, operationName);
+        String xml = 
+            "<getGreetings xmlns=\"http://helloworldaxis.samples.tuscany.apache.org\">" + 
+               "<in0>World</in0>" + 
+            "</getGreetings>";
+
+        StringReader sr = new StringReader(xml);
+        XMLStreamReader parser;
+        try {
+            parser = XMLInputFactory.newInstance().createXMLStreamReader(sr);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(), parser);
+        OMElement om = builder.getDocumentElement();
+
+        return om;
+    }
+
+    /**
+     * Deserialize an OMElement into Java Objects
+     * 
+     * @param om
+     *            the OMElement
+     * @return the array of deserialized Java objects
+     */
+    public static Object[] toObjects(OMElement om) {
+        DataObject dataObject;
+        try {
+            dataObject = fromOMElement(om);
+        } catch (IOException e) {
+            throw new ServiceRuntimeException(e);
+        } catch (XMLStreamException e) {
+            throw new ServiceRuntimeException(e);
+        }
+        Object[] os = toObjects(dataObject);
+        return os;
+    }
+
+    public static Object[] toObjects(DataObject dataObject) {
+        Sequence parmSeq = dataObject.getSequence("mixed");
+        ArrayList parms = new ArrayList(parmSeq.size());
+        for (int i = 0; i < parmSeq.size(); ++i) {
+            Object parmDO = (Object) parmSeq.getValue(i);// parm element
+            if (parmDO instanceof DataObject) {
+                Sequence nn = ((DataObject) parmDO).getSequence("mixed");
+                for (int j = 0; j < nn.size(); j++) {
+                    Object valueDO = (Object) nn.getValue(j); // data array s
+                    if (valueDO instanceof DataObject) {
+                        Sequence seqVal = ((DataObject) valueDO).getSequence("mixed");
+                        Object seqDO = seqVal.getValue(0);
+                        if (seqDO instanceof String) {
+                            parms.add(seqDO);
+                        } else {
+                            parms.add(valueDO); // no sure if this is right?
+                        }
+                    } else {
+                        parms.add(valueDO);
+                    }
+                }
+            }
+        }
+        Object[] args = parms.toArray(new Object[parms.size()]);
+        return args;
+    }
+
+    private static DataObject toDataObject(Method method, Object[] args, WebServicePortMetaData wsPortMetaData) {
+        // TODO: this doesn't work, ask Frank how it should be done
+        Class seiClass = method.getDeclaringClass();
+        DataObject dataObject = DataFactory.INSTANCE.create(seiClass);
+        for (int i = 0; i < args.length; i++) {
+            dataObject.set(i, args[i]);
+        }
+        return dataObject;
+    }
+
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/resources/org/apache/tuscany/binding/axis2/engine/config/axis2.xml Wed Mar  1 20:25:29 2006
@@ -0,0 +1,167 @@
+<axisconfig name="AxisJava2.0">
+    <!-- ================================================= -->
+    <!-- Parameters -->
+    <!-- ================================================= -->
+    <parameter name="hotdeployment" locked="false">false</parameter>
+    <parameter name="hotupdate" locked="false">false</parameter>
+    <parameter name="enableMTOM" locked="false">false</parameter>
+    <!-- Uncomment this to enable REST support -->
+    <!--    <parameter name="enableREST" locked="false">true</parameter>-->
+
+
+    <parameter name="userName" locked="false">admin</parameter>
+    <parameter name="password" locked="false">axis2</parameter>
+
+    <parameter name="seralizeLocation" locked="false">.</parameter>
+    <hostConfiguration>
+        <ip>127.0.0.1</ip>
+        <port>5555</port>
+    </hostConfiguration>
+
+
+    <!--if you want to extract the service archive file and work with that please uncomment this-->
+    <!--else , it wont extract archive file or does not take into consideration if someone drop-->
+    <!--exploded directory into /service directory-->
+    <!--<parameter name="extractServiceArchive" locked="false">true</parameter>-->
+
+
+    <!--    The way of adding listener to the system-->
+    <!--    <listener class="org.apache.axis2.ObserverIMPL">-->
+    <!--        <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+    <!--    </listener>-->
+
+    <!-- ================================================= -->
+    <!-- Message Receivers -->
+    <!-- ================================================= -->
+    <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+    <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+    <!--any operation -->
+    <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+    <messageReceivers>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+                         class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+                         class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </messageReceivers>
+    <!-- ================================================= -->
+    <!-- Transport Ins -->
+    <!-- ================================================= -->
+    <transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+    <transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">
+          <parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>
+          <parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>
+          <parameter name="transport.mail.pop3.port" locked="false">110</parameter>
+          <parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>
+      </transportReceiver> -->
+
+    <!--REMOVED FOR TUSCANY  transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer">
+        <parameter name="port" locked="false">6060</parameter>
+    </transportReceiver -->
+
+    <!--REMOVED FOR TUSCANY transportReceiver name="jms" class="org.apache.axis2.transport.jms.SimpleJMSListener">
+        <parameter name="transport.jms.Destination" locked="false">dynamicQueues/FOO</parameter>
+        <parameter name="java.naming.factory.initial" locked="false">
+            org.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+        <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+    </transportReceiver>
+    -->
+
+    <!-- ================================================= -->
+    <!-- Transport Outs -->
+    <!-- ================================================= -->
+
+    <!--REMOVED FOR TUSCANY transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/> -->
+    <transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
+    <!--REMOVED FOR TUSCANY transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/> -->
+    <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+    </transportSender>
+    <transportSender name="https"
+                     class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+        <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+        <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+    </transportSender>
+
+    <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+   <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+       <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+       <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+       <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+   </transportSender>
+   -->
+
+    <!-- ================================================= -->
+    <!-- Global Modules  -->
+    <!-- ================================================= -->
+    <!-- Comment this to disable Addressing -->
+    <!--REMOVED FOR TUSCANY  module ref="addressing"/> -->
+
+
+    <!--Configuring module , providing parameters for modules whether they refer or not-->
+    <!--<moduleConfig name="addressing">-->
+    <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+    <!--</moduleConfig>-->
+
+    <!-- ================================================= -->
+    <!-- Phases  -->
+    <!-- ================================================= -->
+    <phaseOrder type="inflow">
+        <!--  System pre defined phases       -->
+        <phase name="TransportIn"/>
+        <phase name="PreDispatch"/>
+        <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+            <handler name="AddressingBasedDispatcher"
+                     class="org.apache.axis2.engine.AddressingBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="RequestURIBasedDispatcher"
+                     class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPActionBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+
+            <handler name="SOAPMessageBodyBasedDispatcher"
+                     class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+                <order phase="Dispatch"/>
+            </handler>
+            <handler name="InstanceDispatcher"
+                     class="org.apache.axis2.engine.InstanceDispatcher">
+                <order phase="PostDispatch"/>
+            </handler>
+        </phase>
+        <!--  System pre defined phases       -->
+        <!--   After Postdispatch phase module author or or service author can add any phase he want      -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="outflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+        <!--system predefined phase-->
+        <!--these phase will run irrespective of the service-->
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+    <phaseOrder type="INfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+    </phaseOrder>
+    <phaseOrder type="Outfaultflow">
+        <!--      user can add his own phases to this area  -->
+        <phase name="userphase1"/>
+        <phase name="PolicyDetermination"/>
+        <phase name="MessageOut"/>
+    </phaseOrder>
+</axisconfig>
+

Added: incubator/tuscany/java/sca/binding.axis2/src/main/resources/system.fragment
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/main/resources/system.fragment?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/main/resources/system.fragment (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/main/resources/system.fragment Wed Mar  1 20:25:29 2006
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+  Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+  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.
+ -->
+<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+        xmlns:system="http://org.apache.tuscany/xmlns/system/0.9"
+		name="org.apache.tuscany.binding.axis">
+
+    <component name="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceConfigurationBuilder">
+        <system:implementation.system class="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceConfigurationBuilder"/>
+    </component>
+
+    <component name="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder">
+        <system:implementation.system class="org.apache.tuscany.binding.axis2.builder.ExternalWebServiceWireBuilder"/>
+    </component>
+
+    <component name="org.apache.tuscany.binding.axis2.loader.WebServiceSCDLModelLoader">
+        <system:implementation.system class="org.apache.tuscany.binding.axis2.loader.WebServiceSCDLModelLoader"/>
+    </component>
+
+    <component name="org.apache.tuscany.binding.axis2.builder.WebServiceEntryPointConfigurationBuilder">
+        <system:implementation.system class="org.apache.tuscany.binding.axis2.builder.WebServiceEntryPointConfigurationBuilder"/>
+    </component>
+
+</moduleFragment>

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/WebServiceAssemblyLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/WebServiceAssemblyLoaderTestCase.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/WebServiceAssemblyLoaderTestCase.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/WebServiceAssemblyLoaderTestCase.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,87 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.binding.axis2.assembly.WebServiceBinding;
+import org.apache.tuscany.binding.axis2.loader.WebServiceSCDLModelLoader;
+import org.apache.tuscany.common.resource.ResourceLoader;
+import org.apache.tuscany.common.resource.impl.ResourceLoaderImpl;
+import org.apache.tuscany.model.assembly.AssemblyFactory;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.Binding;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.ExternalService;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.assembly.loader.AssemblyModelLoader;
+import org.apache.tuscany.model.scdl.loader.SCDLModelLoader;
+import org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl;
+
+/**
+ */
+public class WebServiceAssemblyLoaderTestCase extends TestCase {
+
+    /**
+     *
+     */
+    public WebServiceAssemblyLoaderTestCase() {
+        super();
+    }
+
+    public void testLoader() {
+
+        ResourceLoader resourceLoader=new ResourceLoaderImpl(Thread.currentThread().getContextClassLoader());
+        WebServiceSCDLModelLoader wsLoader=new WebServiceSCDLModelLoader();
+        List<SCDLModelLoader> scdlLoaders=new ArrayList<SCDLModelLoader>();
+        scdlLoaders.add(wsLoader);
+        AssemblyModelLoader assemblyLoader=new SCDLAssemblyModelLoaderImpl(scdlLoaders);
+        AssemblyFactory assemblyFactory=new AssemblyFactoryImpl();
+        AssemblyModelContext modelContext=new AssemblyModelContextImpl(assemblyFactory, assemblyLoader, resourceLoader);
+
+        Module module = assemblyLoader.loadModule(getClass().getResource("sca.module").toString());
+        module.initialize(modelContext);
+
+        Assert.assertTrue(module.getName().equals("tuscany.binding.axis2.assembly.tests.bigbank.account"));
+
+        Component component = module.getComponent("AccountServiceComponent");
+        Assert.assertTrue(component != null);
+
+        EntryPoint entryPoint = module.getEntryPoint("AccountService");
+        Assert.assertTrue(entryPoint != null);
+
+        ExternalService externalService = module.getExternalService("StockQuoteService");
+        Assert.assertTrue(externalService != null);
+
+        Binding binding = externalService.getBindings().get(0);
+        Assert.assertTrue(binding instanceof WebServiceBinding);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+    }
+
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountReport.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,32 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account;
+
+import java.util.List;
+
+/**
+ * @model
+ */
+
+public interface AccountReport {
+
+    /**
+     * @model type="services.account.AccountSummary"
+     */
+
+    List getAccountSummaries();
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountService.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,25 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AccountService {
+
+    public AccountReport getAccountReport(String customerID);
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountServiceImpl.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,42 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata.AccountDataService;
+import org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.stockquote.StockQuoteService;
+
+public class AccountServiceImpl implements AccountService {
+
+    @Property
+    public String currency = "USD";
+
+    @Reference
+    public AccountDataService accountDataService;
+    @Reference
+    public StockQuoteService stockQuoteService;
+
+    public AccountServiceImpl() {
+    }
+
+    public AccountReport getAccountReport(String customerID) {
+        return null;
+    }
+
+}

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/account/AccountSummary.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,46 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.account;
+
+/**
+ * @model
+ */
+
+public interface AccountSummary {
+
+    /**
+     * @model
+     */
+    String getAccountNumber();
+
+    void setAccountNumber(String accountNumber);
+
+    /**
+     * @model
+     */
+    String getAccountType();
+
+    void setAccountType(String accountType);
+
+    /**
+     * @model
+     */
+    float getBalance();
+
+    void setBalance(float balance);
+}
+

Added: incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java?rev=382293&view=auto
==============================================================================
--- incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java (added)
+++ incubator/tuscany/java/sca/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java Wed Mar  1 20:25:29 2006
@@ -0,0 +1,26 @@
+/**
+ *
+ *  Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.binding.axis2.assembly.tests.bigbank.account.services.accountdata;
+
+public interface AccountDataService {
+
+    CheckingAccount getCheckingAccount(String customerID);
+
+    SavingsAccount getSavingsAccount(String customerID);
+
+    StockAccount getStockAccount(String customerID);
+}