Author: jliu
Date: Fri Jul 6 03:56:50 2007
New Revision: 553833
URL: http://svn.apache.org/viewvc?view=rev&rev=553833
Log:
Apply patch for CXF-731 on behalf of Jeff Zhang
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Fri Jul 6 03:56:50 2007
@@ -19,6 +19,8 @@
package org.apache.cxf.endpoint;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -450,6 +452,32 @@
exchange.put(MessageObserver.class, this);
exchange.put(Retryable.class, this);
exchange.put(Bus.class, bus);
+
+ if (endpoint != null && boi != null) {
+
+ EndpointInfo endpointInfo = endpoint.getEndpointInfo();
+ exchange.put(Message.WSDL_OPERATION, boi.getName());
+
+ QName serviceQName = endpointInfo.getService().getName();
+ exchange.put(Message.WSDL_SERVICE, serviceQName);
+
+ QName interfaceQName =
endpointInfo.getService().getInterface().getName();
+ exchange.put(Message.WSDL_INTERFACE, interfaceQName);
+
+ QName portQName = endpointInfo.getName();
+ exchange.put(Message.WSDL_PORT, portQName);
+ URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
+ if (wsdlDescription == null) {
+ String address = endpointInfo.getAddress();
+ try {
+ wsdlDescription = new URI(address + "?wsdl");
+ } catch (URISyntaxException e) {
+ // do nothing
+ }
+ endpointInfo.setProperty("URI", wsdlDescription);
+ }
+ exchange.put(Message.WSDL_DESCRIPTION, wsdlDescription);
+ }
}
protected PhaseInterceptorChain setupInterceptorChain(Endpoint endpoint) {
Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
(original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
Fri Jul 6 03:56:50 2007
@@ -20,6 +20,11 @@
package org.apache.cxf.transport;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.namespace.QName;
+
import org.apache.cxf.Bus;
import org.apache.cxf.binding.Binding;
import org.apache.cxf.endpoint.Endpoint;
@@ -30,6 +35,7 @@
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.phase.PhaseManager;
import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.EndpointInfo;
public class ChainInitiationObserver implements MessageObserver {
protected Endpoint endpoint;
@@ -80,6 +86,30 @@
if (exchange.getDestination() == null) {
exchange.setDestination(m.getDestination());
}
+ if (endpoint != null) {
+
+ EndpointInfo endpointInfo = endpoint.getEndpointInfo();
+
+ QName serviceQName = endpointInfo.getService().getName();
+ exchange.put(Message.WSDL_SERVICE, serviceQName);
+
+ QName interfaceQName =
endpointInfo.getService().getInterface().getName();
+ exchange.put(Message.WSDL_INTERFACE, interfaceQName);
+
+ QName portQName = endpointInfo.getName();
+ exchange.put(Message.WSDL_PORT, portQName);
+ URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
+ if (wsdlDescription == null) {
+ String address = endpointInfo.getAddress();
+ try {
+ wsdlDescription = new URI(address + "?wsdl");
+ } catch (URISyntaxException e) {
+ // do nothing
+ }
+ endpointInfo.setProperty("URI", wsdlDescription);
+ }
+ exchange.put(Message.WSDL_DESCRIPTION, wsdlDescription);
+ }
}
public Endpoint getEndpoint() {
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Fri Jul 6 03:56:50 2007
@@ -20,6 +20,8 @@
package org.apache.cxf.jaxws;
import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -33,6 +35,7 @@
import javax.activation.DataSource;
import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPFault;
@@ -71,6 +74,7 @@
import org.apache.cxf.phase.Phase;
import org.apache.cxf.phase.PhaseInterceptorChain;
import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.MessageObserver;
public class DispatchImpl<T> extends BindingProviderImpl implements
Dispatch<T>, MessageObserver {
@@ -350,6 +354,31 @@
exchange.put(MessageObserver.class, this);
exchange.put(Bus.class, bus);
+
+ if (endpoint != null) {
+
+ EndpointInfo endpointInfo = endpoint.getEndpointInfo();
+
+ QName serviceQName = endpointInfo.getService().getName();
+ exchange.put(Message.WSDL_SERVICE, serviceQName);
+
+ QName interfaceQName =
endpointInfo.getService().getInterface().getName();
+ exchange.put(Message.WSDL_INTERFACE, interfaceQName);
+
+ QName portQName = endpointInfo.getName();
+ exchange.put(Message.WSDL_PORT, portQName);
+ URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
+ if (wsdlDescription == null) {
+ String address = endpointInfo.getAddress();
+ try {
+ wsdlDescription = new URI(address + "?wsdl");
+ } catch (URISyntaxException e) {
+ // do nothing
+ }
+ endpointInfo.setProperty("URI", wsdlDescription);
+ }
+ exchange.put(Message.WSDL_DESCRIPTION, wsdlDescription);
+ }
}
}
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
(original)
+++
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Fri Jul 6 03:56:50 2007
@@ -70,7 +70,7 @@
MessageContext.SERVLET_RESPONSE);
cxf2jaxwsMap.put("HTTP.CONTEXT",
MessageContext.SERVLET_CONTEXT);
-
+
jaxws2cxfMap.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
Message.ENDPOINT_ADDRESS);
jaxws2cxfMap.put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
@@ -164,6 +164,13 @@
}
public static void mapCxf2Jaxws(Exchange exchange, WrappedMessageContext
ctx, boolean requestor) {
+
+ ctx.put(Message.WSDL_DESCRIPTION,
exchange.get(Message.WSDL_DESCRIPTION));
+ ctx.put(Message.WSDL_INTERFACE, exchange.get(Message.WSDL_INTERFACE));
+ ctx.put(Message.WSDL_OPERATION, exchange.get(Message.WSDL_OPERATION));
+ ctx.put(Message.WSDL_PORT, exchange.get(Message.WSDL_PORT));
+ ctx.put(Message.WSDL_SERVICE, exchange.get(Message.WSDL_SERVICE));
+
mapCxf2Jaxws(ctx);
Message inMessage = exchange.getInMessage();
Message outMessage = exchange.getOutMessage();
@@ -216,7 +223,6 @@
}
}
-
}
private static void addMessageAttachments(WrappedMessageContext ctx,
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Fri Jul 6 03:56:50 2007
@@ -57,7 +57,6 @@
import org.apache.handler_test.types.PingResponse;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
public class HandlerInvocationTest extends AbstractBusClientServerTestBase {
@@ -683,7 +682,7 @@
Boolean outbound =
(Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (outbound) {
throw new RuntimeException(clientHandlerMessage);
- }
+ }
return true;
}
};
@@ -1011,7 +1010,6 @@
}
@Test
- @Ignore("This is not working ,see CXF-731")
public void testDescription() throws PingException {
TestHandler<LogicalMessageContext> handler = new
TestHandler<LogicalMessageContext>(false) {
public boolean handleMessage(LogicalMessageContext ctx) {
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java?view=diff&rev=553833&r1=553832&r2=553833
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/handlers/TestSOAPHandler.java
Fri Jul 6 03:56:50 2007
@@ -74,9 +74,14 @@
boolean continueProcessing = true;
+ if (!isValidWsdlDescription(ctx.get(MessageContext.WSDL_DESCRIPTION)))
{
+ throw new RuntimeException("can't find WsdlDescription throws
RuntimeException");
+ }
+
try {
methodCalled("handleMessage");
printHandlerInfo("handleMessage", isOutbound(ctx));
+
Object b = ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
boolean outbound = (Boolean)b;
SOAPMessage msg = ctx.getMessage();
@@ -258,5 +263,10 @@
public String toString() {
return getHandlerId();
- }
+ }
+
+ private boolean isValidWsdlDescription(Object wsdlDescription) {
+ return (wsdlDescription != null)
+ && ((wsdlDescription instanceof java.net.URI) ||
(wsdlDescription instanceof java.net.URL));
+ }
}