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=509004&r1=509003&r2=509004 ============================================================================== --- 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 Sun Feb 18 13:06:58 2007 @@ -20,6 +20,7 @@ package org.apache.cxf.jaxws.support; import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; @@ -27,14 +28,25 @@ import javax.wsdl.Operation; import javax.xml.namespace.QName; +import javax.xml.soap.SOAPMessage; import javax.xml.ws.AsyncHandler; import javax.xml.ws.Service; +import org.apache.cxf.binding.AbstractBindingFactory; +import org.apache.cxf.binding.soap.SoapBindingFactory; +import org.apache.cxf.binding.soap.model.SoapBindingInfo; +import org.apache.cxf.databinding.source.SourceDataBinding; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.endpoint.EndpointException; +import org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor; +import org.apache.cxf.jaxws.interceptors.ProviderInDatabindingInterceptor; +import org.apache.cxf.jaxws.interceptors.ProviderOutDatabindingInterceptor; import org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor; +import org.apache.cxf.phase.Phase; +import org.apache.cxf.service.factory.AbstractServiceConfiguration; import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; import org.apache.cxf.service.factory.ServiceConstructionException; +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; @@ -43,19 +55,26 @@ import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.wsdl11.WSDLServiceBuilder; +/** + * Constructs a service model from JAX-WS service endpoint classes. Works + * with both @@WebServiceProvider and @@WebService annotated classes. + * + * @see org.apache.cxf.jaxws.JaxWsServerFactoryBean + */ public class JaxWsServiceFactoryBean extends AbstractJaxWsServiceFactoryBean { - private JaxWsServiceConfiguration jaxWsConfiguration; + private AbstractServiceConfiguration jaxWsConfiguration; + + private JaxWsImplementorInfo implInfo; public JaxWsServiceFactoryBean() { - jaxWsConfiguration = new JaxWsServiceConfiguration(); - getServiceConfigurations().add(0, jaxWsConfiguration); getIgnoredClasses().add(Service.class.getName()); } public JaxWsServiceFactoryBean(JaxWsImplementorInfo implInfo) { this(); - setJaxWsImplementorInfo(implInfo); + this.implInfo = implInfo; + initConfiguration(implInfo); this.serviceClass = implInfo.getEndpointClass(); } @@ -73,6 +92,31 @@ super.initializeDefaultInterceptors(); getService().getOutFaultInterceptors().add(new WebFaultOutInterceptor()); + + if (implInfo.isWebServiceProvider()) { + Class<?> type = implInfo.getProviderParameterType(); + if (type.equals(SOAPMessage.class)) { + getService().getInInterceptors().add(new ProviderInDatabindingInterceptor(type)); + // hack to get the SOAPMessage set before the SOAPHandlerInterceptor + ProviderOutDatabindingInterceptor out = new ProviderOutDatabindingInterceptor(); + out.setPhase(Phase.PRE_PROTOCOL); + out.addBefore(SOAPHandlerInterceptor.class.getName()); + getService().getOutInterceptors().add(out); + + getService().put(SOAPHandlerInterceptor.SAAJ_ENABLED, Boolean.TRUE); + } else { + getService().getInInterceptors().add(new ProviderInDatabindingInterceptor(type)); + getService().getOutInterceptors().add(new ProviderOutDatabindingInterceptor()); + } + + boolean messageMode = implInfo.getServiceMode().equals(javax.xml.ws.Service.Mode.MESSAGE); + for (BindingInfo bi : getService().getServiceInfo().getBindings()) { + if ((bi instanceof SoapBindingInfo) + && messageMode && !type.equals(SOAPMessage.class)) { + bi.setProperty(SoapBindingFactory.MESSAGE_PROCESSING_DISABLED, Boolean.TRUE); + } + } + } } @Override @@ -83,7 +127,7 @@ @SuppressWarnings("unchecked") @Override protected void initializeWSDLOperation(InterfaceInfo intf, OperationInfo o, Method method) { - method = jaxWsConfiguration.getDeclaredMethod(method); + method = ((JaxWsServiceConfiguration)jaxWsConfiguration).getDeclaredMethod(method); super.initializeWSDLOperation(intf, o, method); @@ -92,13 +136,14 @@ try { // Find the Async method which returns a Response Method responseMethod = method.getDeclaringClass().getDeclaredMethod(method.getName() + "Async", - method.getParameterTypes()); + method.getParameterTypes()); // Find the Async method whic has a Future & AsyncResultHandler List<Class<?>> asyncHandlerParams = new ArrayList(Arrays.asList(method.getParameterTypes())); asyncHandlerParams.add(AsyncHandler.class); - Method futureMethod = method.getDeclaringClass().getDeclaredMethod(method.getName() + "Async", - asyncHandlerParams.toArray(new Class<?>[asyncHandlerParams.size()])); + Method futureMethod = method.getDeclaringClass() + .getDeclaredMethod(method.getName() + "Async", + asyncHandlerParams.toArray(new Class<?>[asyncHandlerParams.size()])); getMethodDispatcher().bind(o, method, responseMethod, futureMethod); @@ -111,9 +156,40 @@ // rpc out-message-part-info class mapping Operation op = (Operation)o.getProperty(WSDLServiceBuilder.WSDL_OPERATION); initializeClassInfo(o, method, op == null ? null : op.getParameterOrdering()); + } + @Override + protected void initializeWSDLOperations() { + if (implInfo.isWebServiceProvider()) { + initializeWSDLOperationsForProvider(); + } else { + super.initializeWSDLOperations(); + } } + protected void initializeWSDLOperationsForProvider() { + Type[] genericInterfaces = getServiceClass().getGenericInterfaces(); + ParameterizedType pt = (ParameterizedType)genericInterfaces[0]; + Class c = (Class)pt.getActualTypeArguments()[0]; + + try { + Method invoke = getServiceClass().getMethod("invoke", c); + + // Bind each operation to the invoke method. + for (OperationInfo o : getService().getServiceInfo().getInterface().getOperations()) { + getMethodDispatcher().bind(o, invoke); + } + + } catch (SecurityException e) { + throw new ServiceConstructionException(e); + } catch (NoSuchMethodException e) { + throw new ServiceConstructionException(e); + } + + for (BindingInfo bi : getService().getServiceInfo().getBindings()) { + bi.setProperty(AbstractBindingFactory.DATABINDING_DISABLED, Boolean.TRUE); + } + } void initializeWrapping(OperationInfo o, Method selected) { Class responseWrapper = getResponseWrapper(selected); @@ -125,15 +201,52 @@ o.getInput().getMessageParts().get(0).setTypeClass(requestWrapper); } } - + + /** + * Create a mock service model with two operations - invoke and + * invokeOneway. + */ + // @Override + // protected InterfaceInfo createInterface(ServiceInfo serviceInfo) { + // if (jaxWsImplementorInfo.isWebServiceProvider()) { + // return createInterfaceForProvider(serviceInfo); + // } else { + // return super.createInterface(serviceInfo); + // } + // } + // + // protected InterfaceInfo createInterfaceForProvider(ServiceInfo + // serviceInfo) { + // + // InterfaceInfo intf = new InterfaceInfo(serviceInfo, getInterfaceName()); + // + // String ns = getServiceNamespace(); + // OperationInfo invoke = intf.addOperation(new QName(ns, "invoke")); + // + // MessageInfo input = invoke.createMessage(new QName(ns, "input")); + // invoke.setInput("input", input); + // + // input.addMessagePart("in"); + // + // MessageInfo output = invoke.createMessage(new QName(ns, "output")); + // invoke.setOutput("output", output); + // + // output.addMessagePart("out"); + // // + // // OperationInfo invokeOneWay = intf.addOperation(new + // // QName(getServiceNamespace(), "invokeOneWay")); + // // invokeOneWay.setInput("input", input); + // + // return intf; + // } private void setFaultClassInfo(OperationInfo o, Method selected) { Class[] types = selected.getExceptionTypes(); for (int i = 0; i < types.length; i++) { Class exClass = types[i]; Class beanClass = getBeanClass(exClass); - + QName name = getFaultName(o.getInterface(), o, exClass, beanClass); - + for (FaultInfo fi : o.getFaults()) { for (MessagePartInfo mpi : fi.getMessageParts()) { String ns = null; @@ -142,8 +255,8 @@ } else { ns = mpi.getTypeQName().getNamespaceURI(); } - if (mpi.getConcreteName().getLocalPart().equals(name.getLocalPart()) - && name.getNamespaceURI().equals(ns)) { + if (mpi.getConcreteName().getLocalPart().equals(name.getLocalPart()) + && name.getNamespaceURI().equals(ns)) { fi.setProperty(Class.class.getName(), exClass); mpi.setTypeClass(beanClass); } @@ -151,13 +264,12 @@ } } } - - + @Override protected Class<?> getBeanClass(Class<?> exClass) { try { Method getFaultInfo = exClass.getMethod("getFaultInfo", new Class[0]); - + return getFaultInfo.getReturnType(); } catch (SecurityException e) { throw new ServiceConstructionException(e); @@ -179,14 +291,14 @@ MessagePartInfo part = input.getMessageParts().get(0); part.setTypeClass(getRequestWrapper(method)); } - + if (o.hasOutput()) { MessageInfo input = o.getOutput(); MessagePartInfo part = input.getMessageParts().get(0); part.setTypeClass(getResponseWrapper(method)); part.setIndex(-1); } - + setFaultClassInfo(o, method); o = o.getUnwrappedOperation(); } else if (o.isUnwrappedCapable()) { @@ -194,23 +306,23 @@ // the WrapperClassOutInterceptor, and in general makes // life more confusing o.setUnwrappedOperation(null); - + setFaultClassInfo(o, method); } - - Class<?>[] paramTypes = method.getParameterTypes(); + + Class<?>[] paramTypes = method.getParameterTypes(); Type[] genericTypes = method.getGenericParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { Class paramType = paramTypes[i]; Type genericType = genericTypes[i]; - + initializeParameter(o, method, i, paramType, genericType); } - + // Initialize return type Class paramType = method.getReturnType(); Type genericType = method.getGenericReturnType(); - + initializeParameter(o, method, -1, paramType, genericType); setFaultClassInfo(o, method); @@ -239,7 +351,7 @@ part.setProperty(ReflectionServiceFactoryBean.MODE_INOUT, Boolean.TRUE); initializeParameter(part, paramType, genericType); part.setIndex(i); - + part = o.getOutput().getMessagePart(name); part.setProperty(ReflectionServiceFactoryBean.MODE_INOUT, Boolean.TRUE); initializeParameter(part, paramType, genericType); @@ -249,5 +361,27 @@ public void setJaxWsConfiguration(JaxWsServiceConfiguration jaxWsConfiguration) { this.jaxWsConfiguration = jaxWsConfiguration; + } + + public JaxWsImplementorInfo getJaxWsImplementorInfo() { + return implInfo; + } + + public void setJaxWsImplementorInfo(JaxWsImplementorInfo jaxWsImplementorInfo) { + this.implInfo = jaxWsImplementorInfo; + + initConfiguration(jaxWsImplementorInfo); + } + + protected final void initConfiguration(JaxWsImplementorInfo ii) { + if (ii.isWebServiceProvider()) { + jaxWsConfiguration = new WebServiceProviderConfiguration(); + getServiceConfigurations().add(0, jaxWsConfiguration); + setWrapped(false); + setDataBinding(new SourceDataBinding()); + } else { + jaxWsConfiguration = new JaxWsServiceConfiguration(); + getServiceConfigurations().add(0, jaxWsConfiguration); + } } }
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java Sun Feb 18 13:06:58 2007 @@ -20,28 +20,39 @@ package org.apache.cxf.jaxws.support; import java.io.IOException; +import java.lang.reflect.Method; import java.net.URL; import java.util.ResourceBundle; import javax.xml.namespace.QName; +import javax.xml.soap.SOAPMessage; +import javax.xml.transform.Source; import javax.xml.ws.WebServiceException; import org.apache.cxf.common.i18n.BundleUtils; import org.apache.cxf.common.i18n.Message; import org.apache.cxf.resource.URIResolver; -import org.apache.cxf.service.factory.AbstractServiceConfiguration; import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; import org.apache.cxf.service.factory.ServiceConstructionException; -public class WebServiceProviderConfiguration extends AbstractServiceConfiguration { +public class WebServiceProviderConfiguration extends JaxWsServiceConfiguration { private static final ResourceBundle BUNDLE = BundleUtils.getBundle(WebServiceProviderConfiguration.class); private JaxWsImplementorInfo implInfo; @Override + public Boolean isOperation(Method method) { + return method.getName().equals("invoke") + && method.getParameterTypes().length == 1 + && (Source.class.isAssignableFrom(method.getParameterTypes()[0]) + || SOAPMessage.class.isAssignableFrom(method.getParameterTypes()[0])); + } + + + @Override public void setServiceFactory(ReflectionServiceFactoryBean serviceFactory) { super.setServiceFactory(serviceFactory); - implInfo = ((ProviderServiceFactoryBean) serviceFactory).getJaxWsImplementorInfo(); + implInfo = ((JaxWsServiceFactoryBean) serviceFactory).getJaxWsImplementorInfo(); } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java Sun Feb 18 13:06:58 2007 @@ -40,8 +40,8 @@ try { InputStream in = message.getContent(InputStream.class); - while (in.available() > 0) { - in.read(); + while (in.read() != -1) { + // do nothing } Conduit backChannel = message.getDestination().getBackChannel(message, null, null); @@ -50,11 +50,12 @@ OutputStream out = message.getContent(OutputStream.class); Assert.assertNotNull(out); - in = getClass().getResourceAsStream(responseMessage); - IOUtils.copy(in, out, 2045); + InputStream res = getClass().getResourceAsStream(responseMessage); + IOUtils.copy(res, out, 2045); - out.close(); + res.close(); in.close(); + out.close(); } catch (Exception e) { e.printStackTrace(); } Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,96 @@ +/** + * 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.dispatch; + +import java.net.URL; + +import javax.xml.bind.JAXBContext; +import javax.xml.namespace.QName; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; +import javax.xml.ws.Dispatch; +import javax.xml.ws.Service; + +import org.w3c.dom.Document; + +import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.jaxws.AbstractJaxWsTest; +import org.apache.cxf.jaxws.MessageReplayObserver; +import org.apache.cxf.jaxws.ServiceImpl; +import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.transport.Destination; +import org.apache.hello_world_soap_http.SOAPService; +import org.apache.hello_world_soap_http.types.SayHi; +import org.apache.hello_world_soap_http.types.SayHiResponse; + + +public class DispatchTest extends AbstractJaxWsTest { + private final QName serviceName = new QName("http://apache.org/hello_world_soap_http", "SOAPService"); + private final QName portName = new QName("http://apache.org/hello_world_soap_http", "SoapPort"); + private final String address = "http://localhost:9000/SoapContext/SoapPort"; + private Destination d; + + @Override + public void setUp() throws Exception { + super.setUp(); + + EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); + ei.setAddress(address); + + d = localTransport.getDestination(ei); + } + + public void testJAXB() throws Exception { + d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml")); + + URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); + assertNotNull(wsdl); + + SOAPService service = new SOAPService(wsdl, serviceName); + assertNotNull(service); + + JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types"); + Dispatch<Object> disp = service.createDispatch(portName, jc, Service.Mode.PAYLOAD); + + SayHi s = new SayHi(); + + Object response = disp.invoke(s); + assertNotNull(response); + assertTrue(response instanceof SayHiResponse); + } + + public void testDOMSource() throws Exception { + ServiceImpl service = + new ServiceImpl(getBus(), + getClass().getResource("/wsdl/hello_world.wsdl"), + serviceName, + null); + + Dispatch<Source> disp = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE); + disp.getRequestContext().put(Dispatch.ENDPOINT_ADDRESS_PROPERTY, address); + + d.setMessageObserver(new MessageReplayObserver("/org/apache/cxf/jaxws/sayHiResponse.xml")); + + Document doc = DOMUtils.readXml(getResourceAsStream("/org/apache/cxf/jaxws/sayHi.xml")); + DOMSource source = new DOMSource(doc); + Source res = disp.invoke(source); + assertNotNull(res); + + } +} Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/DOMSourcePayloadProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/DOMSourcePayloadProvider.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/DOMSourcePayloadProvider.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/DOMSourcePayloadProvider.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,39 @@ +/** + * 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.provider; + +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; + [EMAIL PROTECTED] [EMAIL PROTECTED](value = Service.Mode.PAYLOAD) [EMAIL PROTECTED](value = "http://cxf.apache.org/bindings/xformat") +public class DOMSourcePayloadProvider implements Provider<DOMSource> { + + public DOMSourcePayloadProvider() { + } + + public DOMSource invoke(DOMSource request) { + return request; + } +} Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,217 @@ +/** + * 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.provider; + +import java.net.URL; + +import org.w3c.dom.Node; + +import org.apache.cxf.Bus; +import org.apache.cxf.binding.AbstractBindingFactory; +import org.apache.cxf.binding.Binding; +import org.apache.cxf.binding.soap.SoapBinding; +import org.apache.cxf.binding.soap.model.SoapBindingInfo; +import org.apache.cxf.binding.xml.XMLBinding; +import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.endpoint.ServerImpl; +import org.apache.cxf.jaxws.AbstractJaxWsTest; +import org.apache.cxf.jaxws.JaxWsServerFactoryBean; +import org.apache.cxf.jaxws.support.JaxWsImplementorInfo; +import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean; +import org.apache.cxf.service.Service; +import org.apache.cxf.service.model.InterfaceInfo; +import org.apache.cxf.transport.local.LocalTransportFactory; +import org.apache.hello_world_soap_http.HWSoapMessageProvider; + +public class ProviderServiceFactoryTest extends AbstractJaxWsTest { + public void testFromWSDL() throws Exception { + URL resource = getClass().getResource("/wsdl/hello_world.wsdl"); + assertNotNull(resource); + + JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(HWSoapMessageProvider.class); + JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean(implInfo); + bean.setWsdlURL(resource); + + Bus bus = getBus(); + bean.setBus(bus); + bean.setServiceClass(HWSoapMessageProvider.class); + + Service service = bean.create(); + + assertEquals("SOAPService", service.getName().getLocalPart()); + assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI()); + + InterfaceInfo intf = service.getServiceInfo().getInterface(); + assertNotNull(intf); + + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setBus(bus); + svrFactory.setServiceFactory(bean); + svrFactory.setStart(false); + + ServerImpl server = (ServerImpl)svrFactory.create(); + + Endpoint endpoint = server.getEndpoint(); + Binding binding = endpoint.getBinding(); + assertTrue(binding instanceof SoapBinding); + assertEquals(Boolean.TRUE, endpoint.getEndpointInfo().getBinding() + .getProperty(AbstractBindingFactory.DATABINDING_DISABLED)); + } + + public void testXMLBindingFromCode() throws Exception { + JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean(); + bean.setServiceClass(DOMSourcePayloadProvider.class); + bean.setBus(getBus()); + + Service service = bean.create(); + + assertEquals("DOMSourcePayloadProviderService", service.getName().getLocalPart()); + + InterfaceInfo intf = service.getServiceInfo().getInterface(); + assertNotNull(intf); + + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setBus(getBus()); + svrFactory.setServiceFactory(bean); + String address = "http://localhost:9000/test"; + svrFactory.setAddress(address); + + ServerImpl server = (ServerImpl)svrFactory.create(); + + assertEquals(1, service.getServiceInfo().getEndpoints().size()); + + Endpoint endpoint = server.getEndpoint(); + Binding binding = endpoint.getBinding(); + assertTrue(binding instanceof XMLBinding); + + Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, + "/org/apache/cxf/jaxws/provider/sayHi.xml"); + + addNamespace("j", "http://service.jaxws.cxf.apache.org/"); + assertValid("/j:sayHi", res); + } + + public void testSOAPBindingFromCode() throws Exception { + JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean(); + bean.setServiceClass(SOAPSourcePayloadProvider.class); + bean.setBus(getBus()); + + Service service = bean.create(); + + assertEquals("SOAPSourcePayloadProviderService", service.getName().getLocalPart()); + + InterfaceInfo intf = service.getServiceInfo().getInterface(); + assertNotNull(intf); + assertEquals(1, intf.getOperations().size()); + + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setBus(getBus()); + svrFactory.setServiceFactory(bean); + String address = "http://localhost:9000/test"; + svrFactory.setAddress(address); + + ServerImpl server = (ServerImpl)svrFactory.create(); + + // See if our endpoint was created correctly + assertEquals(1, service.getServiceInfo().getEndpoints().size()); + + Endpoint endpoint = server.getEndpoint(); + Binding binding = endpoint.getBinding(); + assertTrue(binding instanceof SoapBinding); + + SoapBindingInfo sb = (SoapBindingInfo)endpoint.getEndpointInfo().getBinding(); + assertEquals("document", sb.getStyle()); + assertEquals(false, bean.isWrapped()); + assertEquals(Boolean.TRUE, sb.getProperty(AbstractBindingFactory.DATABINDING_DISABLED)); + + assertEquals(1, sb.getOperations().size()); + Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); + + addNamespace("j", "http://service.jaxws.cxf.apache.org/"); + assertValid("/s:Envelope/s:Body/j:sayHi", res); + } + + public void testSAAJProviderCodeFirst() throws Exception { + JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean(); + bean.setServiceClass(SAAJProvider.class); + bean.setBus(getBus()); + + Service service = bean.create(); + + assertEquals("SAAJProviderService", service.getName().getLocalPart()); + + InterfaceInfo intf = service.getServiceInfo().getInterface(); + assertNotNull(intf); + assertEquals(1, intf.getOperations().size()); + + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setBus(getBus()); + svrFactory.setServiceFactory(bean); + String address = "http://localhost:9000/test"; + svrFactory.setAddress(address); + + ServerImpl server = (ServerImpl)svrFactory.create(); + + Endpoint endpoint = server.getEndpoint(); + Binding binding = endpoint.getBinding(); + assertTrue(binding instanceof SoapBinding); + + SoapBindingInfo sb = (SoapBindingInfo)endpoint.getEndpointInfo().getBinding(); + assertEquals("document", sb.getStyle()); + assertEquals(false, bean.isWrapped()); + assertEquals(Boolean.TRUE, sb.getProperty(AbstractBindingFactory.DATABINDING_DISABLED)); + + assertEquals(1, sb.getOperations().size()); + Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); + + addNamespace("j", "http://service.jaxws.cxf.apache.org/"); + assertValid("/s:Envelope/s:Body/j:sayHi", res); + } + + public void testStreamSourceProviderCodeFirst() throws Exception { + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setServiceClass(StreamSourcePayloadProvider.class); + svrFactory.setBus(getBus()); + String address = "http://localhost:9000/test"; + svrFactory.setAddress(address); + + svrFactory.create(); + + Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); + + addNamespace("j", "http://service.jaxws.cxf.apache.org/"); + assertValid("/s:Envelope/s:Body/j:sayHi", res); + } + + + public void testSourceMessageProviderCodeFirst() throws Exception { + JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); + svrFactory.setServiceClass(SourceMessageProvider.class); + svrFactory.setBus(getBus()); + String address = "http://localhost:9000/test"; + svrFactory.setAddress(address); + + svrFactory.create(); + + Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml"); + + addNamespace("j", "http://service.jaxws.cxf.apache.org/"); + assertValid("/s:Envelope/s:Body/j:sayHi", res); + } +} Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,35 @@ +/** + * 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.provider; + +import javax.xml.soap.SOAPMessage; +import javax.xml.ws.Provider; +import javax.xml.ws.WebServiceProvider; + [EMAIL PROTECTED]() +public class SAAJProvider implements Provider<SOAPMessage> { + + public SAAJProvider() { + } + + public SOAPMessage invoke(SOAPMessage request) { + return request; + } +} Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SAAJProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,38 @@ +/** + * 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.provider; + +import javax.xml.transform.Source; +import javax.xml.ws.Provider; +import javax.xml.ws.Service; +import javax.xml.ws.ServiceMode; +import javax.xml.ws.WebServiceProvider; + [EMAIL PROTECTED]() [EMAIL PROTECTED](value = Service.Mode.PAYLOAD) +public class SOAPSourcePayloadProvider implements Provider<Source> { + + public SOAPSourcePayloadProvider() { + } + + public Source invoke(Source request) { + return request; + } +} Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SOAPSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,38 @@ +/** + * 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.provider; + +import javax.xml.transform.Source; +import javax.xml.ws.Provider; +import javax.xml.ws.Service; +import javax.xml.ws.ServiceMode; +import javax.xml.ws.WebServiceProvider; + [EMAIL PROTECTED] [EMAIL PROTECTED](value = Service.Mode.MESSAGE) +public class SourceMessageProvider implements Provider<Source> { + + public SourceMessageProvider() { + } + + public Source invoke(Source request) { + return request; + } +} Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/SourceMessageProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java Sun Feb 18 13:06:58 2007 @@ -0,0 +1,39 @@ +/** + * 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.provider; + +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; + [EMAIL PROTECTED]() [EMAIL PROTECTED](value = Service.Mode.PAYLOAD) [EMAIL PROTECTED](value = "http://cxf.apache.org/bindings/xformat") +public class StreamSourcePayloadProvider implements Provider<StreamSource> { + + public StreamSourcePayloadProvider() { + } + + public StreamSource invoke(StreamSource request) { + return request; + } +} Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/StreamSourcePayloadProvider.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Added: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml?view=auto&rev=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml (added) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml Sun Feb 18 13:06:58 2007 @@ -0,0 +1,21 @@ +<!-- + 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. +--> +<sayHi xmlns="http://service.jaxws.cxf.apache.org/"> + <text>hi</text> +</sayHi> \ No newline at end of file Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml ------------------------------------------------------------------------------ svn:executable = * Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/sayHi.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java (original) +++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java Sun Feb 18 13:06:58 2007 @@ -26,6 +26,7 @@ import org.apache.cxf.BusException; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.soap.SoapBindingInfoFactoryBean; +import org.apache.cxf.binding.soap.model.SoapBindingInfo; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.endpoint.EndpointException; import org.apache.cxf.service.Service; @@ -110,8 +111,13 @@ } } + // Get the Service from the ServiceFactory if specified + Service service = serviceFactory.getService(); + BindingInfo bindingInfo = createBindingInfo(); + service.getServiceInfo().addBinding(bindingInfo); + // SOAP nonsense - if (getBindingFactory() instanceof SoapBindingInfoFactoryBean) { + if (bindingInfo instanceof SoapBindingInfo) { ((SoapBindingInfoFactoryBean) getBindingFactory()).setTransportURI(transportId); transportId = "http://schemas.xmlsoap.org/wsdl/soap/"; } @@ -121,12 +127,6 @@ DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class); destinationFactory = dfm.getDestinationFactory(transportId); - // Get the Service from the ServiceFactory if specified - Service service = serviceFactory.getService(); - getBindingFactory().setServiceFactory(serviceFactory); - BindingInfo bindingInfo = getBindingFactory().create(); - service.getServiceInfo().addBinding(bindingInfo); - EndpointInfo ei = new EndpointInfo(service.getServiceInfo(), transportId); ei.setName(endpointName); ei.setAddress(getAddress()); @@ -143,7 +143,11 @@ return ei; } - + protected BindingInfo createBindingInfo() { + getBindingFactory().setServiceFactory(serviceFactory); + return getBindingFactory().create(); + } + public String getAddress() { return address; } Modified: incubator/cxf/trunk/rt/ws/addr/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/pom.xml?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/rt/ws/addr/pom.xml (original) +++ incubator/cxf/trunk/rt/ws/addr/pom.xml Sun Feb 18 13:06:58 2007 @@ -73,5 +73,16 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>com.sun.xml.messaging.saaj</groupId> + <artifactId>saaj-impl</artifactId> + </dependency> + + <dependency> + <groupId>javax.activation</groupId> + <artifactId>activation</artifactId> + <version>1.1</version> + </dependency> </dependencies> </project> Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchXMLClientServerTest.java Sun Feb 18 13:06:58 2007 @@ -98,7 +98,6 @@ Dispatch<Source> disp = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE); Source source = disp.invoke(reqMsg); assertNotNull(source); - assertTrue(source instanceof StreamSource); String streamString = XMLUtils.toString(source); Document doc = XMLUtils.parse(streamString); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadXMLBindingProvider.java Sun Feb 18 13:06:58 2007 @@ -31,6 +31,8 @@ import org.w3c.dom.Document; +import org.apache.cxf.helpers.DOMUtils; + //The following wsdl file is used. //wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl" @WebServiceProvider(portName = "XMLProviderPort", @@ -53,13 +55,14 @@ try { factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(true); + factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); InputStream greetMeResponse = getClass().getResourceAsStream( "resources/XML_GreetMeDocLiteralResp.xml"); document = builder.parse(greetMeResponse); - response = new DOMSource(document); + DOMUtils.writeXml(document, System.out); + response = new DOMSource(document.getDocumentElement()); } catch (Exception e) { e.printStackTrace(); } Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProvider.java Sun Feb 18 13:06:58 2007 @@ -105,7 +105,7 @@ try { factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(true); + factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); InputStream greetMeResponse = getClass().getResourceAsStream(fileName); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProviderHttpBinding.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProviderHttpBinding.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProviderHttpBinding.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/RestSourcePayloadProviderHttpBinding.java Sun Feb 18 13:06:58 2007 @@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.dom.DOMSource; +import javax.xml.ws.BindingType; import javax.xml.ws.Provider; import javax.xml.ws.Service; import javax.xml.ws.ServiceMode; @@ -39,6 +40,7 @@ @WebServiceProvider() @ServiceMode(value = Service.Mode.PAYLOAD) [EMAIL PROTECTED]("http://cxf.apache.org/bindings/xformat") public class RestSourcePayloadProviderHttpBinding implements Provider<DOMSource> { @Resource @@ -97,7 +99,7 @@ try { factory = DocumentBuilderFactory.newInstance(); - factory.setValidating(true); + factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); InputStream greetMeResponse = getClass().getResourceAsStream(fileName); Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java?view=diff&rev=509004&r1=509003&r2=509004 ============================================================================== --- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java (original) +++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/Server.java Sun Feb 18 13:06:58 2007 @@ -29,9 +29,8 @@ Object implementor = new RestSourcePayloadProvider(); String address = "http://localhost:9023/XMLService/RestProviderPort/Customer"; Endpoint.publish(address, implementor); - } - - + } + public static void main(String[] args) { try { Server s = new Server();
