You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sc...@apache.org on 2006/11/11 18:48:42 UTC
svn commit: r473764 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/client/
src/org/apache/axis2/jaxws/server/dispatcher/
src/org/apache/axis2/jaxws/spi/ test/org/apache/axis2/jaxws/provider/
test/org/apache/axis2/jaxws/pro...
Author: scheu
Date: Sat Nov 11 09:48:41 2006
New Revision: 473764
URL: http://svn.apache.org/viewvc?view=rev&rev=473764
Log:
AXIS2-1675
Contributor: Nikhil Thaker
Workaround for receiving message with no body contents
Added:
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/META-INF/echostring.wsdl
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/StringProvider.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/XMLDispatch.java Sat Nov 11 09:48:41 2006
@@ -1,203 +1,259 @@
-/*
- * Copyright 2006 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- */
-package org.apache.axis2.jaxws.client;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.ws.Service.Mode;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.client.async.AsyncResponse;
-import org.apache.axis2.jaxws.handler.PortData;
-import org.apache.axis2.jaxws.message.Block;
-import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.message.Protocol;
-import org.apache.axis2.jaxws.message.factory.BlockFactory;
-import org.apache.axis2.jaxws.message.factory.MessageFactory;
-import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
-import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
-import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
-import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class XMLDispatch<T> extends BaseDispatch<T> {
- private static final Log log = LogFactory.getLog(XMLDispatch.class);
-
- private Class type;
- private Class blockFactoryType;
-
- public XMLDispatch(PortData pd) {
- super(pd);
- }
-
- public Class getType() {
- return type;
- }
-
- public void setType(Class c) {
- type = c;
- }
-
- public AsyncResponse createAsyncResponseListener() {
- if (log.isDebugEnabled()) {
- log.debug("Creating new AsyncListener for XMLDispatch");
- }
- XMLDispatchAsyncListener al = new XMLDispatchAsyncListener();
- al.setMode(mode);
- al.setType(type);
- al.setBlockFactoryType(blockFactoryType);
- return al;
- }
-
- public Message createMessageFromValue(Object value) {
- type = value.getClass();
- if (log.isDebugEnabled()) {
- log.debug("Parameter type: " + type.getName());
- log.debug("Message mode: " + mode.name());
- }
-
- Block block = null;
-
- blockFactoryType = getBlockFactory(value);
- BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
- if (log.isDebugEnabled()) {
- log.debug("Loaded block factory type [" + blockFactoryType.getName());
- }
-
- Message message = null;
- if (mode.equals(Mode.PAYLOAD)) {
- try {
- MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
- block = factory.createFrom(value, null, null);
-
- // The protocol of the Message that is created should be based
- // on the binding information available.
- Protocol proto = Protocol.getProtocolForBinding(port.getBindingID());
- message = mf.create(proto);
- message.setBodyBlock(0, block);
- } catch (Exception e) {
- throw ExceptionFactory.makeWebServiceException(e);
- }
- }
- else if (mode.equals(Mode.MESSAGE)) {
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.Source;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.client.async.AsyncResponse;
+import org.apache.axis2.jaxws.handler.PortData;
+import org.apache.axis2.jaxws.message.Block;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.MessageException;
+import org.apache.axis2.jaxws.message.Protocol;
+import org.apache.axis2.jaxws.message.factory.BlockFactory;
+import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
+import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
+import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class XMLDispatch<T> extends BaseDispatch<T> {
+ private static final Log log = LogFactory.getLog(XMLDispatch.class);
+ private static QName SOAPENV_QNAME = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
+ private Class type;
+ private Class blockFactoryType;
+
+ public XMLDispatch(PortData pd) {
+ super(pd);
+ }
+
+ public Class getType() {
+ return type;
+ }
+
+ public void setType(Class c) {
+ type = c;
+ }
+
+ public AsyncResponse createAsyncResponseListener() {
+ if (log.isDebugEnabled()) {
+ log.debug("Creating new AsyncListener for XMLDispatch");
+ }
+ XMLDispatchAsyncListener al = new XMLDispatchAsyncListener();
+ al.setMode(mode);
+ al.setType(type);
+ al.setBlockFactoryType(blockFactoryType);
+ return al;
+ }
+
+ public Message createMessageFromValue(Object value) {
+ if(value!=null){
+ type = value.getClass();
+ if (log.isDebugEnabled()) {
+ log.debug("Parameter type: " + type.getName());
+ log.debug("Message mode: " + mode.name());
+ }
+ }else{
+ if (log.isDebugEnabled()) {
+ log.debug("Dispatch invoked with null parameter Value");
+ log.debug("creating empty soap message");
+ }
+ try{
+ blockFactoryType = getBlockFactory();
+ return createEmptyMessage(Protocol.getProtocolForBinding(port.getBindingID()));
+
+ }catch(MessageException e){
+ throw ExceptionFactory.makeWebServiceException(e);
+ }catch(XMLStreamException e){
+ throw ExceptionFactory.makeWebServiceException(e);
+ }
+
+ }
+ Block block = null;
+ blockFactoryType = getBlockFactory(value);
+ BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
+ if (log.isDebugEnabled()) {
+ log.debug("Loaded block factory type [" + blockFactoryType.getName());
+ }
+
+ Message message = null;
+ if (mode.equals(Mode.PAYLOAD)) {
try {
- MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
- // If the value contains just the xml data, then you can create the Message directly from the
- // Block. If the value contains attachments, you need to do more.
- // TODO For now the only value that contains Attachments is SOAPMessage
- if (value instanceof SOAPMessage) {
- message = mf.createFrom((SOAPMessage) value);
- } else {
- block = factory.createFrom(value, null, null);
- message = mf.createFrom(block, null);
- }
- } catch (Exception e) {
+ MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+ block = factory.createFrom(value, null, null);
+
+ // The protocol of the Message that is created should be based
+ // on the binding information available.
+ Protocol proto = Protocol.getProtocolForBinding(port.getBindingID());
+ message = mf.create(proto);
+ message.setBodyBlock(0, block);
+ } catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
- }
- }
-
- return message;
- }
-
- public Object getValueFromMessage(Message message) {
- Object value = null;
- Block block = null;
-
- if (log.isDebugEnabled()) {
- log.debug("Attempting to get the value object from the returned message");
- }
-
- try {
- if (mode.equals(Mode.PAYLOAD)) {
- BlockFactory factory = (BlockFactory) FactoryRegistry
- .getFactory(blockFactoryType);
- block = message.getBodyBlock(0, null, factory);
- value = block.getBusinessObject(true);
-
- } else if (mode.equals(Mode.MESSAGE)) {
- if (blockFactoryType.equals(SOAPEnvelopeBlockFactory.class)) {
- // This is an indication that we are in SOAPMessage Dispatch
- // Return the SOAPMessage
- value = message.getAsSOAPMessage();
-
- } else {
- // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock.
- // This is not performant. Scheu
- OMElement messageOM = message.getAsOMElement();
- String stringValue = messageOM.toString();
- QName soapEnvQname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
-
- XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
- Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);
- BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
- block = factory.createFrom(stringBlock, null);
- value = block.getBusinessObject(true);
- }
- }
-
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("An error occured while creating the block");
- }
- throw ExceptionFactory.makeWebServiceException(e);
- }
-
- if (log.isDebugEnabled()) {
- if (value == null)
- log.debug("Returning a null value");
- else
- log.debug("Returning value of type: " + value.getClass().getName());
- }
-
- return value;
- }
-
- private Class getBlockFactory(Object o) {
- if (o instanceof String) {
- if (log.isDebugEnabled()) {
- log.debug(">> returning XMLStringBlockFactory");
- }
- return XMLStringBlockFactory.class;
- }
- else if (Source.class.isAssignableFrom(o.getClass())) {
- if (log.isDebugEnabled()) {
- log.debug(">> returning SourceBlockFactory");
- }
- return SourceBlockFactory.class;
- }
- else if (SOAPMessage.class.isAssignableFrom(o.getClass())) {
- if (log.isDebugEnabled()) {
- log.debug(">> returning SOAPMessageFactory");
- }
- return SOAPEnvelopeBlockFactory.class;
- }
- else if (SOAPEnvelope.class.isAssignableFrom(o.getClass())) {
- if (log.isDebugEnabled()) {
- log.debug(">> returning SOAPEnvelope");
- }
- return SOAPEnvelopeBlockFactory.class;
- }
- if (log.isDebugEnabled()) {
- log.debug(">> ERROR: Factory not found");
- }
- return null;
- }
-}
+ }
+ }
+ else if (mode.equals(Mode.MESSAGE)) {
+ try {
+ MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+ // If the value contains just the xml data, then you can create the Message directly from the
+ // Block. If the value contains attachments, you need to do more.
+ // TODO For now the only value that contains Attachments is SOAPMessage
+ if (value instanceof SOAPMessage) {
+ message = mf.createFrom((SOAPMessage) value);
+ } else {
+ block = factory.createFrom(value, null, null);
+ message = mf.createFrom(block, null);
+ }
+ } catch (Exception e) {
+ throw ExceptionFactory.makeWebServiceException(e);
+ }
+ }
+
+ return message;
+ }
+
+ public Object getValueFromMessage(Message message) {
+ Object value = null;
+ Block block = null;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Attempting to get the value object from the returned message");
+ }
+
+ try {
+ if (mode.equals(Mode.PAYLOAD)) {
+ BlockFactory factory = (BlockFactory) FactoryRegistry
+ .getFactory(blockFactoryType);
+ block = message.getBodyBlock(0, null, factory);
+ value = block.getBusinessObject(true);
+
+ } else if (mode.equals(Mode.MESSAGE)) {
+ if (blockFactoryType.equals(SOAPEnvelopeBlockFactory.class)) {
+ // This is an indication that we are in SOAPMessage Dispatch
+ // Return the SOAPMessage
+ value = message.getAsSOAPMessage();
+
+ } else {
+ // TODO: This doesn't seem right to me. We should not have an intermediate StringBlock.
+ // This is not performant. Scheu
+ OMElement messageOM = message.getAsOMElement();
+ String stringValue = messageOM.toString();
+ QName soapEnvQname = new QName("http://schemas.xmlsoap.org/soap/envelope/", "Envelope");
+
+ XMLStringBlockFactory stringFactory = (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+ Block stringBlock = stringFactory.createFrom(stringValue, null, soapEnvQname);
+ BlockFactory factory = (BlockFactory) FactoryRegistry.getFactory(blockFactoryType);
+ block = factory.createFrom(stringBlock, null);
+ value = block.getBusinessObject(true);
+ }
+ }
+
+ } catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug("An error occured while creating the block");
+ }
+ throw ExceptionFactory.makeWebServiceException(e);
+ }
+
+ if (log.isDebugEnabled()) {
+ if (value == null)
+ log.debug("Returning a null value");
+ else
+ log.debug("Returning value of type: " + value.getClass().getName());
+ }
+
+ return value;
+ }
+
+ private Class getBlockFactory(Object o) {
+ if (o instanceof String) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning XMLStringBlockFactory");
+ }
+ return XMLStringBlockFactory.class;
+ }
+ else if (Source.class.isAssignableFrom(o.getClass())) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SourceBlockFactory");
+ }
+ return SourceBlockFactory.class;
+ }
+ else if (SOAPMessage.class.isAssignableFrom(o.getClass())) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SOAPMessageFactory");
+ }
+ return SOAPEnvelopeBlockFactory.class;
+ }
+ else if (SOAPEnvelope.class.isAssignableFrom(o.getClass())) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SOAPEnvelope");
+ }
+ return SOAPEnvelopeBlockFactory.class;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(">> ERROR: Factory not found");
+ }
+ return null;
+ }
+
+ private Class getBlockFactory() {
+
+ if (String.class.isAssignableFrom(type)) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning XMLStringBlockFactory");
+ }
+ return XMLStringBlockFactory.class;
+ }
+ else if (Source.class.isAssignableFrom(type)) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SourceBlockFactory");
+ }
+ return SourceBlockFactory.class;
+ }
+ else if (SOAPMessage.class.isAssignableFrom(type)) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SOAPMessageFactory");
+ }
+ return SOAPEnvelopeBlockFactory.class;
+ }
+ else if (SOAPEnvelope.class.isAssignableFrom(type)) {
+ if (log.isDebugEnabled()) {
+ log.debug(">> returning SOAPEnvelope");
+ }
+ return SOAPEnvelopeBlockFactory.class;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(">> ERROR: Factory not found");
+ }
+ return null;
+ }
+ private Message createEmptyMessage(Protocol protocol)throws MessageException, XMLStreamException{
+ MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+ Message m = mf.create(protocol);
+ return m;
+ }
+
+
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Sat Nov 11 09:48:41 2006
@@ -141,20 +141,30 @@
}
else {
// If it is not MESSAGE, then it is PAYLOAD (which is the default); only work with the body
- Block block = message.getBodyBlock(0, null, factory);
- requestParamValue = block.getBusinessObject(true);
- }
+ if(message.getNumBodyBlocks()!=0){
+ Block block = message.getBodyBlock(0, null, factory);
+ requestParamValue = block.getBusinessObject(true);
+ }else{
+ if(log.isDebugEnabled()){
+ log.debug("No body blocks in SOAPMessage, Calling provider method with null input parameters");
+ }
+ requestParamValue = null;
+ }
+ }
}
if (log.isDebugEnabled())
log.debug("Provider Type = " + providerType + "; parameter type = " + requestParamValue);
final Object input = providerType.cast(requestParamValue);
- if (log.isDebugEnabled()) {
+ if (input!=null && log.isDebugEnabled()) {
log.debug("Invoking Provider<" + providerType.getName() + "> with " +
"parameter of type " + input.getClass().getName());
}
-
+ if(input == null && log.isDebugEnabled()){
+ log.debug("Invoking Provider<" + providerType.getName() + "> with " +
+ "NULL input parameter");
+ }
// Invoke the actual Provider.invoke() method
Object responseParamValue = null;
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Sat Nov 11 09:48:41 2006
@@ -177,7 +177,7 @@
dispatch.setServiceClient(serviceClient);
dispatch.setServiceDelegate(this);
-
+ dispatch.setType(clazz);
return dispatch;
}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/StringProviderTests.java Sat Nov 11 09:48:41 2006
@@ -1,58 +1,82 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.
- */
-package org.apache.axis2.jaxws.provider;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-
-public class StringProviderTests extends ProviderTestCase {
-
- String endpointUrl = "http://localhost:8080/axis2/services/StringProviderService";
- String xmlString = "<invoke>test input</invoke>";
- private QName serviceName = new QName("http://ws.apache.org/axis2", "StringProviderService");
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- public StringProviderTests(String name) {
- super(name);
- }
-
- public void testProviderString() throws Exception {
- System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
-
- Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
-
- Dispatch<String> dispatch = svc
- .createDispatch(portName, String.class, Service.Mode.PAYLOAD);
-
- System.out.println(">> Invoking Dispatch<String> StringProviderService");
- String retVal = dispatch.invoke(xmlString);
- System.out.println(">> Response [" + retVal + "]");
- }
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.
+ */
+package org.apache.axis2.jaxws.provider;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+
+import org.apache.axis2.jaxws.dispatch.DispatchTestConstants;
+
+public class StringProviderTests extends ProviderTestCase {
+
+ String endpointUrl = "http://localhost:8080/axis2/services/StringProviderService";
+ String xmlString = "<invoke>test input</invoke>";
+ private QName serviceName = new QName("http://ws.apache.org/axis2", "StringProviderService");
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public StringProviderTests(String name) {
+ super(name);
+ }
+
+ public void testProviderString() throws Exception {
+ System.out.println("---------------------------------------");
+ System.out.println("test: " + getName());
+
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, endpointUrl);
+
+ Dispatch<String> dispatch = svc
+ .createDispatch(portName, String.class, Service.Mode.PAYLOAD);
+
+ System.out.println(">> Invoking Dispatch<String> StringProviderService");
+ String retVal = dispatch.invoke(xmlString);
+ System.out.println(">> Response [" + retVal + "]");
+ }
+
+ public void testSyncPayloadModeWithNull() throws Exception {
+ System.out.println("---------------------------------------");
+ System.out.println("test: " + getName());
+
+ Service svc = Service.create(serviceName);
+ svc.addPort(portName, null, endpointUrl);
+
+ Dispatch<String> dispatch = svc
+ .createDispatch(portName, String.class, Service.Mode.PAYLOAD);
+
+ System.out.println(">> Invoking Dispatch<String> StringProviderService");
+ dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
+ dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,"echoString");
+ // Invoke the Dispatch
+ System.out.println(">> Invoking sync Dispatch With Null Object");
+ String response = dispatch.invoke(null);
+
+ assertNotNull("dispatch invoke returned null", response);
+ System.out.println(response);
+
+ }
}
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/META-INF/echostring.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/META-INF/echostring.wsdl?view=auto&rev=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/META-INF/echostring.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/META-INF/echostring.wsdl Sat Nov 11 09:48:41 2006
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://stringprovider.sample.test.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StringProvider" targetNamespace="http://stringprovider.sample.test.org">
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://stringprovider.sample.test.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="echoResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="echo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="arg" type="xsd:string"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="echoResponse"/>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="echo"/>
+ </wsdl:message>
+ <wsdl:portType name="StringProviderPortType">
+ <wsdl:operation name="echoString">
+ <wsdl:input message="tns:echo"/>
+ <wsdl:output message="tns:echoResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StringProviderBinding" type="tns:StringProviderPortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echoString">
+ <soap:operation soapAction="http://stringprovider.sample.test.org/echoString"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StringProviderService">
+ <wsdl:port binding="tns:StringProviderBinding" name="StringProviderPort">
+ <soap:address location="http://localhost:8080/axis2/services/EchoService"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/StringProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/StringProvider.java?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/StringProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/provider/string/StringProvider.java Sat Nov 11 09:48:41 2006
@@ -23,7 +23,7 @@
public class StringProvider implements Provider<String> {
private static String responseGood = "<provider><message>request processed</message></provider>";
- private static String responseBad = "<provider><message>ERROR:null request received</message><provider>";
+ private static String responseBad = "<provider><message>ERROR:null request received</message></provider>";
public String invoke(String obj) {
if (obj != null) {
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl?view=diff&rev=473764&r1=473763&r2=473764
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/resourceinjection/META-INF/resourceinjection.wsdl Sat Nov 11 09:48:41 2006
@@ -33,7 +33,7 @@
<wsdl:binding name="ResourceInjectionBinding" type="tns:ResourceInjectionPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="echo">
- <soap:operation soapAction="http://resourceinjection.sample.test.org/NewOperation"/>
+ <soap:operation soapAction="http://resourceinjection.sample.test.org/echo"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org