Author: ema
Date: Thu Nov 15 19:35:09 2007
New Revision: 595537
URL: http://svn.apache.org/viewvc?rev=595537&view=rev
Log:
Fixed issue [CXF-964]. Now client can unmarshal FaultBean which constructor
arguments contains primitive class
Fixed wsdl2java usage xml
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
incubator/cxf/trunk/testutils/pom.xml
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Thu Nov 15 19:35:09 2007
@@ -146,7 +146,17 @@
e = constructor.newInstance(new
Object[]{fault.getMessage()});
} else {
Class<?> beanClass = e.getClass();
- Constructor constructor = exClass.getConstructor(new
Class[]{String.class, beanClass});
+ Constructor constructor = null;
+ try {
+ constructor = exClass.getConstructor(new
Class[]{String.class, beanClass});
+ } catch (NoSuchMethodException ex) {
+ Class<?> cls = getPrimitiveClass(beanClass);
+ if (cls != null) {
+ constructor = exClass.getConstructor(new
Class[]{String.class, cls});
+ } else {
+ throw ex;
+ }
+ }
e = constructor.newInstance(new
Object[]{fault.getMessage(), e});
}
msg.setContent(Exception.class, e);
@@ -201,5 +211,22 @@
}
}
+ }
+
+ private Class<?> getPrimitiveClass(Class<?> cls) {
+ if (cls.isPrimitive()) {
+ return cls;
+ }
+ try {
+ Field field = cls.getField("TYPE");
+ Object obj = (Object)cls;
+ Object type = field.get(obj);
+ if (type instanceof Class) {
+ return (Class)type;
+ }
+ } catch (Exception e) {
+ // do nothing
+ }
+ return null;
}
}
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java?rev=595537&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/GreeterImpl.java
Thu Nov 15 19:35:09 2007
@@ -0,0 +1,34 @@
+/**
+ * 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.fault;
+
+import org.apache.intfault.BadRecordLitFault;
+import org.apache.intfault.types.BareDocumentResponse;
[EMAIL PROTECTED](portName = "SoapPort", serviceName = "SOAPService",
+ targetNamespace = "http://apache.org/intfault",
+ endpointInterface = "org.apache.intfault.Greeter",
+ wsdlLocation = "testutils/hello_world_fault.wsdl")
+public class GreeterImpl {
+ public BareDocumentResponse testDocLitFault(String in) throws
BadRecordLitFault {
+ System.out.println("Executing testDocLitFault sayHi\n");
+ throw new BadRecordLitFault("int fault", 5);
+
+ }
+
+}
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java?rev=595537&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/IntFaultClientServerTest.java
Thu Nov 15 19:35:09 2007
@@ -0,0 +1,58 @@
+/**
+ * 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.fault;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.intfault.BadRecordLitFault;
+import org.apache.intfault.Greeter;
+import org.apache.intfault.SOAPService;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class IntFaultClientServerTest extends AbstractBusClientServerTestBase
{
+
+ private final QName serviceName = new QName("http://apache.org/intfault",
+ "SOAPService");
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly",
launchServer(Server.class));
+ }
+
+ @Test
+ public void testBasicConnection() throws Exception {
+ URL wsdl = getClass().getResource("/wsdl/hello_world_fault.wsdl");
+ assertNotNull("WSDL is null", wsdl);
+
+ SOAPService service = new SOAPService(wsdl, serviceName);
+ assertNotNull("Service is null", service);
+
+ Greeter greeter = service.getSoapPort();
+ try {
+ greeter.testDocLitFault("fault");
+ } catch (BadRecordLitFault e) {
+ assertEquals(5, e.getFaultInfo());
+ }
+
+ }
+}
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java?rev=595537&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/fault/Server.java
Thu Nov 15 19:35:09 2007
@@ -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.systest.fault;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+ protected void run() {
+
+ GreeterImpl implementor = new GreeterImpl();
+ String address = "http://localhost:9000/SoapContext/SoapPort";
+ Endpoint.publish(address, implementor);
+
+ }
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
Modified: incubator/cxf/trunk/testutils/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/pom.xml?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
--- incubator/cxf/trunk/testutils/pom.xml (original)
+++ incubator/cxf/trunk/testutils/pom.xml Thu Nov 15 19:35:09 2007
@@ -373,6 +373,9 @@
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/cardealer.wsdl</wsdl>
</wsdlOption>
+ <wsdlOption>
+
<wsdl>${basedir}/src/main/resources/wsdl/hello_world_fault.wsdl</wsdl>
+ </wsdlOption>
</wsdlOptions>
</configuration>
Added:
incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl?rev=595537&view=auto
==============================================================================
---
incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
(added)
+++
incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world_fault.wsdl
Thu Nov 15 19:35:09 2007
@@ -0,0 +1,92 @@
+<?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.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/intfault"
+ xmlns:x1="http://apache.org/intfault/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wswa="http://www.w3.org/2006/05/addressing/wsdl"
+ targetNamespace="http://apache.org/intfault" name="HelloWorldFault">
+ <wsdl:types>
+ <schema targetNamespace="http://apache.org/intfault/types"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x1="http://apache.org/intfault/types" elementFormDefault="qualified">
+ <element name="BareDocument" type="string"/>
+ <element name="BareDocumentResponse">
+ <complexType>
+ <sequence>
+ <element name="company" type="string"/>
+ </sequence>
+ <attribute name="id" type="int"/>
+ </complexType>
+ </element>
+
+ <element name="int" nillable="true" type="int"/>
+ <complexType name="BadRecord">
+ <sequence>
+ <element name="reason" type="string"/>
+ <element name="code" type="short"/>
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="Bad_RecordLit_Fault">
+ <wsdl:part name="BadRecordLit" element="x1:int"/>
+ </wsdl:message>
+ <wsdl:message name="testDocLitBareRequest">
+ <wsdl:part name="in" element="x1:BareDocument"/>
+ </wsdl:message>
+ <wsdl:message name="testDocLitBareResponse">
+ <wsdl:part name="out" element="x1:BareDocumentResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="testDocLitFault">
+ <wsdl:input message="tns:testDocLitBareRequest"
wswa:Action="http://apache.org/intfault/Fault"/>
+ <wsdl:output message="tns:testDocLitBareResponse"
wswa:Action="http://apache.org/intfault/Fault"/>
+ <wsdl:fault name="myfault" message="tns:Bad_RecordLit_Fault"
wswa:Action="http://apache.org/intfault/Fault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="testDocLitFault">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="myfault">
+ <soap:fault name="myfault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+ <soap:address
location="http://localhost:9000/SoapContext/SoapPort"/>
+ <wswa:UsingAddressing/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
Modified:
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
(original)
+++
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaClass.java
Thu Nov 15 19:35:09 2007
@@ -44,16 +44,16 @@
}
public JavaMethod appendGetter(JavaField field) {
- String getterName = "get" + StringUtils.capitalize(field.getName());
+ String getterName = "get" +
StringUtils.capitalize(field.getParaName());
JavaMethod jMethod = new JavaMethod(this);
jMethod.setName(getterName);
- jMethod.setReturn(new JavaReturn(field.getName(),
+ jMethod.setReturn(new JavaReturn(field.getParaName(),
field.getType(),
field.getTargetNamespace()));
JavaCodeBlock block = new JavaCodeBlock();
JavaExpression exp = new JavaExpression();
- exp.setValue("return this." + field.getName());
+ exp.setValue("return this." + field.getParaName());
block.getExpressions().add(exp);
jMethod.setJavaCodeBlock(block);
@@ -63,16 +63,16 @@
}
public JavaMethod appendSetter(JavaField field) {
- String setterName = "set" + StringUtils.capitalize(field.getName());
+ String setterName = "set" +
StringUtils.capitalize(field.getParaName());
JavaMethod jMethod = new JavaMethod(this);
jMethod.setReturn(new JavaReturn("return", "void", null));
- String paramName = getSetterParamName(field.getName());
+ String paramName = getSetterParamName(field.getParaName());
jMethod.addParameter(new JavaParameter(paramName,
field.getType(),
field.getTargetNamespace()));
JavaCodeBlock block = new JavaCodeBlock();
JavaExpression exp = new JavaExpression();
- exp.setValue("this." + field.getName() + " = " + paramName);
+ exp.setValue("this." + field.getParaName() + " = " + paramName);
block.getExpressions().add(exp);
jMethod.setJavaCodeBlock(block);
Modified:
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
(original)
+++
incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaField.java
Thu Nov 15 19:35:09 2007
@@ -62,9 +62,9 @@
}
public String getName() {
- if (URIParserUtil.containsReservedKeywords(this.name)) {
+ /*if (URIParserUtil.containsReservedKeywords(this.name)) {
return "_" + this.name;
- }
+ }*/
return this.name;
}
@@ -77,6 +77,13 @@
return new Annotation[]{};
}
return jaxbAnnotations;
+ }
+
+ public String getParaName() {
+ if (URIParserUtil.containsReservedKeywords(this.name)) {
+ return "_" + this.name;
+ }
+ return this.name;
}
}
Modified:
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm
Thu Nov 15 19:35:09 2007
@@ -38,7 +38,7 @@
#foreach($anno in $field.Annotations)
$anno
#end
- private $field.Type $field.Name;
+ private $field.Type $field.ParaName;
#end
#foreach ($method in $bean.Methods)
Modified:
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
(original)
+++
incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapperTest.java
Thu Nov 15 19:35:09 2007
@@ -59,7 +59,7 @@
Method method = (Method)opInfo.getProperty("operation.method");
JavaField field = responseWrapper.buildFields(method, message).get(0);
- assertEquals("_return", field.getName());
+ assertEquals("_return", field.getParaName());
assertEquals("String[]", field.getType());
// Test int[]
@@ -71,7 +71,7 @@
method = (Method) opInfo.getProperty("operation.method");
field = responseWrapper.buildFields(method, message).get(0);
- assertEquals("_return", field.getName());
+ assertEquals("_return", field.getParaName());
assertEquals("int[]", field.getType());
// Test TestDataBean[]
@@ -83,7 +83,7 @@
method = (Method) opInfo.getProperty("operation.method");
field = responseWrapper.buildFields(method, message).get(0);
- assertEquals("_return", field.getName());
+ assertEquals("_return", field.getParaName());
assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean[]",
field.getType());
}
Modified:
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
(original)
+++
incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/jaxws-toolspec.xml
Thu Nov 15 19:35:09 2007
@@ -85,8 +85,7 @@
</annotation>
<switch>sn</switch>
<associatedArgument placement="afterSpace">
- <valuetype>NamingSpacePackageString</valuetype>
- <annotation>[wsdl namespace =]Package Name</annotation>
+ <annotation>service-name</annotation>
</associatedArgument>
</option>
Modified:
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=595537&r1=595536&r2=595537&view=diff
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Thu Nov 15 19:35:09 2007
@@ -26,6 +26,7 @@
import java.lang.reflect.Modifier;
import javax.jws.WebService;
import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
import javax.xml.ws.WebServiceClient;
import org.apache.cxf.common.i18n.Message;
@@ -898,5 +899,17 @@
getLocation("/wsdl2java_wsdl/cxf1209/hello_world_fault.wsdl"));
processor.setContext(env);
processor.execute();
- }
+ }
+
+ @Test
+ public void testCXF964() throws Exception {
+ env.put(ToolConstants.CFG_WSDLURL,
+ getLocation("/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl"));
+ processor.setContext(env);
+ processor.execute();
+ Class<?> clz =
classLoader.loadClass("org.apache.intfault.BadRecordLitFault");
+ WebFault webFault = AnnotationUtil.getPrivClassAnnotation(clz,
WebFault.class);
+ assertEquals("int", webFault.name());
+ }
+
}
Added:
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl?rev=595537&view=auto
==============================================================================
---
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
(added)
+++
incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf964/hello_world_fault.wsdl
Thu Nov 15 19:35:09 2007
@@ -0,0 +1,90 @@
+<?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.
+-->
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://apache.org/intfault"
+ xmlns:x1="http://apache.org/intfault/types"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/intfault" name="HelloWorldFault">
+ <wsdl:types>
+ <schema targetNamespace="http://apache.org/intfault/types"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x1="http://apache.org/intfault/types" elementFormDefault="qualified">
+ <element name="BareDocument" type="string"/>
+ <element name="BareDocumentResponse">
+ <complexType>
+ <sequence>
+ <element name="company" type="string"/>
+ </sequence>
+ <attribute name="id" type="int"/>
+ </complexType>
+ </element>
+
+ <element name="int" nillable="true" type="int"/>
+ <complexType name="BadRecord">
+ <sequence>
+ <element name="reason" type="string"/>
+ <element name="code" type="short"/>
+ </sequence>
+ </complexType>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="Bad_RecordLit_Fault">
+ <wsdl:part name="BadRecordLit" element="x1:int"/>
+ </wsdl:message>
+ <wsdl:message name="testDocLitBareRequest">
+ <wsdl:part name="in" element="x1:BareDocument"/>
+ </wsdl:message>
+ <wsdl:message name="testDocLitBareResponse">
+ <wsdl:part name="out" element="x1:BareDocumentResponse"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Greeter">
+ <wsdl:operation name="testDocLitFault">
+ <wsdl:input message="tns:testDocLitBareRequest"/>
+ <wsdl:output message="tns:testDocLitBareResponse"/>
+ <wsdl:fault name="myfault" message="tns:Bad_RecordLit_Fault"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="Greeter_SOAPBinding" type="tns:Greeter">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="testDocLitFault">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="myfault">
+ <soap:fault name="myfault" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="SOAPService">
+ <wsdl:port name="SoapPort" binding="tns:Greeter_SOAPBinding">
+ <soap:address
location="http://localhost:9000/SoapContext/SoapPort"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+