You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ng...@apache.org on 2006/12/13 18:07:39 UTC
svn commit: r486744 - in /webservices/axis2/trunk/java/modules/jaxws:
src/org/apache/axis2/jaxws/core/
src/org/apache/axis2/jaxws/core/controller/ test-resources/wsdl/
test/org/apache/axis2/jaxws/client/ test/org/apache/axis2/jaxws/framework/
Author: ngallardo
Date: Wed Dec 13 09:07:37 2006
New Revision: 486744
URL: http://svn.apache.org/viewvc?view=rev&rev=486744
Log:
Fixing an NPE in JAX-WS on a bad endpoint address.
Added:
webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/BadEndpointAddress.wsdl
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/ClientConfigTests.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?view=diff&rev=486744&r1=486743&r2=486744
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Wed Dec 13 09:07:37 2006
@@ -63,10 +63,15 @@
}
public MessageContext(org.apache.axis2.context.MessageContext mc) throws MessageException {
- axisMsgCtx = mc;
properties = new HashMap<String, Object>();
- message = MessageUtils.getMessageFromMessageContext(mc);
+ if (mc != null) {
+ axisMsgCtx = mc;
+ message = MessageUtils.getMessageFromMessageContext(mc);
+ }
+ else {
+ axisMsgCtx = new org.apache.axis2.context.MessageContext();
+ }
}
public InvocationContext getInvocationContext() {
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=486744&r1=486743&r2=486744
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Wed Dec 13 09:07:37 2006
@@ -80,7 +80,7 @@
private static boolean debug = log.isDebugEnabled();
/*
- * (non-Javadoc)
+ * (non-Javadoc)
* @see org.apache.axis2.jaxws.core.controller.InvocationController#invoke(org.apache.axis2.jaxws.core.InvocationContext)
*/
public MessageContext doInvoke(MessageContext request) {
@@ -130,18 +130,16 @@
// Collect the response MessageContext and envelope
axisResponseMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
response = new MessageContext(axisResponseMsgCtx);
-
- /*
- * If the Message object is still null, then it's possible that a
- * local AxisFault was thrown and we need to save it for later throwing
- * We do not want to create a message and go through the whole handler or
- * XMLFault processing because it's unnecessary.
- *
- * Same is true if we get a valid non-fault server response but some jaxws
- * client processing (a handler, perhaps) throws an exception.
- *
- * If the response message itself is a fault message, let it pass through.
- */
+
+ // If the Message object is still null, then it's possible that a
+ // local AxisFault was thrown and we need to save it for later throwing
+ // We do not want to create a message and go through the whole handler or
+ // XMLFault processing because it's unnecessary.
+ //
+ // Same is true if we get a valid non-fault server response but some jaxws
+ // client processing (a handler, perhaps) throws an exception.
+ //
+ // If the response message itself is a fault message, let it pass through.
if ((faultexception != null) && ((response.getMessage() == null)
|| (!response.getMessage().isFault()))) {
MessageFactory factory = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
Added: webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/BadEndpointAddress.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/BadEndpointAddress.wsdl?view=auto&rev=486744
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/BadEndpointAddress.wsdl (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test-resources/wsdl/BadEndpointAddress.wsdl Wed Dec 13 09:07:37 2006
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://jaxws.axis2.apache.org"
+ xmlns:tns="http://jaxws.axis2.apache.org"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
+
+ <types>
+ <xsd:schema targetNamespace="http://jaxws.axis2.apache.org"
+ xmlns:tns="http://jaxws.axis2.apache.org"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <complexType name="echoType">
+ <sequence>
+ <element name="request" type="xsd:string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="echoResponseType">
+ <sequence>
+ <element name="response" type="xsd:string"/>
+ </sequence>
+ </complexType>
+
+ <element name="echo" type="tns:echoType"/>
+ <element name="echoResponse" type="tns:echoResponseType"/>
+
+ </xsd:schema>
+ </types>
+
+ <message name="echo">
+ <part name="parameters" element="tns:echo"/>
+ </message>
+
+ <message name="echoResponse">
+ <part name="parameters" element="tns:echoResponse"/>
+ </message>
+
+ <portType name="Echo">
+ <operation name="echo">
+ <input message="tns:echo" />
+ <output message="tns:echoResponse" />
+ </operation>
+ </portType>
+
+ <binding name="EchoBinding" type="tns:Echo">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="echo">
+ <soap:operation soapAction=""/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ </operation>
+ </binding>
+
+ <service name="EchoService">
+ <port binding="tns:EchoBinding" name="EchoPort">
+ <soap:address location="this is an invalid string"/>
+ </port>
+ </service>
+</definitions>
Added: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/ClientConfigTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/ClientConfigTests.java?view=auto&rev=486744
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/ClientConfigTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/client/ClientConfigTests.java Wed Dec 13 09:07:37 2006
@@ -0,0 +1,37 @@
+package org.apache.axis2.jaxws.client;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import junit.framework.TestCase;
+
+public class ClientConfigTests extends TestCase {
+
+ public ClientConfigTests(String name) {
+ super(name);
+ }
+
+ public void testBadWsdlUrl() throws Exception {
+ URL url = new URL("file:./test-resources/wsdl/BadEndpointAddress.wsdl");
+
+ Service svc = Service.create(url, new QName("http://jaxws.axis2.apache.org", "EchoService"));
+ Dispatch dispatch = svc.createDispatch(new QName("http://jaxws.axis2.apache.org", "EchoPort"),
+ String.class, Mode.PAYLOAD);
+
+ try {
+ dispatch.invoke("");
+
+ // If an exception wasn't thrown, then it's an error.
+ fail();
+ } catch (WebServiceException e) {
+ // We should only get a WebServiceException here. Anything else
+ // is a failure.
+ System.out.println("[pass] - the proper fault type was thrown");
+ }
+ }
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?view=diff&rev=486744&r1=486743&r2=486744
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Wed Dec 13 09:07:37 2006
@@ -23,6 +23,7 @@
import org.apache.axis2.jaxws.anytype.tests.AnyTypeTests;
import org.apache.axis2.jaxws.attachments.MTOMSerializationTests;
+import org.apache.axis2.jaxws.client.ClientConfigTests;
import org.apache.axis2.jaxws.client.DispatchSoapActionTests;
import org.apache.axis2.jaxws.client.PropertyValueTests;
import org.apache.axis2.jaxws.client.ProxySoapActionTests;
@@ -100,6 +101,7 @@
suite.addTestSuite(DispatchSoapActionTests.class);
suite.addTestSuite(ProxySoapActionTests.class);
suite.addTestSuite(PropertyValueTests.class);
+ suite.addTestSuite(ClientConfigTests.class);
suite.addTestSuite(BlockTests.class);
suite.addTestSuite(MessageTests.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org