You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2007/03/11 09:02:44 UTC
svn commit: r516867 - in /incubator/cxf/trunk:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/
systests/src/test/java/org/apache/cxf/systest/jaxws/
Author: ningjiang
Date: Sun Mar 11 00:02:43 2007
New Revision: 516867
URL: http://svn.apache.org/viewvc?view=rev&rev=516867
Log:
[CXF-455] Fixed the issue of building service from class with the right MessageInputName and MessageOutputName
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Sun Mar 11 00:02:43 2007
@@ -323,6 +323,36 @@
private WebResult getWebResult(Method method) {
return method.getAnnotation(WebResult.class);
}
+
+ @Override
+ public QName getOutputMessageName(OperationInfo op, Method method) {
+ Method m = getDeclaredMethod(method);
+ ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
+ if (rw == null) {
+ return null;
+ }
+ String nm = rw.targetNamespace();
+ String lp = rw.localName();
+ if (nm.length() > 0 && lp.length() > 0) {
+ return new QName(nm, lp);
+ }
+ return null;
+ }
+
+ @Override
+ public QName getInputMessageName(OperationInfo op, Method method) {
+ Method m = getDeclaredMethod(method);
+ RequestWrapper rw = m.getAnnotation(RequestWrapper.class);
+ if (rw == null) {
+ return null;
+ }
+ String nm = rw.targetNamespace();
+ String lp = rw.localName();
+ if (nm.length() > 0 && lp.length() > 0) {
+ return new QName(nm, lp);
+ }
+ return null;
+ }
@Override
public Boolean isOutParam(Method method, int j) {
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java Sun Mar 11 00:02:43 2007
@@ -70,11 +70,11 @@
return null;
}
- public QName getInputMessageName(final OperationInfo op) {
+ public QName getInputMessageName(final OperationInfo op, Method method) {
return null;
}
- public QName getOutputMessageName(final OperationInfo op) {
+ public QName getOutputMessageName(final OperationInfo op, Method method) {
return null;
}
Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/DefaultServiceConfiguration.java Sun Mar 11 00:02:43 2007
@@ -76,7 +76,7 @@
}
@Override
- public QName getInputMessageName(OperationInfo op) {
+ public QName getInputMessageName(OperationInfo op, Method method) {
return new QName(op.getName().getNamespaceURI(), op.getName().getLocalPart());
}
@@ -125,7 +125,7 @@
}
@Override
- public QName getOutputMessageName(OperationInfo op) {
+ public QName getOutputMessageName(OperationInfo op, Method method) {
return new QName(op.getName().getNamespaceURI(), op.getName().getLocalPart() + "Response");
}
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?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- 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 Sun Mar 11 00:02:43 2007
@@ -308,27 +308,26 @@
createMessageParts(intf, uOp, m);
if (uOp.hasInput()) {
- MessageInfo msg = new MessageInfo(op, op.getName());
+ MessageInfo msg = new MessageInfo(op, uOp.getInput().getName());
op.setInput(uOp.getInputName(), msg);
- msg.addMessagePart(op.getName());
+ msg.addMessagePart(uOp.getInput().getName());
- for (MessagePartInfo p : uOp.getInput().getMessageParts()) {
- p.setConcreteName(new QName(getServiceNamespace(),
- p.getName().getLocalPart()));
+ for (MessagePartInfo p : uOp.getInput().getMessageParts()) {
+ p.setConcreteName(p.getName());
}
}
if (uOp.hasOutput()) {
- QName name = new QName(op.getName().getNamespaceURI(),
- op.getName().getLocalPart() + "Response");
+
+ QName name = uOp.getOutput().getName();
MessageInfo msg = new MessageInfo(op, name);
op.setOutput(uOp.getOutputName(), msg);
+
MessagePartInfo part = msg.addMessagePart(name);
part.setIndex(-1);
for (MessagePartInfo p : uOp.getOutput().getMessageParts()) {
- p.setConcreteName(new QName(getServiceNamespace(),
- p.getName().getLocalPart()));
+ p.setConcreteName(p.getName());
}
}
} else {
@@ -430,12 +429,12 @@
final Class[] paramClasses = method.getParameterTypes();
// Setup the input message
- MessageInfo inMsg = op.createMessage(getInputMessageName(op));
+ MessageInfo inMsg = op.createMessage(getInputMessageName(op, method));
op.setInput(inMsg.getName().getLocalPart(), inMsg);
for (int j = 0; j < paramClasses.length; j++) {
if (isInParam(method, j)) {
- final QName q = getInParameterName(op, method, j);
+ final QName q = getInParameterName(op, method, j);
MessagePartInfo part = inMsg.addMessagePart(q);
initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
//TODO - RPC vs DOC (type vs element)
@@ -448,12 +447,12 @@
if (hasOutMessage(method)) {
// Setup the output message
- MessageInfo outMsg = op.createMessage(createOutputMessageName(op));
+ MessageInfo outMsg = op.createMessage(createOutputMessageName(op, method));
op.setOutput(outMsg.getName().getLocalPart(), outMsg);
final Class<?> returnType = method.getReturnType();
if (!returnType.isAssignableFrom(void.class)) {
- final QName q = getOutParameterName(op, method, -1);
+ final QName q = getOutParameterName(op, method, -1);
MessagePartInfo part = outMsg.addMessagePart(q);
initializeParameter(part, method.getReturnType(), method.getGenericReturnType());
part.setIndex(-1);
@@ -615,22 +614,22 @@
return true;
}
- protected QName getInputMessageName(final OperationInfo op) {
+ protected QName getInputMessageName(final OperationInfo op, final Method method) {
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
- QName q = c.getInputMessageName(op);
- if (q != null) {
+ QName q = c.getInputMessageName(op, method);
+ if (q != null) {
return q;
}
}
throw new IllegalStateException("ServiceConfiguration must provide a value!");
}
- protected QName createOutputMessageName(final OperationInfo op) {
+ protected QName createOutputMessageName(final OperationInfo op, final Method method) {
for (Iterator itr = serviceConfigurations.iterator(); itr.hasNext();) {
AbstractServiceConfiguration c = (AbstractServiceConfiguration)itr.next();
- QName q = c.getOutputMessageName(op);
- if (q != null) {
+ QName q = c.getOutputMessageName(op, method);
+ if (q != null) {
return q;
}
}
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterBaseNoWsdlTest.java Sun Mar 11 00:02:43 2007
@@ -26,7 +26,6 @@
import org.apache.cxf.greeter_control.GreeterService;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
public class ClientServerGreeterBaseNoWsdlTest extends AbstractBusClientServerTestBase {
@@ -37,8 +36,7 @@
launchServer(ServerGreeterBaseNoWsdl.class));
}
- @Test
- @Ignore
+ @Test
public void testInvocation() throws Exception {
GreeterService service = new GreeterService();
Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java?view=diff&rev=516867&r1=516866&r2=516867
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java Sun Mar 11 00:02:43 2007
@@ -26,7 +26,6 @@
import org.apache.cxf.greeter_control.GreeterService;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
public class ClientServerGreeterNoWsdlTest extends AbstractBusClientServerTestBase {
@@ -37,8 +36,7 @@
launchServer(ServerGreeterNoWsdl.class));
}
- @Test
- @Ignore
+ @Test
public void testInvocation() throws Exception {
GreeterService service = new GreeterService();