cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r440307 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/wsdl/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/ap...
Date Tue, 05 Sep 2006 09:41:06 GMT
Author: mmao
Date: Tue Sep  5 02:41:04 2006
New Revision: 440307

URL: http://svn.apache.org/viewvc?view=rev&rev=440307
Log:
* Support Added JAS-WS Provider implementation

* The Endpoint now can differentiate the SEI and Provider.
* The Provider create it's own in/out chain, remove the binding interceptors and skip the interceptors not required.
* Support SOAP/HTTP message/payload (XML/HTTP not finished yet)
* Support DOMSource/SAXSource/StreamSource/JAXBContext

* If the service model can not be built, now we just fake one.

* Get the service.mode and type info from the exchange instead of message itself, so the in/out message can share the same info.

* Added the system test which based on DocLit Wrapped style, commented out the RPC style, which not work yet in the rt.


Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourceMessageProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourceMessageProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourceMessageProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourcePayloadProvider.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/ProviderClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralReq.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeDocLiteralResp.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/GreetMeRpcLiteralResp.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/sayHiDocLiteralReq.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/sayHiDocLiteralResp.xml
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/resources/sayHiRpcLiteralResp.xml
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxwsImplementorInfo.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Tue Sep  5 02:41:04 2006
@@ -115,13 +115,7 @@
                                              String portName) 
         throws WebServiceException {
         if (null != serviceName) {
-            ServiceNameType serviceNameType = new ServiceNameType();
-            serviceNameType.setValue(serviceName);
-            serviceNameType.setEndpointName(portName);
-            org.apache.cxf.ws.addressing.wsdl.ObjectFactory objectFactory = 
-                new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
-            JAXBElement<ServiceNameType> jaxbElement = objectFactory.createServiceName(serviceNameType);
-
+            JAXBElement<ServiceNameType> jaxbElement = getServiceNameType(serviceName, portName);
             MetadataType mt = ref.getMetadata();
             if (null == mt) {
                 mt = new MetadataType();
@@ -130,6 +124,15 @@
 
             mt.getAny().add(jaxbElement);
         }
+    }
+    
+    public static JAXBElement<ServiceNameType> getServiceNameType(QName serviceName, String portName) {
+        ServiceNameType serviceNameType = new ServiceNameType();
+        serviceNameType.setValue(serviceName);
+        serviceNameType.setEndpointName(portName);
+        org.apache.cxf.ws.addressing.wsdl.ObjectFactory objectFactory = 
+            new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
+        return objectFactory.createServiceName(serviceNameType);
     }
     
     /**

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Tue Sep  5 02:41:04 2006
@@ -35,7 +35,6 @@
 import javax.wsdl.extensions.soap.SOAPOperation;
 import javax.xml.namespace.QName;
 
-
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
@@ -51,6 +50,7 @@
 import org.apache.cxf.binding.soap.model.SoapBodyInfo;
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.interceptor.BareInInterceptor;
 import org.apache.cxf.interceptor.BareOutInterceptor;
 import org.apache.cxf.interceptor.StaxInInterceptor;
@@ -67,16 +67,16 @@
 public class SoapBindingFactory extends AbstractBindingFactory {
 
     private Map cachedBinding = new HashMap<BindingInfo, Binding>();
-    
+
     @Resource
     private Bus bus;
-    
+
     @Resource
     private Collection<String> activationNamespaces;
-    
+
     @PostConstruct
     void registerSelf() {
-        if (null == bus) { 
+        if (null == bus) {
             return;
         }
         BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
@@ -86,24 +86,38 @@
             }
         }
     }
-     
+
     public Binding createBinding(BindingInfo binding) {
-        
+
         if (cachedBinding.get(binding) != null) {
             return (Binding)cachedBinding.get(binding);
         }
-        
+
+        // TODO what about the mix style/use?
+
+        // The default style should be doc-lit wrapped.
+        String parameterStyle = SoapConstants.PARAMETER_STYLE_WRAPPED;
+        String bindingStyle = SoapConstants.BINDING_STYLE_DOC;
+
         SoapBinding sb = new SoapBinding();
-        SoapBindingInfo sbi = (SoapBindingInfo)binding;
-                
-        for (BindingOperationInfo boi : sbi.getOperations()) {
-            if (boi.getUnwrappedOperation() == null) {
-                sbi.setStyle(SoapConstants.STYLE_BARE);
+        if (binding instanceof SoapBindingInfo) {
+            SoapBindingInfo sbi = (SoapBindingInfo)binding;
+            // Service wide style
+            if (!StringUtils.isEmpty(sbi.getStyle())) {
+                bindingStyle = sbi.getStyle();
+            }
+
+            // Operation wide style, what to do with the mixed style/use?
+            for (BindingOperationInfo boi : sbi.getOperations()) {
+                bindingStyle = sbi.getStyle(boi.getOperationInfo());
+                if (boi.getUnwrappedOperation() == null) {
+                    parameterStyle = SoapConstants.PARAMETER_STYLE_BARE;
+                }
             }
         }
-        
-        sb.getInInterceptors().add(new MultipartMessageInterceptor());        
-        sb.getInInterceptors().add(new ReadHeadersInterceptor());        
+
+        sb.getInInterceptors().add(new MultipartMessageInterceptor());
+        sb.getInInterceptors().add(new ReadHeadersInterceptor());
         sb.getInInterceptors().add(new MustUnderstandInterceptor());
         sb.getInInterceptors().add(new StaxInInterceptor());
 
@@ -115,19 +129,19 @@
         sb.getOutFaultInterceptors().add(new SoapOutInterceptor());
         sb.getOutFaultInterceptors().add(sb.getOutFaultInterceptor());
 
-        if (SoapConstants.STYLE_RPC.equalsIgnoreCase(sbi.getStyle())) {
+        if (SoapConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
             sb.getInInterceptors().add(new RPCInInterceptor());
             sb.getOutInterceptors().add(new RPCOutInterceptor());
-        } else if (SoapConstants.STYLE_BARE.equalsIgnoreCase(sbi.getStyle())) {
+        } else if (SoapConstants.BINDING_STYLE_DOC.equalsIgnoreCase(bindingStyle)
+                   && SoapConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle)) {
             sb.getInInterceptors().add(new BareInInterceptor());
             sb.getOutInterceptors().add(new BareOutInterceptor());
         } else {
             sb.getInInterceptors().add(new WrappedInInterceptor());
             sb.getOutInterceptors().add(new WrappedOutInterceptor());
             sb.getOutInterceptors().add(new BareOutInterceptor());
-        }        
-        
-                
+        }
+
         return sb;
     }
 
@@ -152,7 +166,7 @@
 
     private void initializeBindingOperation(SoapBindingInfo bi, BindingOperationInfo boi) {
         SoapOperationInfo soi = new SoapOperationInfo();
-        
+
         SOAPOperation soapOp = boi.getExtensor(SOAPOperation.class);
         if (soapOp != null) {
             String action = soapOp.getSoapActionURI();
@@ -162,8 +176,7 @@
 
             soi.setAction(action);
             soi.setStyle(soapOp.getStyle());
-            
-            
+
         }
 
         boi.addExtensor(soi);

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapConstants.java Tue Sep  5 02:41:04 2006
@@ -20,8 +20,14 @@
 package org.apache.cxf.binding.soap;
 
 public class SoapConstants {
-    public static final String STYLE_RPC = "rpc";
-    public static final String STYLE_BARE = "bare";
-    public static final String STYLE_WRAPPED = "wrapped";
+    public static final String BINDING_STYLE_RPC = "rpc";
+    public static final String BINDING_STYLE_DOC = "document";
+    
+    public static final String PARAMETER_STYLE_BARE = "bare";
+    public static final String PARAMETER_STYLE_WRAPPED = "wrapped";
+    
+//    public static final String STYLE_RPC = "rpc";
+//    public static final String STYLE_BARE = "bare";
+//    public static final String STYLE_WRAPPED = "wrapped";
     public static final String ACTION = "action";
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java Tue Sep  5 02:41:04 2006
@@ -19,9 +19,17 @@
 
 package org.apache.cxf.binding.soap.interceptor;
 
-import org.apache.cxf.interceptor.WrappedOutInterceptor;
+import org.apache.cxf.interceptor.WrappedOutInterceptor;
 
-public class RPCOutInterceptor extends WrappedOutInterceptor {
+public class RPCOutInterceptor extends WrappedOutInterceptor {
+    
+//    public void handleMessage(SoapMessage message) {
+//        BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+//        OperationInfo opInfo = bop.getOperationInfo();
+//        OperationInfo unwrapped = new UnwrappedOperationInfo(opInfo);
+//        opInfo.setUnwrappedOperation(unwrapped);
+//        unwrapped.setInput(opInfo.getInputName(), unwrappedInput);
+//    }
 //    
 //    private NSStack nsStack;
 //    

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java Tue Sep  5 02:41:04 2006
@@ -24,7 +24,6 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.ChainInitiationObserver;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
@@ -36,7 +35,7 @@
     private MessageObserver messageObserver;
     private Endpoint endpoint;
 
-    public ServerImpl(Bus bus, Endpoint endpoint, ChainInitiationObserver observer) 
+    public ServerImpl(Bus bus, Endpoint endpoint, MessageObserver observer) 
         throws BusException, IOException {
         this.endpoint = endpoint;
         this.messageObserver = observer;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareOutInterceptor.java Tue Sep  5 02:41:04 2006
@@ -39,12 +39,15 @@
         setPhase(Phase.MARSHAL);
     }
 
-    public void handleMessage(Message message) {
-        XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
-
+    public void handleMessage(Message message) {      
         Exchange exchange = message.getExchange();
         BindingOperationInfo operation = (BindingOperationInfo)exchange.get(BindingOperationInfo.class
             .getName());
+        
+        if (operation == null) {
+            return;
+        }
+        
         DataWriter<XMLStreamWriter> dataWriter = getDataWriter(message);
 
         int countParts = 0;
@@ -65,7 +68,7 @@
                 message.setContent(Exception.class,
                                    new RuntimeException("The number of arguments is not equal!"));
             }
-
+            XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
             for (int idx = 0; idx < countParts; idx++) {
                 Object arg = args[idx];
                 MessagePartInfo part = (MessagePartInfo)els[idx];

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java Tue Sep  5 02:41:04 2006
@@ -40,8 +40,10 @@
         
         if (out != null) {
             BindingOperationInfo bin = ex.get(BindingOperationInfo.class);
-            out.put(MessageInfo.class, bin.getOperationInfo().getOutput());
-            out.put(BindingMessageInfo.class, bin.getOutput());
+            if (bin != null) {
+                out.put(MessageInfo.class, bin.getOperationInfo().getOutput());
+                out.put(BindingMessageInfo.class, bin.getOutput());
+            }
             out.getInterceptorChain().doIntercept(out);
         }
     }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java Tue Sep  5 02:41:04 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.interceptor;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Executor;
@@ -54,24 +53,30 @@
         getExecutor(endpoint).execute(new Runnable() {
 
             public void run() {
-                Object result = invoker.invoke(message.getExchange(), 
-                    message.getContent(List.class));
+
+                Object result = invoker.invoke(message.getExchange(), getInvokee(message));
 
                 if (result != null) {
-                    if (!(result instanceof List)) {
-                        if (result.getClass().isArray()) {
-                            result = Arrays.asList((Object[])result);
-                        } else {
-                            List<Object> o = new ArrayList<Object>();
-                            o.add(result);
-                            result = o;
-                        }
-                    }
-                    exchange.getOutMessage().setContent(List.class, result);
+                    if (result instanceof List) {
+                        exchange.getOutMessage().setContent(List.class, result);
+                    } else if (result.getClass().isArray()) {
+                        result = Arrays.asList((Object[])result);
+                        exchange.getOutMessage().setContent(List.class, result);
+                    } else {
+                        exchange.getOutMessage().setContent(Object.class, result);
+                    }                    
                 }
             }
 
         });
+    }
+    
+    private Object getInvokee(Message message) {
+        Object invokee = message.getContent(List.class);
+        if (invokee == null) {
+            invokee = message.getContent(Object.class);
+        }
+        return invokee;
     }
 
     /**

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/StaxOutInterceptor.java Tue Sep  5 02:41:04 2006
@@ -46,7 +46,10 @@
     public void handleMessage(Message message) {
         OutputStream os = message.getContent(OutputStream.class);
 
-        assert os != null;
+        if (os == null) {
+            return;
+        }
+        // assert os != null;
 
         // TODO: where does encoding constant go?
         String encoding = (String)message.get("Encoding");

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/WrappedOutInterceptor.java Tue Sep  5 02:41:04 2006
@@ -43,7 +43,7 @@
 
     public void handleMessage(Message message) {
         BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
-        if (bop.isUnwrapped()) {
+        if (bop != null && bop.isUnwrapped()) {
             XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
 
             MessageInfo messageInfo = message.get(MessageInfo.class);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Tue Sep  5 02:41:04 2006
@@ -37,6 +37,8 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.ServiceImpl;
 import org.apache.cxf.service.invoker.Invoker;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -100,9 +102,18 @@
 
             initializeWSDLOperations();
         } else {
+            // If we can't find the wsdlLocation, then we should build a faked service model .            
             ServiceInfo serviceInfo = new ServiceInfo();
             serviceInfo.setName(getServiceQName());
+            
+            BindingInfo bi = new BindingInfo(serviceInfo, getBindingType());          
 
+            EndpointInfo ei = new EndpointInfo(serviceInfo, bi.getBindingId());
+            ei.setName(getPortQName());
+            ei.setBinding(bi);
+            
+            serviceInfo.addEndpoint(ei);
+            
             createInterface(serviceInfo);
 
             ServiceImpl service = new ServiceImpl(serviceInfo);
@@ -243,6 +254,16 @@
         }
 
         return serviceName;
+    }
+    
+    protected QName getPortQName() {
+        // TO be override
+        return null;
+    }
+    
+    protected String getBindingType() {
+        // to be override
+        return null;
     }
 
     protected QName getInterfaceName() {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Tue Sep  5 02:41:04 2006
@@ -93,13 +93,15 @@
             LOG.info("Dispatch: invoke called");
         }
 
-        Message message = endpoint.getBinding().createMessage();
-        message.setContent(Service.Mode.class, mode);
+        Message message = endpoint.getBinding().createMessage();        
+        
         if (context != null) {
             message.setContent(JAXBContext.class, context);
         }
 
         Exchange exchange = new ExchangeImpl();
+        exchange.put(Service.Mode.class, mode);
+        exchange.put(Class.class, cl);
         exchange.put(org.apache.cxf.service.Service.class, endpoint.getService());
 
         exchange.setOutMessage(message);
@@ -179,8 +181,8 @@
     public void onMessage(Message message) {
         message = endpoint.getBinding().createMessage(message);
 
-        message.setContent(Service.Mode.class, mode);
-        message.setContent(Class.class, cl);
+        //message.setContent(Service.Mode.class, mode);
+        //message.setContent(Class.class, cl);
         message.put(Message.REQUESTOR_ROLE, Boolean.TRUE);
 
         PhaseManager pm = bus.getExtension(PhaseManager.class);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Tue Sep  5 02:41:04 2006
@@ -29,6 +29,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
+import javax.xml.ws.Provider;
 import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.Bus;
@@ -42,12 +43,13 @@
 import org.apache.cxf.service.invoker.SimpleMethodInvoker;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.MessageObserver;
 
 public class EndpointImpl extends javax.xml.ws.Endpoint {
-    
+
     private static final Logger LOG = LogUtils.getL7dLogger(JaxWsServiceFactoryBean.class);
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
-    
+
     private Bus bus;
     // private String bindingURI;
     private Object implementor;
@@ -55,36 +57,43 @@
     private Service service;
     private JaxwsEndpointImpl endpoint;
     
+    private JaxwsImplementorInfo implInfo;
+
+    @SuppressWarnings("unchecked")
     public EndpointImpl(Bus b, Object i, String uri) {
         bus = b;
         implementor = i;
         // bindingURI = uri;
-        
+
+        implInfo = new JaxwsImplementorInfo(implementor.getClass());
         // build up the Service model
-        JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
+        JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean(implInfo);
         serviceFactory.setServiceClass(implementor.getClass());
         serviceFactory.setBus(bus);
         service = serviceFactory.create();
-        
-        // create the endpoint
-        JaxwsImplementorInfo implInfo = new JaxwsImplementorInfo(implementor.getClass());
+
+        // create the endpoint        
         QName endpointName = implInfo.getEndpointName();
         EndpointInfo ei = service.getServiceInfo().getEndpoint(endpointName);
-        //TODO - need a jaxws specific invoker for holders and such
-        service.setInvoker(new SimpleMethodInvoker(i));
-        // TODO: use bindigURI
-        endpoint = new JaxwsEndpointImpl(bus, service, ei);                
+
+        if (implInfo.isWebServiceProvider()) {
+            service.setInvoker(new ProviderInvoker((Provider<?>)i));
+        } else {
+            //TODO - need a jaxws specific invoker for holders and such
+            service.setInvoker(new SimpleMethodInvoker(i));
+        }
+        //      TODO: use bindigURI     
+        endpoint = new JaxwsEndpointImpl(bus, service, ei);
     }
-    
-    
+
     public Binding getBinding() {
         return endpoint.getJaxwsBinding();
     }
 
     public void setExecutor(Executor executor) {
-        server.getEndpoint().getService().setExecutor(executor);        
+        server.getEndpoint().getService().setExecutor(executor);
     }
-    
+
     public Executor getExecutor() {
         return server.getEndpoint().getService().getExecutor();
     }
@@ -114,7 +123,7 @@
     @Override
     public void publish(Object arg0) {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
@@ -124,13 +133,13 @@
 
     public void setMetadata(List<Source> arg0) {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
     public void setProperties(Map<String, Object> arg0) {
         // TODO Auto-generated method stub
-        
+
     }
 
     @Override
@@ -139,18 +148,23 @@
             server.stop();
         }
     }
-    
+
     public ServerImpl getServer() {
         return server;
-    } 
-    
+    }
+
     protected void doPublish(String address) {
         if (null != address) {
             endpoint.getEndpointInfo().setAddress(address);
         }
-        
+
         try {
-            ChainInitiationObserver observer = new ChainInitiationObserver(endpoint, bus); 
+            MessageObserver observer = null;
+            if (implInfo.isWebServiceProvider()) {
+                observer = new ProviderChainObserver(endpoint, bus, implInfo);
+            } else {
+                observer = new ChainInitiationObserver(endpoint, bus);
+            }       
             server = new ServerImpl(bus, endpoint, observer);
             server.start();
         } catch (BusException ex) {
@@ -158,6 +172,6 @@
         } catch (IOException ex) {
             throw new WebServiceException(BUNDLE.getString("FAILED_TO_PUBLISH_ENDPOINT_EXC"), ex);
         }
-        
+
     }
 }

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderChainObserver.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.jaxws;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.interceptors.DispatchInInterceptor;
+import org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor;
+import org.apache.cxf.jaxws.support.JaxwsImplementorInfo;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.transport.MessageObserver;
+
+public class ProviderChainObserver implements MessageObserver {
+
+    Endpoint endpoint;
+    Bus bus;
+    JaxwsImplementorInfo implInfo;
+
+    public ProviderChainObserver(Endpoint endpoint, Bus bus, JaxwsImplementorInfo implInfo) {
+        super();
+        this.endpoint = endpoint;
+        this.bus = bus;
+        this.implInfo = implInfo;
+    }
+
+    public void onMessage(Message m) {
+        Message message = endpoint.getBinding().createMessage(m);
+        Exchange exchange = new ExchangeImpl();
+        exchange.setInMessage(message);
+        message.setExchange(exchange);
+
+        // message.setContent(Class.class, implInfo.getProviderParameterType());
+        // message.setContent(javax.xml.ws.Service.Mode.class,
+        // implInfo.getServiceMode());
+
+        exchange.put(javax.xml.ws.Service.Mode.class, implInfo.getServiceMode());
+        exchange.put(Class.class, implInfo.getProviderParameterType());
+
+        exchange.put(Endpoint.class, endpoint);
+        exchange.put(Service.class, endpoint.getService());
+        exchange.put(Binding.class, endpoint.getBinding());
+        exchange.put(Bus.class, bus);
+        exchange.setDestination(m.getDestination());
+
+        // setup chain
+        PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
+            .getInPhases());
+
+        message.setInterceptorChain(chain);
+        chain.add(bus.getInInterceptors());
+        chain.add(endpoint.getInInterceptors());
+
+        // Modified the binding in interceptors
+        endpoint.getBinding().getInInterceptors().clear();
+        endpoint.getBinding().getInInterceptors().add(new DispatchInInterceptor());
+        chain.add(endpoint.getBinding().getInInterceptors());
+        // Modified the binding out interceptors
+        endpoint.getBinding().getOutInterceptors().clear();
+        endpoint.getBinding().getOutInterceptors().add(new DispatchOutInterceptor());
+        chain.add(endpoint.getBinding().getOutInterceptors());
+
+        chain.add(endpoint.getService().getInInterceptors());
+        chain.setFaultInterceptor(endpoint.getFaultInterceptor());
+
+        chain.doIntercept(message);
+
+    }
+
+}

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ProviderInvoker.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.jaxws;
+
+import javax.xml.ws.Provider;
+
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.service.invoker.Invoker;
+
+public class ProviderInvoker<T> implements Invoker {
+
+    private Provider<T> provider;
+
+    public ProviderInvoker(Provider<T> p) {
+        super();
+        this.provider = p;
+    }
+
+    @SuppressWarnings("unchecked")
+    public Object invoke(Exchange exchange, Object o) {
+
+        if (provider != null) {
+            return (T)provider.invoke((T)o);
+        } else {
+            System.err.println("TODO: Should return fault instead of null");
+            return null;
+        }
+    }
+}

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Sep  5 02:41:04 2006
@@ -37,9 +37,9 @@
 import javax.xml.ws.Dispatch;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebServiceException;
+
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.ws.spi.ServiceDelegate;
-
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.Message;

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java Tue Sep  5 02:41:04 2006
@@ -50,18 +50,17 @@
 
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {
-        Service.Mode m = message.getContent(Service.Mode.class);
-        
-        Class type = message.getContent(Class.class);
-                
+        Service.Mode m = message.getExchange().get(Service.Mode.class);
+        Class type = message.getExchange().get(Class.class);
+
         try {
             resetContext(message);
-            
+
             InputStream is = message.getContent(InputStream.class);
 
-            if (message instanceof SoapMessage) {               
+            if (message instanceof SoapMessage) {
                 SOAPMessage soapMessage = newSOAPMessage(is, ((SoapMessage)message).getVersion());
-                
+
                 if (m == Service.Mode.MESSAGE) {
                     DataReader<SOAPMessage> dataReader = getDataReader(message, SOAPMessage.class);
                     message.setContent(Object.class, dataReader.read(null, soapMessage, type));
@@ -75,19 +74,19 @@
             e.printStackTrace();
         }
     }
-    
+
     private void resetContext(Message message) throws JAXBException {
         JAXBContext context = message.getContent(JAXBContext.class);
         if (context != null) {
-            org.apache.cxf.service.Service service = message.
-            getExchange().get(org.apache.cxf.service.Service.class);
+            org.apache.cxf.service.Service service = message.getExchange()
+                .get(org.apache.cxf.service.Service.class);
             JAXBDataBinding dataBinding = new JAXBDataBinding();
             dataBinding.setContext(context);
             service.setDataReaderFactory(dataBinding.getDataReaderFactory());
             service.setDataWriterFactory(dataBinding.getDataWriterFactory());
         }
     }
-    
+
     private SOAPMessage newSOAPMessage(InputStream is, SoapVersion version) throws Exception {
         // TODO: Get header from message, this interceptor should after
         // readHeadersInterceptor
@@ -99,6 +98,6 @@
         } else if (version instanceof Soap12) {
             msgFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
         }
-        return msgFactory.createMessage(headers, is);        
+        return msgFactory.createMessage(headers, is);
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java Tue Sep  5 02:41:04 2006
@@ -50,7 +50,7 @@
 
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {
-        Service.Mode m = message.getContent(Service.Mode.class);
+        Service.Mode m = message.getExchange().get(Service.Mode.class);
 
         try {
             OutputStream os = message.getContent(OutputStream.class);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Tue Sep  5 02:41:04 2006
@@ -30,12 +30,14 @@
 import javax.jws.WebService;
 import javax.wsdl.WSDLException;
 import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
 
 import org.apache.cxf.BusException;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -51,30 +53,37 @@
 
     private static final Logger LOG = LogUtils.getL7dLogger(JaxWsServiceFactoryBean.class);
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
-    
+
     Class<?> seiClass;
     JAXBDataBinding dataBinding;
-    
+
+    JaxwsImplementorInfo implInfo;
+
     public JaxWsServiceFactoryBean() {
         super();
         getServiceConfigurations().add(new JaxWsServiceConfiguration());
     }
 
+    public JaxWsServiceFactoryBean(JaxwsImplementorInfo i) {
+        this();
+        this.implInfo = i;
+    }
+
     public void activateEndpoints() throws IOException, WSDLException, BusException {
         Service service = getService();
-        
+
         for (EndpointInfo ei : service.getServiceInfo().getEndpoints()) {
             activateEndpoint(service, ei);
         }
     }
 
-    public void activateEndpoint(Service service, EndpointInfo ei) 
-        throws BusException, WSDLException, IOException {
+    public void activateEndpoint(Service service, EndpointInfo ei) throws BusException, WSDLException,
+        IOException {
         JaxwsEndpointImpl ep = new JaxwsEndpointImpl(getBus(), service, ei);
         ChainInitiationObserver observer = new ChainInitiationObserver(ep, getBus());
-        
+
         ServerImpl server = new ServerImpl(getBus(), ep, observer);
-        
+
         server.start();
     }
 
@@ -96,7 +105,7 @@
     @Override
     public void setServiceClass(Class<?> serviceClass) {
         super.setServiceClass(serviceClass);
-        
+
         try {
             dataBinding = new JAXBDataBinding(serviceClass);
         } catch (JAXBException e) {
@@ -105,43 +114,65 @@
         }
         setDataReaderFactory(dataBinding.getDataReaderFactory());
         setDataWriterFactory(dataBinding.getDataWriterFactory());
-        
+
         // update wsdl location
-        
         // TODO: replace version in EndpointreferenceUtils?
-        
+        String wsdlLocation = null;
         WebService ws = serviceClass.getAnnotation(WebService.class);
-        if (null == ws) {
-            // endpoint must be a provider type endpoint 
-            // TODO: get wsdl location from WwebServiceProvider annotation
-            // return;
-        }
-        
-        String sei = ws.endpointInterface();
-        if (null != sei && !"".equals(sei)) {
-            try {
-                seiClass = ClassLoaderUtils.loadClass(sei, serviceClass);
-            } catch (ClassNotFoundException ex) {
-                throw new WebServiceException(BUNDLE.getString("SEI_LOAD_FAILURE_MSG"), ex);
-            }
-            ws = seiClass.getAnnotation(WebService.class);
-            if (null == ws) {
-                throw new WebServiceException(BUNDLE.getString("SEI_WITHOUT_WEBSERVICE_ANNOTATION_EXC"));
+        if (null == ws && implInfo != null && implInfo.isWebServiceProvider()) {
+            WebServiceProvider wsProvider = implInfo.getWsProvider();
+            wsdlLocation = wsProvider.wsdlLocation();
+        } else {
+            wsdlLocation = ws.wsdlLocation();
+
+            String sei = ws.endpointInterface();
+            if (null != sei && !"".equals(sei)) {
+                try {
+                    seiClass = ClassLoaderUtils.loadClass(sei, serviceClass);
+                } catch (ClassNotFoundException ex) {
+                    throw new WebServiceException(BUNDLE.getString("SEI_LOAD_FAILURE_MSG"), ex);
+                }
+                ws = seiClass.getAnnotation(WebService.class);
+                if (null == ws) {
+                    throw new WebServiceException(BUNDLE.getString("SEI_WITHOUT_WEBSERVICE_ANNOTATION_EXC"));
+                }
             }
         }
-        if (null != ws.wsdlLocation() && !"".equals(ws.wsdlLocation())) {
-            
+
+        if (!StringUtils.isEmpty(wsdlLocation)) {
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.fine("Setting wsdl location to:  " + ws.wsdlLocation());
             }
+
+            URL url = null;
             try {
-                setWsdlURL(new URL(ws.wsdlLocation()));
+                url = new URL(wsdlLocation);
             } catch (MalformedURLException ex) {
-                Message msg = new Message("MALFORMED_URL_IN_WEBSERVICE_ANNOTATION_EXC", 
-                                          BUNDLE, ws.wsdlLocation());
-                throw new WebServiceException(msg.toString(), ex);                
+                // LOG a warning instead of throw exception.
+                //url = implInfo.getImplementorClass().getResource(wsdlLocation);
+                if (url == null) {
+                    System.err.println("Can't resolve the wsdl location " + wsdlLocation);
+                }
             }
+            setWsdlURL(url);
+        }
+    }
+
+    protected QName getServiceQName() {
+        QName qname = null;
+        try {
+            qname = super.getServiceQName();
+        } catch (Exception e) {
+            qname = implInfo.getServiceName();
         }
-    }  
-    
+        return qname;
+    }
+
+    protected QName getPortQName() {
+        return implInfo.getEndpointName();
+    }
+
+    protected String getBindingType() {
+        return implInfo.getBindingType();
+    }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxwsImplementorInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxwsImplementorInfo.java?view=diff&rev=440307&r1=440306&r2=440307
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxwsImplementorInfo.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxwsImplementorInfo.java Tue Sep  5 02:41:04 2006
@@ -19,15 +19,25 @@
 
 package org.apache.cxf.jaxws.support;
 
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
 import javax.jws.WebService;
 import javax.xml.namespace.QName;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.soap.SOAPBinding;
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.jaxb.JAXBEncoderDecoder;
 
 public class JaxwsImplementorInfo {
 
@@ -38,11 +48,12 @@
     private Class<?> seiClass;
     private WebService implementorAnnotation;
     private WebService seiAnnotation;
+    private WebServiceProvider wsProviderAnnotation;
 
     public JaxwsImplementorInfo(Class<?> ic) {
         implementorClass = ic;
         initialise();
-    }   
+    }
 
     public Class<?> getSEIClass() {
         return seiClass;
@@ -57,6 +68,8 @@
             return seiAnnotation.wsdlLocation();
         } else if (null != implementorAnnotation) {
             return implementorAnnotation.wsdlLocation();
+        } else if (null != wsProviderAnnotation) {
+            return wsProviderAnnotation.wsdlLocation();
         }
         return null;
     }
@@ -71,12 +84,16 @@
         String namespace = null;
         if (implementorAnnotation != null) {
             serviceName = implementorAnnotation.serviceName();
-            if (null == serviceName || "".equals(serviceName)) {
-                serviceName = implementorClass.getName();
-            }
             namespace = implementorAnnotation.targetNamespace();
+        } else {
+            // Must be a provider
+            serviceName = wsProviderAnnotation.serviceName();
+            namespace = wsProviderAnnotation.targetNamespace();
+        }
+        if (StringUtils.isEmpty(serviceName)) {
+            serviceName = implementorClass.getName();
         }
-        if (null != namespace && !"".equals(namespace) && null != serviceName && !"".equals(serviceName)) {
+        if (!StringUtils.isEmpty(namespace) && !StringUtils.isEmpty(serviceName)) {
             return new QName(namespace, serviceName);
         }
         return null;
@@ -92,12 +109,18 @@
         String namespace = null;
         if (implementorAnnotation != null) {
             portName = implementorAnnotation.portName();
-            if (null == portName || "".equals(portName)) {
-                portName = implementorClass.getSimpleName();
-            }
             namespace = implementorAnnotation.targetNamespace();
+        } else {
+            // Must be a provider
+            portName = wsProviderAnnotation.portName();
+            namespace = wsProviderAnnotation.targetNamespace();
+        }
+
+        if (StringUtils.isEmpty(portName)) {
+            portName = implementorClass.getSimpleName();
         }
-        if (null != namespace && !"".equals(namespace) && null != portName && !"".equals(portName)) {
+
+        if (!StringUtils.isEmpty(namespace) && !StringUtils.isEmpty(portName)) {
             return new QName(namespace, portName);
         }
         return null;
@@ -124,11 +147,45 @@
                 if ((null != portName && !"".equals(portName))
                     || (null != serviceName && !"".equals(serviceName))
                     || (null != endpointInterface && !"".equals(endpointInterface))) {
-                    throw new WebServiceException(
-                        BUNDLE.getString("ILLEGAL_ATTRIBUTE_IN_SEI_ANNOTATION_EXC"));
+                    throw new 
+                    WebServiceException(BUNDLE.getString("ILLEGAL_ATTRIBUTE_IN_SEI_ANNOTATION_EXC"));
                 }
             }
+        } else {
+            wsProviderAnnotation = implementorClass.getAnnotation(WebServiceProvider.class);
+        }
+    }
+
+    public boolean isWebServiceProvider() {
+        return Provider.class.isAssignableFrom(implementorClass);
+    }
+
+    public WebServiceProvider getWsProvider() {
+        return wsProviderAnnotation;
+    }
+
+    public Service.Mode getServiceMode() {
+        return implementorClass.getAnnotation(ServiceMode.class).value();
+    }
+
+    public Class<?> getProviderParameterType() {
+        //The Provider Implementor inherits out of Provier<T>
+        Type intfTypes[] = implementorClass.getGenericInterfaces();
+        for (Type t : intfTypes) {
+            Class<?> clazz = JAXBEncoderDecoder.getClassFromType(t);
+            if (Provider.class == clazz) {
+                Type paramTypes[] = ((ParameterizedType)t).getActualTypeArguments();
+                return JAXBEncoderDecoder.getClassFromType(paramTypes[0]);
+            }
         }
+        return null;
     }
 
+    public String getBindingType() {
+        BindingType bType = implementorClass.getAnnotation(BindingType.class);
+        if (bType != null) {
+            return bType.value();
+        }
+        return SOAPBinding.SOAP11HTTP_BINDING;
+    }
 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourceMessageProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourceMessageProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourceMessageProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourceMessageProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Node;
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit1", serviceName = "SOAPServiceRPCLit1",
+                      targetNamespace = "http://apache.org/hello_world_rpclit",
+ wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class HWDOMSourceMessageProvider implements Provider<DOMSource> {
+
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private SOAPMessage sayHiResponse;
+    private SOAPMessage greetMeResponse;
+    private MessageFactory factory;
+
+    public HWDOMSourceMessageProvider() {
+
+        try {
+            factory = MessageFactory.newInstance();
+            InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            sayHiResponse =  factory.createMessage(null, is);
+            is.close();
+            is = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+            greetMeResponse =  factory.createMessage(null, is);
+            is.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public DOMSource invoke(DOMSource request) {
+        DOMSource response = new DOMSource();
+        try {
+            SOAPMessage msg = factory.createMessage();
+            msg.getSOAPPart().setContent(request);
+            SOAPBody body = msg.getSOAPBody();
+            Node n = body.getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response.setNode(sayHiResponse.getSOAPPart());
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response.setNode(greetMeResponse.getSOAPPart());
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit2", serviceName = "SOAPServiceRPCLit2",
+                      targetNamespace = "http://apache.org/hello_world_rpclit",
+ wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+public class HWDOMSourcePayloadProvider implements Provider<DOMSource> {
+
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private SOAPMessage sayHiResponse;
+    private SOAPMessage greetMeResponse;
+    private MessageFactory factory;
+
+    public HWDOMSourcePayloadProvider() {
+
+        try {
+            factory = MessageFactory.newInstance();
+            InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            sayHiResponse =  factory.createMessage(null, is);
+            is.close();
+            is = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+            greetMeResponse =  factory.createMessage(null, is);
+            is.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public DOMSource invoke(DOMSource request) {
+        DOMSource response = new DOMSource();
+        try {
+            SOAPMessage msg = factory.createMessage();            
+            SOAPBody body = msg.getSOAPBody();
+            body.addDocument((Document)request.getNode());
+
+            Node n = getElementChildNode(body);
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response.setNode(sayHiResponse.getSOAPBody().extractContentAsDocument());
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response.setNode(greetMeResponse.getSOAPBody().extractContentAsDocument());
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+    
+    private Node getElementChildNode(SOAPBody body) {
+        Node n = body.getFirstChild();
+
+        while (n.getNodeType() != Node.ELEMENT_NODE) {
+            n = n.getNextSibling();
+        }
+        
+        return n;        
+    }
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourceMessageProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourceMessageProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourceMessageProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourceMessageProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Node;
+
+import org.xml.sax.InputSource;
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit3", serviceName = "SOAPServiceRPCLit3",
+                    targetNamespace = "http://apache.org/hello_world_rpclit",
+wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class HWSAXSourceMessageProvider implements Provider<SAXSource> {
+    
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private InputSource sayHiInputSource;
+    private InputSource greetMeInputSource;
+    private MessageFactory factory;
+
+    public HWSAXSourceMessageProvider() {
+
+        try {
+            factory = MessageFactory.newInstance();
+            InputStream is1 = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            sayHiInputSource = new InputSource(is1);
+
+            InputStream is2 = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+            greetMeInputSource = new InputSource(is2);
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public SAXSource invoke(SAXSource request) {
+        SAXSource response = new SAXSource();
+        try {
+            SOAPMessage msg = factory.createMessage();
+            msg.getSOAPPart().setContent(request);
+            SOAPBody body = msg.getSOAPBody();
+            Node n = body.getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response.setInputSource(sayHiInputSource);
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response.setInputSource(greetMeInputSource);
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSAXSourcePayloadProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Document;
+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 org.xml.sax.InputSource;
+
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit5", serviceName = "SOAPServiceRPCLit5",
+                  targetNamespace = "http://apache.org/hello_world_rpclit",
+wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+@ServiceMode(value = Service.Mode.PAYLOAD)
+public class HWSAXSourcePayloadProvider implements Provider<SAXSource> {
+    
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private MessageFactory factory;
+    private InputSource sayHiInputSource;
+    private InputSource greetMeInputSource;
+
+    public HWSAXSourcePayloadProvider() {
+
+        try {
+            factory = MessageFactory.newInstance();
+            InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            Document sayHiDocument = factory.createMessage(null, is).getSOAPBody().extractContentAsDocument();
+            sayHiInputSource = new InputSource(getSOAPBodyStream(sayHiDocument));
+            
+            InputStream is2 = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+            Document greetMeDocument = 
+                factory.createMessage(null, is2).getSOAPBody().extractContentAsDocument();
+            greetMeInputSource = new InputSource(getSOAPBodyStream(greetMeDocument));
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public SAXSource invoke(SAXSource request) {
+        SAXSource response = new SAXSource();
+        try {
+            
+            DOMResult domResult = new DOMResult();
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            transformer.transform(request, domResult);
+            Node n = domResult.getNode().getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response.setInputSource(sayHiInputSource);
+                
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response.setInputSource(greetMeInputSource);
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+    
+    private InputStream getSOAPBodyStream(Document doc) throws Exception {
+        System.setProperty(DOMImplementationRegistry.PROPERTY,
+            "com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl");
+        DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+        DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
+        LSOutput output = impl.createLSOutput();
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        output.setByteStream(byteArrayOutputStream);
+        LSSerializer writer = impl.createLSSerializer();
+        writer.write(doc, output);
+        byte[] buf = byteArrayOutputStream.toByteArray();
+        return new ByteArrayInputStream(buf);
+    }
+
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Node;
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl"
+@WebServiceProvider(portName = "SoapProviderPort", serviceName = "SOAPProviderService",
+                    targetNamespace = "http://apache.org/hello_world_soap_http",
+ wsdlLocation = "/wsdl/hello_world.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)            
+public class HWSoapMessageDocProvider implements Provider<SOAPMessage> {
+
+    private static QName sayHi = new QName("http://apache.org/hello_world_soap_http", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_soap_http", "greetMe");
+    private SOAPMessage sayHiResponse;
+    private SOAPMessage greetMeResponse;
+    
+    public HWSoapMessageDocProvider() {
+       
+        try {
+            MessageFactory factory = MessageFactory.newInstance();            
+            InputStream is = getClass().getResourceAsStream("resources/sayHiDocLiteralResp.xml");
+            sayHiResponse =  factory.createMessage(null, is);
+            is.close();
+            is = getClass().getResourceAsStream("resources/GreetMeDocLiteralResp.xml");
+            greetMeResponse =  factory.createMessage(null, is);
+            is.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+    
+    public SOAPMessage invoke(SOAPMessage request) {
+        SOAPMessage response = null;        
+        try {
+            SOAPBody body = request.getSOAPBody();
+            Node n = body.getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response = sayHiResponse;
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response = greetMeResponse;
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Node;
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit", serviceName = "SOAPServiceRPCLit",
+                      targetNamespace = "http://apache.org/hello_world_rpclit",
+ wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)            
+public class HWSoapMessageProvider implements Provider<SOAPMessage> {
+
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private SOAPMessage sayHiResponse;
+    private SOAPMessage greetMeResponse;
+    
+    public HWSoapMessageProvider() {
+       
+        try {
+            MessageFactory factory = MessageFactory.newInstance();            
+            InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            sayHiResponse =  factory.createMessage(null, is);
+            is.close();
+            is = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+            greetMeResponse =  factory.createMessage(null, is);
+            is.close();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+    
+    public SOAPMessage invoke(SOAPMessage request) {
+        SOAPMessage response = null;        
+        try {
+            SOAPBody body = request.getSOAPBody();
+            Node n = body.getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response = sayHiResponse;
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response = greetMeResponse;
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourceMessageProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourceMessageProvider.java?view=auto&rev=440307
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourceMessageProvider.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWStreamSourceMessageProvider.java Tue Sep  5 02:41:04 2006
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.systest.provider;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.w3c.dom.Node;
+
+
+
+//The following wsdl file is used.
+//wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
+@WebServiceProvider(portName = "SoapPortRPCLit4", serviceName = "SOAPServiceRPCLit4",
+                  targetNamespace = "http://apache.org/hello_world_rpclit",
+wsdlLocation = "/wsdl/hello_world_rpc_lit.wsdl")
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class HWStreamSourceMessageProvider implements Provider<StreamSource> {
+    
+    private static QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHi");
+    private static QName greetMe = new QName("http://apache.org/hello_world_rpclit", "greetMe");
+    private InputStream sayHiInputStream;
+    private InputStream greetMeInputStream;
+    private MessageFactory factory;
+
+    public HWStreamSourceMessageProvider() {
+
+        try {
+            factory = MessageFactory.newInstance();
+            sayHiInputStream = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+            greetMeInputStream = getClass().getResourceAsStream("resources/GreetMeRpcLiteralResp.xml");
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public StreamSource invoke(StreamSource request) {
+        StreamSource response = new StreamSource();
+        try {
+            SOAPMessage msg = factory.createMessage();
+            msg.getSOAPPart().setContent(request);
+            SOAPBody body = msg.getSOAPBody();
+            Node n = body.getFirstChild();
+
+            while (n.getNodeType() != Node.ELEMENT_NODE) {
+                n = n.getNextSibling();
+            }
+            if (n.getLocalName().equals(sayHi.getLocalPart())) {
+                response.setInputStream(sayHiInputStream);
+            } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
+                response.setInputStream(greetMeInputStream);
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return response;
+    }
+
+}



Mime
View raw message