Author: dkulp
Date: Tue Sep 4 13:00:03 2007
New Revision: 572802
URL: http://svn.apache.org/viewvc?rev=572802&view=rev
Log:
[CXF-943] Use the qnames from WebResult/WebParam for the "BARE" parts
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
(with props)
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
(with props)
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/trunk/systests/pom.xml
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_json_books.txt
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
Modified:
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
---
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Tue Sep 4 13:00:03 2007
@@ -489,7 +489,9 @@
return;
}
}
- SchemaInfo si = getOrCreateSchema(serviceInfo,
mpi.getElementQName().getNamespaceURI());
+ SchemaInfo si = getOrCreateSchema(serviceInfo,
+
mpi.getElementQName().getNamespaceURI(),
+ qualifyWrapperSchema());
XmlSchema schema = si.getSchema();
XmlSchemaElement el = new XmlSchemaElement();
@@ -513,7 +515,9 @@
protected void createWrappedSchema(ServiceInfo serviceInfo,
AbstractMessageContainer wrappedMessage,
AbstractMessageContainer
unwrappedMessage, QName wraperBeanName) {
- SchemaInfo schemaInfo = getOrCreateSchema(serviceInfo,
wraperBeanName.getNamespaceURI());
+ SchemaInfo schemaInfo = getOrCreateSchema(serviceInfo,
+
wraperBeanName.getNamespaceURI(),
+ qualifyWrapperSchema());
createWrappedMessageSchema(serviceInfo, wrappedMessage,
unwrappedMessage,
schemaInfo.getSchema(), wraperBeanName);
@@ -562,16 +566,8 @@
}
if (schemaInfo == null) {
- schemaInfo = new SchemaInfo(serviceInfo,
qname.getNamespaceURI());
- XmlSchemaCollection col = new XmlSchemaCollection();
- schema = new XmlSchema(qname.getNamespaceURI(), col);
- schema.setElementFormDefault(new
XmlSchemaForm(XmlSchemaForm.QUALIFIED));
- serviceInfo.setXmlSchemaCollection(col);
-
- NamespaceMap nsMap = new NamespaceMap();
- nsMap.add(WSDLConstants.NP_SCHEMA_XSD,
WSDLConstants.NU_SCHEMA_XSD);
- schema.setNamespaceContext(nsMap);
- serviceInfo.addSchema(schemaInfo);
+ schemaInfo = getOrCreateSchema(serviceInfo,
qname.getNamespaceURI(), true);
+ schema = schemaInfo.getSchema();
} else {
schema = schemaInfo.getSchema();
if (schema != null && schema.getElementByName(qname) != null) {
@@ -585,16 +581,26 @@
XmlSchemaElement el = new XmlSchemaElement();
el.setQName(qname);
el.setName(qname.getLocalPart());
-
- if (!isExistSchemaElement(schema, qname)) {
- schema.getItems().add(el);
- }
-
el.setMinOccurs(1);
el.setMaxOccurs(0);
el.setNillable(true);
+
+ if (!isExistSchemaElement(schema, qname)) {
+ schema.getItems().add(el);
+ schema.getElements().add(qname, el);
+ } else {
+ el = getExistingSchemaElement(schema, qname);
+ }
if (mpi.isElement()) {
+ XmlSchemaElement oldEl = (XmlSchemaElement)mpi.getXmlSchema();
+ if (!oldEl.getQName().equals(qname)) {
+ el.setSchemaTypeName(oldEl.getSchemaTypeName());
+ el.setSchemaType(oldEl.getSchemaType());
+ }
+ mpi.setXmlSchema(el);
+ mpi.setElementQName(qname);
+ mpi.setConcreteName(qname);
continue;
} else {
el.setSchemaTypeName(mpi.getTypeQName());
@@ -633,19 +639,20 @@
}
- private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
- boolean isExist = false;
+ private XmlSchemaElement getExistingSchemaElement(XmlSchema schema, QName
qn) {
for (Iterator ite = schema.getItems().getIterator(); ite.hasNext();) {
XmlSchemaObject obj = (XmlSchemaObject)ite.next();
if (obj instanceof XmlSchemaElement) {
XmlSchemaElement xsEle = (XmlSchemaElement)obj;
if (xsEle.getQName().equals(qn)) {
- isExist = true;
- break;
+ return xsEle;
}
}
}
- return isExist;
+ return null;
+ }
+ private boolean isExistSchemaElement(XmlSchema schema, QName qn) {
+ return getExistingSchemaElement(schema, qn) != null;
}
@@ -716,7 +723,9 @@
el.setName(qn.getLocalPart());
el.setQName(qn);
- SchemaInfo headerSchemaInfo = getOrCreateSchema(serviceInfo,
qn.getNamespaceURI());
+ SchemaInfo headerSchemaInfo = getOrCreateSchema(serviceInfo,
+
qn.getNamespaceURI(),
+
qualifyWrapperSchema());
if (!isExistSchemaElement(headerSchemaInfo.getSchema(), qn)) {
headerSchemaInfo.getSchema().getItems().add(el);
}
@@ -725,7 +734,9 @@
}
- private SchemaInfo getOrCreateSchema(ServiceInfo serviceInfo, String
namespaceURI) {
+ private SchemaInfo getOrCreateSchema(ServiceInfo serviceInfo,
+ String namespaceURI,
+ boolean qualified) {
for (SchemaInfo s : serviceInfo.getSchemas()) {
if (s.getNamespaceURI().equals(namespaceURI)) {
return s;
@@ -735,7 +746,7 @@
SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, namespaceURI);
XmlSchemaCollection col = new XmlSchemaCollection();
XmlSchema schema = new XmlSchema(namespaceURI, col);
- if (qualifyWrapperSchema()) {
+ if (qualified) {
schema.setElementFormDefault(new
XmlSchemaForm(XmlSchemaForm.QUALIFIED));
}
serviceInfo.setXmlSchemaCollection(col);
Modified: incubator/cxf/trunk/systests/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Tue Sep 4 13:00:03 2007
@@ -59,11 +59,11 @@
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/test/resources/wsdl/pizza_service.wsdl</wsdl>
- <extraargs>
+ <!--extraargs>
<extraarg>-exsh</extraarg>
<extraarg>true</extraarg>
<extraarg>-V</extraarg>
- </extraargs>
+ </extraargs-->
</wsdlOption>
</wsdlOptions>
</configuration>
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Tue Sep 4 13:00:03 2007
@@ -58,8 +58,38 @@
@BeforeClass
public static void startServers() throws Exception {
- assertTrue("server did not launch correctly",
launchServer(ServerMisc.class));
+ assertTrue("server did not launch correctly",
launchServer(ServerMisc.class, true));
}
+
+ @Test
+ public void testDocLitBare() throws Exception {
+ QName portName = new
QName("http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstService",
+ "DocLitBareCodeFirstServicePort");
+ QName servName = new
QName("http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstService",
+ "DocLitBareCodeFirstService");
+
+ //try without wsdl
+ Service service = Service.create(servName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
+ ServerMisc.DOCLITBARE_CODEFIRST_URL);
+ DocLitBareCodeFirstService port = service.getPort(portName,
+ DocLitBareCodeFirstService.class);
+ DocLitBareCodeFirstService.GreetMeRequest req =
+ new DocLitBareCodeFirstService.GreetMeRequest();
+ req.setName("Foo");
+ DocLitBareCodeFirstService.GreetMeResponse resp =
+ port.greetMe(req);
+
+ assertEquals(req.getName(), resp.getName());
+
+ //try with wsdl
+ service = Service.create(new URL(ServerMisc.DOCLITBARE_CODEFIRST_URL +
"?wsdl"),
+ servName);
+ port = service.getPort(portName, DocLitBareCodeFirstService.class);
+ resp = port.greetMe(req);
+ assertEquals(req.getName(), resp.getName());
+ }
+
@Test
public void testAnonymousComplexType() throws Exception {
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java?rev=572802&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
Tue Sep 4 13:00:03 2007
@@ -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.jaxws;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
[EMAIL PROTECTED](name = "DocLitBareCodeFirstService",
+ targetNamespace =
"http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstService")
[EMAIL PROTECTED](style = SOAPBinding.Style.DOCUMENT,
+ use = SOAPBinding.Use.LITERAL,
+ parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface DocLitBareCodeFirstService {
+
+ @WebMethod(operationName = "greetMe")
+ @WebResult(targetNamespace = "http://namespace/result", name =
"GreetMeBareResponse")
+ GreetMeResponse greetMe(
+ @WebParam(targetNamespace = "http://namespace/request")
+ GreetMeRequest gmr);
+
+
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "GreetMeRequest",
+ namespace = "http://cxf.apache.org/test/request/bare",
+ propOrder = { "name" })
+ @XmlRootElement(namespace = "http://cxf.apache.org/test/request/bare",
+ name = "GreetMeObject")
+ static class GreetMeRequest {
+ String name;
+
+ public GreetMeRequest() {
+ }
+
+ public void setName(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "GreetMeResponse",
+ namespace = "http://cxf.apache.org/test/request/bare",
+ propOrder = { "name" })
+ @XmlRootElement(namespace = "http://cxf.apache.org/test/request/bare",
+ name = "GreetMeResponseObject")
+ static class GreetMeResponse {
+ String name;
+
+ public GreetMeResponse() {
+ }
+
+ public void setName(String n) {
+ name = n;
+ }
+ public String getName() {
+ return name;
+ }
+ }
+}
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java?rev=572802&view=auto
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
(added)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
Tue Sep 4 13:00:03 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.jaxws;
+
+import javax.jws.WebService;
+
[EMAIL PROTECTED](endpointInterface =
"org.apache.cxf.systest.jaxws.DocLitBareCodeFirstService",
+ serviceName = "DocLitBareCodeFirstService",
+ portName = "DocLitBareCodeFirstServicePort",
+ targetNamespace =
"http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstService")
+public class DocLitBareCodeFirstServiceImpl implements
DocLitBareCodeFirstService {
+
+ public GreetMeResponse greetMe(GreetMeRequest gmr) {
+ GreetMeResponse resp = new GreetMeResponse();
+ resp.setName(gmr.getName());
+ return resp;
+ }
+
+}
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
Tue Sep 4 13:00:03 2007
@@ -34,8 +34,13 @@
"http://localhost:9003/RpcLitCodeFirstService/";
public static final String DOCLIT_CODEFIRST_BASE_URL =
"http://localhost:9003/DocLitWrappedCodeFirstServiceBaseService/";
+ public static final String DOCLITBARE_CODEFIRST_URL =
+ "http://localhost:9003/DocLitBareCodeFirstService/";
protected void run() {
+ Object implementor7 = new DocLitBareCodeFirstServiceImpl();
+ Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
+
Object implementor6 = new InterfaceInheritTestImpl();
Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6);
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_json_books.txt
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_json_books.txt?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_json_books.txt
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/rest/resources/expected_json_books.txt
Tue Sep 4 13:00:03 2007
@@ -1 +1 @@
-{"acme.books":{"acme.books":{"acme.id":"123","acme.name":"CXF in Action"}}}
\ No newline at end of file
+{"acme.Books":{"acme.books":{"acme.id":"123","acme.name":"CXF in Action"}}}
\ No newline at end of file
Modified:
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java?rev=572802&r1=572801&r2=572802&view=diff
==============================================================================
---
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
(original)
+++
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
Tue Sep 4 13:00:03 2007
@@ -24,6 +24,7 @@
import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
+import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.WebServiceException;
@@ -55,6 +56,7 @@
@Get
@HttpResource(location = "/customers")
@WebMethod
+ @WebResult(name = "customers")
public Customers getCustomers(@WebParam(name = "GetCustomers")
GetCustomers req) {
Customers cbean = new Customers();
cbean.setCustomer(customers.values());
@@ -69,6 +71,7 @@
@Get
@HttpResource(location = "/customers/{id}")
@WebMethod
+ @WebResult(name = "customer")
public Customer getCustomer(@WebParam(name = "GetCustomer") GetCustomer
getCustomer)
throws CustomerNotFoundFault {
Customer c = customers.get(getCustomer.getId());