Author: darran.lofthouse(a)jboss.com
Date: 2008-08-19 08:59:14 -0400 (Tue, 19 Aug 2008)
New Revision: 8113
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
Log:
[JBPAPP-1085] Implement standard message context properties.
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-08-18
10:54:25 UTC (rev 8112)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/core/jaxws/handler/MessageContextJAXWS.java 2008-08-19
12:59:14 UTC (rev 8113)
@@ -23,16 +23,22 @@
// $Id: MessageContextImpl.java 275 2006-05-04 21:36:29Z jason.greene(a)jboss.com $
+import java.io.IOException;
+import java.net.URL;
+
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.binding.SerializationContext;
import org.jboss.ws.core.jaxws.SerializationContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
+import org.xml.sax.InputSource;
/**
* The interface MessageContext abstracts the message context that is processed by a
handler in the handle method.
@@ -105,12 +111,43 @@
MessageContextAssociation.popMessageContext();
SOAPMessageContextJAXWS resContext = new SOAPMessageContextJAXWS(reqContext);
resContext.setSOAPMessage(null);
-
+
// Reverse the direction
resContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(!outbound));
-
+
MessageContextAssociation.pushMessageContext(resContext);
return resContext;
}
+ @Override
+ public void setOperationMetaData(OperationMetaData opMetaData)
+ {
+ super.setOperationMetaData(opMetaData);
+
+ // [JBWS-2031] Implement standard message context properties
+ if (opMetaData != null)
+ {
+ EndpointMetaData epMetaData = opMetaData.getEndpointMetaData();
+ ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+
+ URL wsdlURL = serviceMetaData.getWsdlFileOrLocation();
+ if (wsdlURL != null)
+ {
+ try
+ {
+ InputSource inputSource = new InputSource(wsdlURL.openStream());
+ put(MessageContext.WSDL_DESCRIPTION, inputSource);
+ }
+ catch (IOException ex)
+ {
+ throw new WSException("Cannot open: " + wsdlURL);
+ }
+ }
+
+ put(MessageContext.WSDL_SERVICE, serviceMetaData.getServiceName());
+ put(MessageContext.WSDL_PORT, epMetaData.getPortName());
+ put(MessageContext.WSDL_INTERFACE, epMetaData.getPortTypeName());
+ put(MessageContext.WSDL_OPERATION, opMetaData.getQName());
+ }
+ }
}
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-08-18
10:54:25 UTC (rev 8112)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-08-19
12:59:14 UTC (rev 8113)
@@ -78,7 +78,7 @@
private String wsdlFile;
private URL mappingLocation;
private String wsdlPublishLocation;
-
+
// The optional service handlers
private List<HandlerMetaDataJAXWS> handlers = new
ArrayList<HandlerMetaDataJAXWS>();
@@ -89,16 +89,16 @@
// Arbitrary properties given by <call-property>
private Properties properties;
-
+
// derived cached encoding style
private Use encStyle;
-
+
// The security configuration
private WSSecurityConfiguration securityConfig;
-
+
// The key to the wsdl cache
private String wsdlCacheKey;
-
+
public ServiceMetaData(UnifiedMetaData wsMetaData, QName serviceName)
{
this.wsMetaData = wsMetaData;
@@ -190,7 +190,7 @@
{
handlers.add(handler);
}
-
+
public List<HandlerMetaDataJAXWS> getHandlerMetaData()
{
return Collections.unmodifiableList(handlers);
@@ -279,6 +279,28 @@
*/
public WSDLDefinitions getWsdlDefinitions()
{
+ URL wsdlURL = getWsdlFileOrLocation();
+
+ WSDLDefinitions wsdlDefinitions = null;
+ if (wsdlURL != null)
+ {
+ // The key should not after it is assigned
+ if (wsdlCacheKey == null)
+ wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation :
wsdlFile);
+
+ wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
+ if (wsdlDefinitions == null)
+ {
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ wsdlDefinitions = factory.parse(wsdlURL);
+ wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
+ }
+ }
+ return wsdlDefinitions;
+ }
+
+ public URL getWsdlFileOrLocation()
+ {
URL wsdlURL = wsdlLocation;
if (wsdlURL == null && wsdlFile != null)
{
@@ -291,7 +313,7 @@
{
// ignore
}
-
+
// Try wsdlFile as child from root
if (wsdlURL == null)
{
@@ -306,23 +328,8 @@
}
}
}
-
- WSDLDefinitions wsdlDefinitions = null;
- if (wsdlURL != null)
- {
- // The key should not after it is assigned
- if (wsdlCacheKey == null)
- wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation :
wsdlFile);
-
- wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
- if (wsdlDefinitions == null)
- {
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- wsdlDefinitions = factory.parse(wsdlURL);
- wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
- }
- }
- return wsdlDefinitions;
+
+ return wsdlURL;
}
public TypeMappingImpl getTypeMapping()
Show replies by date