You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/07/12 16:01:57 UTC

svn commit: r421273 - in /incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src: main/java/org/apache/tuscany/binding/celtix/ main/java/org/apache/tuscany/binding/celtix/io/ test/java/org/apache/tuscany/binding/celtix/ test/resources/wsdl/

Author: jboynes
Date: Wed Jul 12 07:01:56 2006
New Revision: 421273

URL: http://svn.apache.org/viewvc?rev=421273&view=rev
Log:
apply patch for TUSCANY-538 from Jervis Liu

Added:
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java
      - copied, changed from r421268, incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCADataBindingCallback.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java
      - copied, changed from r421268, incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCAServerDataBindingCallback.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java   (with props)
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit.wsdl
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl
Removed:
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCADataBindingCallback.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCAServerDataBindingCallback.java
Modified:
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java
    incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java

Modified: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java?rev=421273&r1=421272&r2=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixInvoker.java Wed Jul 12 07:01:56 2006
@@ -26,13 +26,14 @@
 import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.ws.Holder;
 import javax.xml.ws.ProtocolException;
+import javax.xml.ws.Holder;
 
 import org.apache.tuscany.spi.builder.BuilderException;
 import org.apache.tuscany.spi.wire.Interceptor;
 import org.apache.tuscany.spi.wire.Message;
 import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback;
 import org.objectweb.celtix.Bus;
 import org.objectweb.celtix.BusException;
 import org.objectweb.celtix.bindings.ClientBinding;
@@ -44,36 +45,39 @@
 import org.objectweb.celtix.wsdl.EndpointReferenceUtils;
 import org.xmlsoap.schemas.wsdl.http.AddressType;
 
+import org.objectweb.celtix.bindings.BindingManager;
+
 /**
- * Responsible for dispatching a service operation invocation on a reference to the active Celtix
- * <code>Bus</code>
+ * Responsible for dispatching a service operation invocation on a reference to
+ * the active Celtix <code>Bus</code>
  *
  * @version $Rev$ $Date$
  */
 public class CeltixInvoker implements TargetInvoker {
 
     private WSDLMetaDataCache wsdlCache;
+
     private ClientBinding clientBinding;
+
     private String operationName;
 
     public CeltixInvoker(String operationName,
                          Bus bus,
-                         WSDLMetaDataCache wsdlCache,
                          Port port,
                          Service wsdlService,
                          Definition wsdlDef) throws BuilderException {
-        this.wsdlCache = wsdlCache;
+        wsdlCache = new WSDLMetaDataCache(wsdlDef, port);
         this.operationName = operationName;
-        //Definition wsdlDef = wsBinding.getWSDLDefinition();
-        //wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort());
+        // Definition wsdlDef = wsBinding.getWSDLDefinition();
+        // wsdlCache = new WSDLMetaDataCache(wsdlDef, wsBinding.getWSDLPort());
 
         try {
             String key = wsdlDef.getDocumentBaseURI();
             URL url = new URL(key);
 
             EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url,
-                    wsdlService.getQName(),
-                    port.getName());
+                                                                                          wsdlService.getQName(),
+                                                                                          port.getName());
 
             String bindingId = null;
             Binding binding = port.getBinding();
@@ -97,7 +101,7 @@
 
             }
             clientBinding = bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(
-                    reference);
+                                                                                                     reference);
         } catch (MalformedURLException e) {
             throw new InvokerCreationException(e);
         } catch (BusException e) {
@@ -112,13 +116,14 @@
     /**
      * Invoke an operation on the external Web service.
      *
-     * @param args the Java object arguments to the WS operation
+     * @param args
+     *            the Java object arguments to the WS operation
      * @return the response from the WS as a Java object
      */
     public Object invokeTarget(Object args) {
         WSDLOperationInfo opInfo = wsdlCache.getOperationInfo(operationName);
         if (opInfo == null) {
-            //REVISIT - really map the operation name to a WSDL operation
+            // REVISIT - really map the operation name to a WSDL operation
             for (String opName : wsdlCache.getAllOperationInfo().keySet()) {
                 if (operationName.equalsIgnoreCase(opName)) {
                     opInfo = wsdlCache.getOperationInfo(opName);
@@ -126,6 +131,7 @@
                 }
             }
         }
+
         ObjectMessageContext objMsgContext = clientBinding.createObjectContext();
 
         boolean hasInOut = false;
@@ -141,8 +147,9 @@
         }
 
         if (opInfo.getParamsLength() == 0) {
-            //REVISIT - opInfo doesn't return the needed info for the wrapped doc/lit case.
-            //Bug in Celtix
+            // REVISIT - opInfo doesn't return the needed info for the wrapped
+            // doc/lit case.
+            // Bug in Celtix
             realArgs = argsArray;
         } else {
             for (int x = 0; x < argsArray.length; x++) {
@@ -155,17 +162,16 @@
                 }
             }
         }
-
         objMsgContext.setMessageObjects(realArgs);
         boolean isOneway = opInfo.isOneWay();
         DataBindingCallback callback = new SCADataBindingCallback(opInfo, hasInOut);
         try {
             if (isOneway) {
                 clientBinding.invokeOneWay(objMsgContext,
-                        callback);
+                                           callback);
             } else {
                 objMsgContext = clientBinding.invoke(objMsgContext,
-                        callback);
+                                                     callback);
             }
         } catch (IOException e) {
             // TODO Auto-generated catch block
@@ -173,14 +179,12 @@
         }
 
         if (objMsgContext.getException() != null) {
-            //REVISIT - Exceptions
+            // REVISIT - Exceptions
             /*
-            if (isValidException(objMsgContext)) {
-                throw (Exception)objMsgContext.getException();
-            } else {
-                throw new ProtocolException(objMsgContext.getException());
-            }
-            */
+             * if (isValidException(objMsgContext)) { throw
+             * (Exception)objMsgContext.getException(); } else { throw new
+             * ProtocolException(objMsgContext.getException()); }
+             */
             throw new ProtocolException(objMsgContext.getException());
         }
 

Modified: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java?rev=421273&r1=421272&r2=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java Wed Jul 12 07:01:56 2006
@@ -37,7 +37,6 @@
     private Port port;
     private Definition wsdlDef;
     private Service wsdlService;
-    private WSDLMetaDataCache wsdlCache;
 
     public CeltixReference(String name,
                            Definition wsdlDef,
@@ -51,11 +50,10 @@
         this.wsdlDef = wsdlDef;
         this.wsdlService = wsdlService;
         this.bus = bus;
-        wsdlCache = new WSDLMetaDataCache(wsdlDef, port);
     }
 
     public TargetInvoker createTargetInvoker(String serviceName, Method operation) {
         //FIXME - can we pass in the method name as the operation name?
-        return new CeltixInvoker(operation.getName(), bus, wsdlCache, port, wsdlService, wsdlDef);
+        return new CeltixInvoker(operation.getName(), bus, port, wsdlService, wsdlDef);
     }
 }

Modified: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java?rev=421273&r1=421272&r2=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java Wed Jul 12 07:01:56 2006
@@ -33,6 +33,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceProvider;
 
+import org.apache.tuscany.binding.celtix.io.SCAServerDataBindingCallback;
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.builder.BuilderConfigException;
 import org.apache.tuscany.spi.component.CompositeComponent;
@@ -67,7 +68,7 @@
     private Object proxy;
 
     private Map<QName, ServerDataBindingCallback> opMap =
-            new ConcurrentHashMap<QName, ServerDataBindingCallback>();
+        new ConcurrentHashMap<QName, ServerDataBindingCallback>();
 
 
     public CeltixService(String name,
@@ -98,8 +99,8 @@
         }
 
         EndpointReferenceType reference = EndpointReferenceUtils.getEndpointReference(url,
-                wsdlService.getQName(),
-                port.getName());
+                                                                                      wsdlService.getQName(),
+                                                                                      port.getName());
 
         AttributedURIType address = new AttributedURIType();
 
@@ -134,7 +135,7 @@
 
         try {
             ServerBinding serverBinding = bus.getBindingManager().getBindingFactory(bindingId).createServerBinding(
-                    reference, this);
+                                                                                                                   reference, this);
             serverBinding.activate();
         } catch (Exception e) {
             throw new CeltixServiceInitException(e);
@@ -163,7 +164,7 @@
             }
 
             ServerDataBindingCallback cb = getDataBindingCallback(qn, null,
-                    DataBindingCallback.Mode.PARTS);
+                                                                  DataBindingCallback.Mode.PARTS);
             opMap.put(qn, cb);
             if (!"".equals(cb.getRequestWrapperQName().getLocalPart())) {
                 opMap.put(cb.getRequestWrapperQName(), cb);
@@ -211,7 +212,7 @@
             }
         }
         throw new BuilderConfigException("no operation named " + operationName
-                + " found on service interface: " + serviceInterface.getName());
+                                         + " found on service interface: " + serviceInterface.getName());
     }
 
 

Modified: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java?rev=421273&r1=421272&r2=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/WebServiceBindingLoader.java Wed Jul 12 07:01:56 2006
@@ -76,7 +76,8 @@
 
     private WebServiceBinding createBinding(String port, String portURI) {
         List<Definition> definitions = null;
-        //FIXME wsdlRegistry.getDefinitionsForNamespace(portNamespace, resourceLoader);
+        // FIXME wsdlRegistry.getDefinitionsForNamespace(portNamespace,
+        // resourceLoader);
         // Get the WSDL port namespace and name
         if (port == null && portURI != null) {
             int h = portURI.indexOf('#');
@@ -131,7 +132,7 @@
             }
             return new WebServiceBinding(definition, thePort, port, portURI, service);
         }
-        //FIXME
+        // FIXME
         return null;
 
     }

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,176 @@
+/**
+ *
+ *  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.celtix.io;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSSerializer;
+//import commonj.sdo.DataObject;
+//import commonj.sdo.Property;
+//import commonj.sdo.helper.XMLDocument;
+
+//import org.apache.tuscany.databinding.sdo.SDOXMLHelper;
+//import org.apache.tuscany.sdo.helper.XMLHelperImpl;
+import org.objectweb.celtix.bindings.DataReader;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+public class NodeDataReader implements DataReader<Node> {
+
+    SCADataBindingCallback callback;
+
+    public NodeDataReader(SCADataBindingCallback cb) {
+        callback = cb;
+    }
+
+    public Object read(int idx, Node input) {
+        return read(null, idx, input);
+    }
+
+    public Object read(QName name, int idx, Node input) {
+//FIXME: This part of code should not depend on SDO direclty. Use a data mediation system service?
+/*
+        try {
+            byte bytes[] = getNodeBytes(input);
+            //FIXME: get TypeHelper
+            //            Object os[] = SDOXMLHelper.toObjects(callback.getTypeHelper(), bytes, false);
+            return os[0];
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new WebServiceException(e);
+        }
+*/
+        return null;
+    }
+
+    public void readWrapper(ObjectMessageContext objCtx, boolean isOutBound, Node input) {
+/*
+        try {
+            QName wrapperName;
+            if (isOutBound) {
+                wrapperName = callback.getOperationInfo().getResponseWrapperQName();
+            } else {
+                wrapperName = callback.getOperationInfo().getRequestWrapperQName();
+            }
+
+            Node nd = input.getFirstChild();
+            while (nd != null
+                   && !wrapperName.getNamespaceURI().equals(nd.getNamespaceURI())
+                   && !wrapperName.getLocalPart().equals(nd.getLocalName())) {
+                nd = nd.getNextSibling();
+            }
+
+            //REVISIT - This is SUCH a HACK.  This needs to be done with StAX or something
+            //a bit better than streaming and reparsing
+            InputStream in = getNodeStream(nd);
+            //            XMLDocument document = new XMLHelperImpl(new commonj.sdo.helper.TypeHelper()).load(in);
+            //            XMLDocument document = new XMLHelperImpl(callback.getTypeHelper()).load(in);
+            DataObject object = null;
+
+            List ips = object.getInstanceProperties();
+            Object[] os = new Object[object.getInstanceProperties().size()];
+            for (int i = 0; i < os.length; i++) {
+                os[i] = object.get((Property)ips.get(i));
+            }
+
+            if (callback.hasInOut()) {
+                //REVISIT - inOuts
+            } else {
+                if (isOutBound) {
+                    objCtx.setReturn(os[0]);
+                } else {
+                    objCtx.setMessageObjects(os);
+                }
+            }
+            //        } catch (IOException e) {
+            //            throw new WebServiceException(e);
+        } catch (ClassCastException e) {
+            throw new WebServiceException(e);
+        } catch (ClassNotFoundException e) {
+            throw new WebServiceException(e);
+        } catch (InstantiationException e) {
+            throw new WebServiceException(e);
+        } catch (IllegalAccessException e) {
+            throw new WebServiceException(e);
+        }
+*/
+    }
+    private byte[] getNodeBytes(Node node)
+        throws ClassCastException, ClassNotFoundException,
+               InstantiationException, IllegalAccessException {
+
+        //This is also a hack, the JDK should already have this set, but it doesn't
+        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+        if (registry == null) {
+            System.setProperty(DOMImplementationRegistry.PROPERTY,
+                               "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+            registry = DOMImplementationRegistry.newInstance();
+        }
+        DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
+        if (impl == null) {
+            System.setProperty(DOMImplementationRegistry.PROPERTY,
+                               "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+            registry = DOMImplementationRegistry.newInstance();
+            impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
+        }
+        LSOutput output = impl.createLSOutput();
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        output.setByteStream(bout);
+        LSSerializer writer = impl.createLSSerializer();
+        writer.write(node, output);
+
+        return bout.toByteArray();
+    }
+
+    private InputStream getNodeStream(Node node)
+        throws ClassCastException, ClassNotFoundException,
+               InstantiationException, IllegalAccessException {
+
+        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+        if (registry == null) {
+            //This is also a hack, the JDK should already have this set, but it doesn't
+            System.setProperty(DOMImplementationRegistry.PROPERTY,
+                               "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+            registry = DOMImplementationRegistry.newInstance();
+        }
+        DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
+        if (impl == null) {
+            System.setProperty(DOMImplementationRegistry.PROPERTY,
+                               "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+            registry = DOMImplementationRegistry.newInstance();
+            impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
+        }
+        LSOutput output = impl.createLSOutput();
+        RawByteArrayOutputStream bout = new RawByteArrayOutputStream();
+        output.setByteStream(bout);
+        LSSerializer writer = impl.createLSSerializer();
+        writer.write(node, output);
+
+        return new ByteArrayInputStream(bout.getBytes(), 0, bout.size());
+    }
+
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,181 @@
+/**
+ *
+ *  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.celtix.io;
+
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.List;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+//import commonj.sdo.DataObject;
+//import commonj.sdo.Property;
+//import commonj.sdo.helper.TypeHelper;
+//import commonj.sdo.helper.XSDHelper;
+
+//import org.apache.tuscany.databinding.sdo.SDOXMLHelper;
+//import org.apache.tuscany.sdo.helper.DataFactoryImpl;
+//import org.apache.tuscany.sdo.helper.XMLHelperImpl;
+//import org.apache.tuscany.sdo.helper.XSDHelperImpl;
+import org.objectweb.celtix.bindings.DataWriter;
+import org.objectweb.celtix.context.ObjectMessageContext;
+
+public class NodeDataWriter implements DataWriter<Node> {
+    SCADataBindingCallback callback;
+
+    public NodeDataWriter(SCADataBindingCallback cb) {
+        callback = cb;
+    }
+
+    public void write(Object obj, Node output) {
+        write(obj, null, output);
+    }
+
+    public void write(Object obj, QName elName, Node output) {
+		/*
+        byte bytes[] = SDOXMLHelper.toXMLBytes(
+            callback.getTypeHelper(),
+            new Object[] {obj},
+            elName,
+            false);
+        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        factory.setNamespaceAware(true);
+        try {
+            SAXParser parser = factory.newSAXParser();
+            parser.parse(bin, new NodeContentHandler(output));
+        } catch (RuntimeException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new WebServiceException(e);
+        }
+        */
+
+    }
+
+    public void writeWrapper(ObjectMessageContext objCtx, boolean isOutbound, Node nd) {
+/*
+        QName wrapperName;
+        if (isOutbound) {
+            wrapperName = callback.getOperationInfo().getResponseWrapperQName();
+        } else {
+            wrapperName = callback.getOperationInfo().getRequestWrapperQName();
+        }
+
+        DataObject obj = toWrappedDataObject(callback.getTypeHelper(),
+            isOutbound ? objCtx.getReturn() : null,
+            objCtx.getMessageObjects(),
+            wrapperName);
+
+        try {
+            //REVISIT - this is SUCH a hack.   SDO needs to be able to
+            //go directly to some formats other than streams.  They are working
+            //on stax, but not there yet.
+            RawByteArrayOutputStream bout = new RawByteArrayOutputStream();
+            new XMLHelperImpl(callback.getTypeHelper()).save(obj,
+                wrapperName.getNamespaceURI(),
+                wrapperName.getLocalPart(),
+                bout);
+            ByteArrayInputStream bin = new ByteArrayInputStream(bout.getBytes(),
+                                                                0,
+                                                                bout.size());
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            SAXParser parser = factory.newSAXParser();
+            parser.parse(bin, new NodeContentHandler(nd));
+        } catch (IOException e) {
+            throw new WebServiceException(e);
+        } catch (ParserConfigurationException e) {
+            throw new WebServiceException(e);
+        } catch (SAXException e) {
+            throw new WebServiceException(e);
+        }
+*/
+    }
+
+/*
+    public static DataObject toWrappedDataObject(TypeHelper typeHelper,
+                                                 Object ret,
+                                                 Object[] os,
+                                                 QName typeQN) {
+        XSDHelper xsdHelper = new XSDHelperImpl(typeHelper);
+        Property property = xsdHelper.getGlobalProperty(typeQN.getNamespaceURI(),
+                                                        typeQN.getLocalPart(), true);
+        DataObject dataObject = new DataFactoryImpl(typeHelper).create(property.getType());
+        List ips = dataObject.getInstanceProperties();
+        int offset = 0;
+        if (ret != null) {
+            dataObject.set(0, ret);
+            offset = 1;
+        }
+        for (int i = offset; i < ips.size(); i++) {
+            if (os[i - offset] instanceof Holder) {
+                Holder<?> holder = (Holder<?>)os[i - offset];
+                dataObject.set(i, holder.value);
+            } else {
+                dataObject.set(i, os[i - offset]);
+            }
+        }
+        return dataObject;
+    }
+*/
+    private class NodeContentHandler extends DefaultHandler {
+        Node current;
+        Document doc;
+
+        public NodeContentHandler(Node nd) {
+            doc = nd.getOwnerDocument();
+            if (doc == null && nd instanceof Document) {
+                doc = (Document)nd;
+            }
+            current = nd;
+        }
+
+        public void characters(char[] ch, int start, int length) {
+            current.appendChild(doc.createTextNode(new String(ch, start, length)));
+        }
+
+        public void startElement(String uri, String localName,
+                                 String qName, Attributes attributes) {
+            Element newEl = doc.createElementNS(uri, qName);
+            current.appendChild(newEl);
+            current = newEl;
+            for (int x = 0; x < attributes.getLength(); x++) {
+                newEl.setAttributeNS(attributes.getURI(x),
+                                     attributes.getQName(x),
+                                     attributes.getValue(x));
+            }
+        }
+
+        public void endElement(String uri, String localName, String qName) {
+            current = current.getParentNode();
+        }
+    }
+
+
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/NodeDataWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,28 @@
+/**
+ *
+ *  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.celtix.io;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Just to allow raw access to the byte[] to avoid a copy
+ */
+class RawByteArrayOutputStream extends ByteArrayOutputStream {
+    public byte[] getBytes() {
+        return buf;
+    }
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/RawByteArrayOutputStream.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java (from r421268, incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCADataBindingCallback.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java?p2=incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java&p1=incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCADataBindingCallback.java&r1=421268&r2=421273&rev=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCADataBindingCallback.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCADataBindingCallback.java Wed Jul 12 07:01:56 2006
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.tuscany.binding.celtix;
+package org.apache.tuscany.binding.celtix.io;
 
 import org.w3c.dom.Node;
 

Copied: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java (from r421268, incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCAServerDataBindingCallback.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java?p2=incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java&p1=incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCAServerDataBindingCallback.java&r1=421268&r2=421273&rev=421273&view=diff
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/SCAServerDataBindingCallback.java (original)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/io/SCAServerDataBindingCallback.java Wed Jul 12 07:01:56 2006
@@ -14,7 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.tuscany.binding.celtix;
+package org.apache.tuscany.binding.celtix.io;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,125 @@
+package org.apache.tuscany.binding.celtix;
+
+import java.net.URL;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.Service;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.bus.bindings.soap.SOAPClientBinding;
+import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory;
+import org.objectweb.celtix.bindings.BindingManager;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CeltixInvokerTestCase extends TestCase {
+
+    public void testProcessingInputWithoutInOut() throws Exception {
+        String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
+        String operationName = "greetMe";
+        ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl();
+        CeltixInvoker invoker = createCeltixInvoker(wsdlLocation,
+                operationName, inputCtx);
+
+        Object[] args = new Object[1];
+        String inputvalue = new String("hello");
+        args[0] = inputvalue;
+        Object result = invoker.invokeTarget(args);
+
+        // Check the input object after processing is correct
+        // Should be no change for input if only IN parameters involved
+        Object[] myrtn = (Object[]) inputCtx.getMessageObjects();
+
+        assertEquals("hello", myrtn[0]);
+    }
+
+    public void testProcessingInputWithInOut() throws Exception {
+        String wsdlLocation = "/wsdl/hello_world_doc_lit_inout.wsdl";
+        String operationName = "greetMe";
+        ObjectMessageContextImpl inputCtx = new ObjectMessageContextImpl();
+        CeltixInvoker invoker = createCeltixInvoker(wsdlLocation,
+                operationName, inputCtx);
+
+        Object[] args = new Object[1];
+        String inputvalue = new String("hello");
+        args[0] = inputvalue;
+        Object result = invoker.invokeTarget(args);
+
+        // Check the input object after processing is correct
+        // input should be wrapped as Holder type if it is INOUT parameter
+        Object[] myrtn = (Object[]) inputCtx.getMessageObjects();
+
+        //FIXME: this does not work for the wrapped doc/lit case due to a bug in Celtix
+        //assertTrue("input is not Holder type", myrtn[0] instanceof Holder);
+    }
+
+    // NOTE: For convenience this method presumes the soap service name is
+    // SOAPService and port name is SoapPort
+    private CeltixInvoker createCeltixInvoker(String wsdlLocation,
+            String operationName, ObjectMessageContextImpl inputCtx)
+            throws Exception {
+        // Make following call to return a mocked SOAPClientBinding:
+        // bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference)
+        SOAPClientBinding clientBinding = EasyMock
+                .createMock(SOAPClientBinding.class);
+        clientBinding.createObjectContext();
+        EasyMock.expectLastCall().andReturn(inputCtx);
+        clientBinding.invoke(EasyMock.isA(ObjectMessageContextImpl.class),
+                EasyMock.isA(SCADataBindingCallback.class));
+        EasyMock.expectLastCall().andReturn(new ObjectMessageContextImpl());
+        EasyMock.replay(clientBinding);
+
+        SOAPBindingFactory bindingFactory = EasyMock
+                .createNiceMock(SOAPBindingFactory.class);
+        bindingFactory.createClientBinding(EasyMock
+                .isA(EndpointReferenceType.class));
+        EasyMock.expectLastCall().andReturn(clientBinding);
+        EasyMock.replay(bindingFactory);
+
+        BindingManager bindingManager = EasyMock
+                .createNiceMock(BindingManager.class);
+        String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
+        bindingManager.getBindingFactory(bindingId);
+        EasyMock.expectLastCall().andReturn(bindingFactory);
+
+        Bus bus = EasyMock.createNiceMock(Bus.class);
+        bus.getBindingManager();
+        EasyMock.expectLastCall().andReturn(bindingManager);
+        EasyMock.replay(bindingManager);
+        EasyMock.replay(bus);
+
+        // Create WSDL Definition
+        URL url = getClass().getResource(wsdlLocation);
+        assertNotNull("Could not find wsdl " + url.toString(), url);
+
+        WSDLFactory factory = WSDLFactory.newInstance();
+        WSDLReader reader = factory.newWSDLReader();
+        reader.setFeature("javax.wsdl.verbose", false);
+        InputSource input = new InputSource(url.openStream());
+        Definition wsdlDef = reader.readWSDL(url.toString(), input);
+        Service wsdlService = wsdlDef.getService(new QName(
+                "http://objectweb.org/hello_world_soap_http", "SOAPService"));
+        Port port = wsdlService.getPort("SoapPort");
+
+        CeltixInvoker invoker = new CeltixInvoker(operationName, bus, port,
+                wsdlService, wsdlDef);
+        return invoker;
+    }
+
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixInvokerTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,99 @@
+package org.apache.tuscany.binding.celtix;
+
+import java.net.URL;
+
+import org.xml.sax.InputSource;
+
+import junit.framework.TestCase;
+import org.easymock.classextension.EasyMock;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.Service;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+
+import org.apache.tuscany.spi.wire.WireService;
+import org.apache.tuscany.spi.wire.InboundWire;
+
+import org.objectweb.celtix.Bus;
+import org.objectweb.celtix.bindings.DataBindingCallback;
+import org.objectweb.celtix.bindings.ServerDataBindingCallback;
+import org.objectweb.celtix.bindings.ServerBindingEndpointCallback;
+import org.objectweb.celtix.bus.bindings.WSDLMetaDataCache;
+import org.objectweb.celtix.bus.bindings.WSDLOperationInfo;
+import org.objectweb.celtix.bus.bindings.soap.SOAPServerBinding;
+import org.objectweb.celtix.bus.bindings.soap.SOAPBindingFactory;
+import org.objectweb.celtix.bindings.BindingManager;
+import org.objectweb.celtix.context.ObjectMessageContextImpl;
+import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
+import org.apache.tuscany.binding.celtix.io.SCADataBindingCallback;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CeltixServiceTestCase extends TestCase {
+
+    public void testGetDataBindingCallback() throws Exception {
+        //Make following call to return a mocked SOAPClientBinding:
+        //bus.getBindingManager().getBindingFactory(bindingId).createClientBinding(reference)
+        SOAPServerBinding serverBinding = EasyMock.createMock(SOAPServerBinding.class);
+        serverBinding.activate();
+        EasyMock.replay(serverBinding);
+
+        ServerBindingEndpointCallback callback = EasyMock.createNiceMock(ServerBindingEndpointCallback.class);
+
+        SOAPBindingFactory bindingFactory = EasyMock.createNiceMock(SOAPBindingFactory.class);
+        bindingFactory.createServerBinding(EasyMock.isA(EndpointReferenceType.class),
+                                           EasyMock.isA(ServerBindingEndpointCallback.class));
+        EasyMock.expectLastCall().andReturn(serverBinding);
+        EasyMock.replay(bindingFactory);
+
+        BindingManager bindingManager = EasyMock.createNiceMock(BindingManager.class);
+        String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
+        bindingManager.getBindingFactory(bindingId);
+        EasyMock.expectLastCall().andReturn(bindingFactory);
+
+        Bus bus = EasyMock.createNiceMock(Bus.class);
+        bus.getBindingManager();
+        EasyMock.expectLastCall().andReturn(bindingManager);
+        EasyMock.replay(bindingManager);
+        EasyMock.replay(bus);
+
+        WireService wireService = EasyMock.createNiceMock(WireService.class);
+        wireService.createProxy(EasyMock.isA(InboundWire.class));
+        EasyMock.expectLastCall().andReturn(null);
+        EasyMock.replay(wireService);
+
+        //Create WSDL Definition
+        String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
+        URL url = getClass().getResource(wsdlLocation);
+        assertNotNull("Could not find wsdl " + url.toString(), url);
+
+        WSDLFactory factory = WSDLFactory.newInstance();
+        WSDLReader reader = factory.newWSDLReader();
+        reader.setFeature("javax.wsdl.verbose", false);
+        InputSource input = new InputSource(url.openStream());
+        Definition wsdlDef = reader.readWSDL(url.toString(), input);
+        Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
+                                                           "SOAPService"));
+        Port port = wsdlService.getPort("SoapPort");
+
+        InboundWire inboundWire = EasyMock.createNiceMock(InboundWire.class);
+        inboundWire.getBusinessInterface();
+        EasyMock.expectLastCall().andReturn(Greeter.class).anyTimes();
+
+        EasyMock.replay(inboundWire);
+
+        CeltixService celtixService = new CeltixService("name", wsdlDef, port, wsdlService, null, bus, wireService);
+        celtixService.setInboundWire(inboundWire);
+        celtixService.start();
+
+        QName operationName = new QName("greetMe");
+     	ServerDataBindingCallback callback1 = celtixService.getDataBindingCallback(operationName, new ObjectMessageContextImpl(), DataBindingCallback.Mode.PARTS);
+        assertNotNull(callback1);
+    }
+
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java Wed Jul 12 07:01:56 2006
@@ -0,0 +1,14 @@
+package org.apache.tuscany.binding.celtix;
+
+public interface Greeter {
+    public java.lang.String sayHi();
+
+    public java.lang.String greetMe(
+        java.lang.String requestType
+    );
+
+    public void greetMeOneWay(
+        java.lang.String requestType
+    );
+
+}

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/Greeter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit.wsdl?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit.wsdl (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit.wsdl Wed Jul 12 07:01:56 2006
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://objectweb.org/hello_world_soap_http"
+    xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType/>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="short"/>
+                        <element name="major" type="short"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMeResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+       
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+

Added: incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl?rev=421273&view=auto
==============================================================================
--- incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl (added)
+++ incubator/tuscany/sandbox/chianti/sca/bindings/binding.celtix/src/test/resources/wsdl/hello_world_doc_lit_inout.wsdl Wed Jul 12 07:01:56 2006
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="HelloWorld" targetNamespace="http://objectweb.org/hello_world_soap_http" 
+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://objectweb.org/hello_world_soap_http"
+    xmlns:x1="http://objectweb.org/hello_world_soap_http/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    <wsdl:types>
+        <schema targetNamespace="http://objectweb.org/hello_world_soap_http/types" 
+            xmlns="http://www.w3.org/2001/XMLSchema"
+	    xmlns:tns="http://objectweb.org/hello_world_soap_http/types"
+            elementFormDefault="qualified">
+	    <simpleType name="MyStringType">
+		<restriction base="string">
+		    <maxLength value="30" />
+		</restriction>
+	    </simpleType>
+
+            <element name="sayHi">
+                <complexType/>
+            </element>
+            <element name="sayHiResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMe">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="tns:MyStringType"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeResponse">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="greetMeOneWay">
+                <complexType>
+                    <sequence>
+                        <element name="requestType" type="string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            <element name="pingMe">
+                <complexType/>
+            </element>
+            <element name="pingMeResponse">
+                <complexType/>
+            </element>
+            <element name="faultDetail">
+                <complexType>
+                    <sequence>
+                        <element name="minor" type="short"/>
+                        <element name="major" type="short"/>
+                    </sequence>
+                </complexType>
+            </element>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="sayHiRequest">
+        <wsdl:part element="x1:sayHi" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="sayHiResponse">
+        <wsdl:part element="x1:sayHiResponse" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeRequest">
+        <wsdl:part element="x1:greetMe" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeResponse">
+        <wsdl:part element="x1:greetMe" name="out"/>
+    </wsdl:message>
+    <wsdl:message name="greetMeOneWayRequest">
+        <wsdl:part element="x1:greetMeOneWay" name="in"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeRequest">
+        <wsdl:part name="in" element="x1:pingMe"/>
+    </wsdl:message>
+    <wsdl:message name="pingMeResponse">
+        <wsdl:part name="out" element="x1:pingMeResponse"/>
+    </wsdl:message>		
+    <wsdl:message name="pingMeFault">
+        <wsdl:part name="faultDetail" element="x1:faultDetail"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="Greeter">
+        <wsdl:operation name="sayHi">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+            <wsdl:output message="tns:sayHiResponse" name="sayHiResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <wsdl:input message="tns:greetMeRequest" name="greetMeRequest"/>
+            <wsdl:output message="tns:greetMeResponse" name="greetMeResponse"/>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <wsdl:input message="tns:greetMeOneWayRequest" name="greetMeOneWayRequest"/>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <wsdl:input name="pingMeRequest" message="tns:pingMeRequest"/>
+            <wsdl:output name="pingMeResponse" message="tns:pingMeResponse"/>
+            <wsdl:fault name="pingMeFault" message="tns:pingMeFault"/>
+        </wsdl:operation> 
+    </wsdl:portType>
+    <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="sayHiRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="sayHiResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMe">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="greetMeResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+        <wsdl:operation name="greetMeOneWay">
+            <soap:operation soapAction="" style="document"/>
+            <wsdl:input name="greetMeOneWayRequest">
+                <soap:body use="literal"/>
+            </wsdl:input>
+        </wsdl:operation>
+
+        <wsdl:operation name="pingMe">
+            <soap:operation style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="pingMeFault">
+                <soap:fault name="pingMeFault" use="literal"/>
+            </wsdl:fault>
+        </wsdl:operation>
+        
+    </wsdl:binding>
+    <wsdl:service name="SOAPService">
+        <wsdl:port binding="tns:Greeter_SOAPBinding" name="SoapPort">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>
+



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org