Author: mmerz
Date: Wed Apr 27 16:50:55 2005
New Revision: 165070
URL: http://svn.apache.org/viewcvs?rev=165070&view=rev
Log:
Fixed namespace issue with RPC style webservices.
Contributor: Daryoush Mehrtash
Added:
incubator/beehive/trunk/wsm/drt/webapp/WEB-INF/src/org/apache/beehive/wsm/axis/FakeDocWebService.jws
Modified:
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Modified:
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java?rev=165070&r1=165069&r2=165070&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
(original)
+++
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/handlers/AnnotatedWebServiceDeploymentHandlerTest.java
Wed Apr 27 16:50:55 2005
@@ -43,23 +43,23 @@
*/
public class AnnotatedWebServiceDeploymentHandlerTest extends TestCase {
- private final static String CLASSNAME =
"org.apache.beehive.wsm.axis.FakeWebService";
-
- private SOAPService fakeSOAPService;
- public void setUp() throws Exception {
- AnnotatedWebServiceDeploymentHandler hdlr =
- new AnnotatedWebServiceDeploymentHandler();
- Class clazz = Class.forName(CLASSNAME);
- fakeSOAPService = hdlr.getSOAPService(clazz);
- }
public void tearDown() {
// empty
}
- public void testInvokeSOAPService() throws Exception {
- MessageContext mc = new MessageContext(new AxisServer());
+ public void testInvokeRPCSOAPService() throws Exception {
+ final String classname =
"org.apache.beehive.wsm.axis.FakeWebService"; // rpc style web service
+
+ SOAPService fakeSOAPService;
+ AnnotatedWebServiceDeploymentHandler hdlr =
+ new AnnotatedWebServiceDeploymentHandler();
+ Class clazz = Class.forName(classname);
+ fakeSOAPService = hdlr.getSOAPService(clazz);
+
+
+ MessageContext mc = new MessageContext(new AxisServer());
SOAPEnvelope env = new SOAPEnvelope();
env.addBodyElement(new RPCElement("doInvocation"));
mc.setRequestMessage(new Message(env));
@@ -74,10 +74,43 @@
assertEquals("doInvocationResponse", n.getLocalName());
n = n.getFirstChild();
assertEquals("invocationSucceeded", n.getLocalName());
- assertEquals("http://result.target.namespace/",
n.getNamespaceURI());
+ // namespace must be null in the RPC style
+ assertEquals("", n.getNamespaceURI());
n = n.getFirstChild();
assertNotNull(n);
assertEquals("true", n.getNodeValue());
}
}
+
+ public void testInvokeDOCSOAPService() throws Exception {
+ final String classname =
"org.apache.beehive.wsm.axis.FakeDocWebService"; // doc style web service
+
+ SOAPService fakeSOAPService;
+ AnnotatedWebServiceDeploymentHandler hdlr =
+ new AnnotatedWebServiceDeploymentHandler();
+ Class clazz = Class.forName(classname);
+ fakeSOAPService = hdlr.getSOAPService(clazz);
+
+
+ MessageContext mc = new MessageContext(new
AxisServer());
+ SOAPEnvelope env = new SOAPEnvelope();
+ env.addBodyElement(new RPCElement("doInvocation"));
+ mc.setRequestMessage(new Message(env));
+ mc.setService(fakeSOAPService);
+ fakeSOAPService.invoke(mc);
+ Message msg = mc.getResponseMessage();
+ msg.saveChanges();
+ assertNotNull(msg);
+ if (null != msg)
+ {
+ Node n = msg.getSOAPBody().getFirstChild();
+ assertEquals("doInvocationResponse", n.getLocalName());
+ n = n.getFirstChild();
+ assertEquals("invocationSucceeded", n.getLocalName());
+ assertEquals("http://result.target.namespace/",
n.getNamespaceURI());
+ n = n.getFirstChild();
+ assertNotNull(n);
+ assertEquals("true", n.getNodeValue());
+ }
+ }
}
Added:
incubator/beehive/trunk/wsm/drt/webapp/WEB-INF/src/org/apache/beehive/wsm/axis/FakeDocWebService.jws
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/webapp/WEB-INF/src/org/apache/beehive/wsm/axis/FakeDocWebService.jws?rev=165070&view=auto
==============================================================================
---
incubator/beehive/trunk/wsm/drt/webapp/WEB-INF/src/org/apache/beehive/wsm/axis/FakeDocWebService.jws
(added)
+++
incubator/beehive/trunk/wsm/drt/webapp/WEB-INF/src/org/apache/beehive/wsm/axis/FakeDocWebService.jws
Wed Apr 27 16:50:55 2005
@@ -0,0 +1,51 @@
+package org.apache.beehive.wsm.axis;
+
+/*
+ * FakeDocWebService.java
+ *
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ *
+ * Licensed 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.
+ *
+ */
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
[EMAIL PROTECTED](
+ name = "FakeDocName",
+ serviceName = "FakeDocServiceName",
+ targetNamespace = "http://fake.target.namespace/")
[EMAIL PROTECTED](style = SOAPBinding.Style.DOCUMENT)
+public class FakeDocWebService {
+
+ @WebMethod(action = "invocationAction")
+ @WebResult(
+ name = "invocationSucceeded",
+ targetNamespace = "http://result.target.namespace/")
+ public String doInvocation() {
+ return "true";
+ }
+
+ @WebMethod(operationName = "processThingy")
+ @Oneway
+ public void processModeratelyComplexObject(@WebParam(name = "thingy")
ModeratelyComplexObject mco) {
+ // empty: return values not allowed for @Oneway
+ }
+}
Modified:
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java?rev=165070&r1=165069&r2=165070&view=diff
==============================================================================
---
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
(original)
+++
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Wed Apr 27 16:50:55 2005
@@ -44,6 +44,7 @@
import org.apache.xmlbeans.XmlObject;
import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
import javax.wsdl.OperationType;
import javax.xml.namespace.QName;
import javax.xml.rpc.holders.Holder;
@@ -123,7 +124,10 @@
if (meth.isOneWay()) {
od.setMep(OperationType.ONE_WAY);
} else {
- od.setReturnQName(new QName(meth.getWrTargetNamespace(),
+ String namespace = "" ;
+ // namespace only should be added for
document style, RPC style doesn't need name space for return type.
+ if( wsm.getSoapBinding().getStyle() ==
SOAPBinding.Style.DOCUMENT) namespace = meth.getWrTargetNamespace();
+ od.setReturnQName(new QName(namespace,
meth.getWrName()));
final Class returnType = meth.getJavaReturnType();
QName qn = configureTypeMapping(sd, returnType, meth
@@ -153,7 +157,10 @@
}
// set QName
- QName paramQName = new QName(param.getWpTargetNamespace(),
+ String namespace = "" ;
+ // namespace only should be added for
document style, RPC style doesn't need name space for parameter names.
+ if( wsm.getSoapBinding().getStyle() ==
SOAPBinding.Style.DOCUMENT) namespace = param.getWpTargetNamespace();
+ QName paramQName = new QName(namespace,
param.getWpName());
pd.setQName(paramQName);