Author: dkulp
Date: Wed Feb 27 10:18:42 2008
New Revision: 631667
URL: http://svn.apache.org/viewvc?rev=631667&view=rev
Log:
[CXF-935] For provider services, allow some flexibility with mapping to the wsdl
Add "war" option for the jaxws_dispatch_provider sample
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
(with props)
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/build.xml
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/Messages.properties
Modified:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/build.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/build.xml?rev=631667&r1=631666&r2=631667&view=diff
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/build.xml
(original)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/build.xml
Wed Feb 27 10:18:42 2008
@@ -37,4 +37,14 @@
<wsdl2java file="hello_world.wsdl" servicename.arg="-sn SOAPService3"/>
</target>
+ <property name="cxf.war.file.name" value="helloworld_provider"/>
+ <target name="war" depends="build">
+ <cxfwar filename="${cxf.war.file.name}.war"/>
+ </target>
+
+ <target name="client-servlet" description="run demo client hitting
servlet" depends="build">
+ <property name="param" value=""/>
+ <cxfrun classname="demo.hwDispatch.client.Client"
param1="${base.url}/helloworld_provider/services/SOAPPort1?wsdl"/>
+ </target>
+
</project>
Added:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml?rev=631667&view=auto
==============================================================================
---
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
(added)
+++
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
Wed Feb 27 10:18:42 2008
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xmlns:soap="http://cxf.apache.org/bindings/soap"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <jaxws:endpoint id="myEndpoint"
+ implementor="demo.hwDispatch.server.GreeterSoapMessageProvider"
+ address="/SOAPPort1"
+ serviceName="msp:SOAPService1"
+ endpointName="msp:SoapPort1"
+ wsdlLocation="WEB-INF/wsdl/hello_world.wsdl"
+ xmlns:msp="http://apache.org/hello_world_soap_http">
+ </jaxws:endpoint>
+ <jaxws:endpoint id="myEndpoint2"
+ implementor="demo.hwDispatch.server.GreeterDOMSourceMessageProvider"
+ address="/SOAPPort2"
+ serviceName="msp:SOAPService2"
+ endpointName="msp:SoapPort2"
+ wsdlLocation="WEB-INF/wsdl/hello_world.wsdl"
+ xmlns:msp="http://apache.org/hello_world_soap_http">
+ </jaxws:endpoint>
+ <jaxws:endpoint id="myEndpoint3"
+ implementor="demo.hwDispatch.server.GreeterDOMSourcePayloadProvider"
+ address="/SOAPPort3"
+ serviceName="msp:SOAPService3"
+ endpointName="msp:SoapPort3"
+ wsdlLocation="WEB-INF/wsdl/hello_world.wsdl"
+ xmlns:msp="http://apache.org/hello_world_soap_http">
+ </jaxws:endpoint>
+</beans>
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/distribution/src/main/release/samples/jaxws_dispatch_provider/wsdl/cxf-servlet.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
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?rev=631667&r1=631666&r2=631667&view=diff
==============================================================================
---
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
Wed Feb 27 10:18:42 2008
@@ -28,10 +28,14 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import javax.wsdl.Operation;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.namespace.QName;
import javax.xml.ws.Action;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.BindingType;
@@ -48,6 +52,7 @@
import org.apache.cxf.binding.AbstractBindingFactory;
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.databinding.source.SourceDataBinding;
import org.apache.cxf.endpoint.Endpoint;
@@ -82,6 +87,8 @@
public class JaxWsServiceFactoryBean extends ReflectionServiceFactoryBean {
// used to tag property on service.
public static final String WS_FEATURES = "JAXWS-WS-FEATURES";
+ private static final Logger LOG =
LogUtils.getLogger(JaxWsServiceFactoryBean.class);
+
private AbstractServiceConfiguration jaxWsConfiguration;
private JaxWsImplementorInfo implInfo;
@@ -242,23 +249,43 @@
ParameterizedType pt = (ParameterizedType)genericInterfaces[0];
Class c = (Class)pt.getActualTypeArguments()[0];
+ if (getEndpointInfo() == null
+ && isFromWsdl()) {
+ //most likely, they specified a WSDL, but for some reason
+ //did not give a valid ServiceName/PortName. For provider,
+ //we'll allow this since everything is bound directly to
+ //the invoke method, however, this CAN cause other problems
+ //such as addresses in the wsdl not getting updated and such
+ //so we'll WARN about it.....
+ List<QName> enames = new ArrayList<QName>();
+ for (ServiceInfo si : getService().getServiceInfos()) {
+ for (EndpointInfo ep : si.getEndpoints()) {
+ enames.add(ep.getName());
+ }
+ }
+ LOG.log(Level.WARNING, "COULD_NOT_FIND_ENDPOINT",
+ new Object[] {getEndpointName(), enames});
+ }
+
try {
Method invoke = getServiceClass().getMethod("invoke", c);
- // Bind each operation to the invoke method.
- for (OperationInfo o :
getEndpointInfo().getService().getInterface().getOperations()) {
- getMethodDispatcher().bind(o, invoke);
+ // Bind every operation to the invoke method.
+ for (ServiceInfo si : getService().getServiceInfos()) {
+ for (OperationInfo o : si.getInterface().getOperations()) {
+ getMethodDispatcher().bind(o, invoke);
+ }
+ for (BindingInfo bi : si.getBindings()) {
+
bi.setProperty(AbstractBindingFactory.DATABINDING_DISABLED, Boolean.TRUE);
+ }
}
-
} catch (SecurityException e) {
throw new ServiceConstructionException(e);
} catch (NoSuchMethodException e) {
throw new ServiceConstructionException(e);
}
- for (BindingInfo bi : getEndpointInfo().getService().getBindings()) {
- bi.setProperty(AbstractBindingFactory.DATABINDING_DISABLED,
Boolean.TRUE);
- }
+
}
void initializeWrapping(OperationInfo o, Method selected) {
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties?rev=631667&r1=631666&r2=631667&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/Messages.properties
Wed Feb 27 10:18:42 2008
@@ -24,3 +24,4 @@
ILLEGAL_ATTRIBUTE_IN_SEI_ANNOTATION_EXC = Attributes portName, serviceName and
endpointInterface are not allowed in the @WebService annotation of an SEI.
MALFORMED_URL_IN_WEBSERVICE_ANNOTATION_EXC = Malformed url in @WebService
annotation attribute wsdlLocation.
LOAD_WSDL_EXC = Could not load WSDL from URL {0}.
+COULD_NOT_FIND_ENDPOINT = Could not find endpoint named {0}. Possible values
are {1}.