JBossWS SVN: r9007 - stack/native/trunk/modules/resources/src/main/resources/resources.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2009-01-09 18:33:37 -0500 (Fri, 09 Jan 2009)
New Revision: 9007
Modified:
stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
Log:
[JBWS-2431] fix native AS 4.2.x deployment
Modified: stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml
===================================================================
--- stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2009-01-09 17:56:34 UTC (rev 9006)
+++ stack/native/trunk/modules/resources/src/main/resources/resources/jbossws-deploy-macros.xml 2009-01-09 23:33:37 UTC (rev 9007)
@@ -558,11 +558,12 @@
<!-- Deploy JBossWS -->
<!-- ================================================================== -->
- <target name="deploy-jbossws-native42" depends="check-parameters">
+ <available classname="java.io.Console" property="HAVE_JDK16_OR_ABOVE"/>
+
+ <target name="deploy-jbossws-native42" depends="check-parameters,deploy-jbossws-endorsed">
<macro-deploy-jbossws-bin targetdir="${installserver}/../../bin" artifactsdir="${artifactsdir}"/>
<macro-deploy-jbossws-client42 targetdir="${installserver}/../../client" thirdpartydir="${thirdpartydir}" jbossid="${jbossid}"/>
<macro-deploy-jbossws-lib42 targetdir="${installserver}/../../lib" thirdpartydir="${thirdpartydir}"/>
- <macro-deploy-jbossws-endorsed targetdir="${installserver}/../../lib/endorsed" thirdpartydir="${thirdpartydir}"/>
<macro-deploy-jbossws-server-lib42 targetdir="${installserver}/lib" thirdpartydir="${thirdpartydir}" jbossid="${jbossid}"/>
<macro-deploy-jbossws-sar42 targetdir="${installserver}/deploy/jbossws.sar" artifactsdir="${artifactsdir}" thirdpartydir="${thirdpartydir}" jbossid="${jbossid}"/>
<macro-deploy-juddi-sar targetdir="${installserver}/deploy/juddi-service.sar" thirdpartydir="${thirdpartydir}"/>
@@ -601,6 +602,10 @@
<macro-deploy-juddi-sar targetdir="${installserver}/deploy/juddi-service.sar" thirdpartydir="${thirdpartydir}"/>
</target>
+ <target name="deploy-jbossws-endorsed" if="HAVE_JDK16_OR_ABOVE">
+ <macro-deploy-jbossws-endorsed targetdir="${installserver}/../../lib/endorsed" thirdpartydir="${thirdpartydir}"/>
+ </target>
+
<target name="check-parameters">
<fail message="artifactsdir must be specified" unless="artifactsdir"/>
<fail message="thirdpartydir must be specified" unless="thirdpartydir"/>
15 years, 11 months
JBossWS SVN: r9006 - in stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security: operation and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-01-09 12:56:34 -0500 (Fri, 09 Jan 2009)
New Revision: 9006
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java
Log:
Refactoring to ensure authorization check is always called if needed.
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java 2009-01-09 17:12:10 UTC (rev 9005)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/SecurityDecoder.java 2009-01-09 17:56:34 UTC (rev 9006)
@@ -69,22 +69,19 @@
private TimestampVerification timestampVerification;
- private Authenticate authenticate;
-
- private Authorize authorize;
+ private Authenticate authenticate;
private HashSet<String> signedIds = new HashSet<String>();
private HashSet<String> encryptedIds = new HashSet<String>();
- public SecurityDecoder(SecurityStore store, NonceFactory nonceFactory, TimestampVerification timestampVerification, Authenticate authenticate, Authorize authorize)
+ public SecurityDecoder(SecurityStore store, NonceFactory nonceFactory, TimestampVerification timestampVerification, Authenticate authenticate)
{
org.apache.xml.security.Init.init();
this.store = store;
this.nonceFactory = nonceFactory;
this.timestampVerification = timestampVerification;
this.authenticate = authenticate;
- this.authorize = authorize;
}
/**
@@ -94,9 +91,9 @@
* @param SecurityStore the security store that contains key and trust information
* @param now The timestamp to use as the current time when validating a message expiration
*/
- public SecurityDecoder(SecurityStore store, Calendar now, NonceFactory nonceFactory, TimestampVerification timestampVerification, Authenticate authenticate, Authorize authorize)
+ public SecurityDecoder(SecurityStore store, Calendar now, NonceFactory nonceFactory, TimestampVerification timestampVerification, Authenticate authenticate)
{
- this(store, nonceFactory, timestampVerification, authenticate, authorize);
+ this(store, nonceFactory, timestampVerification, authenticate);
this.now = now;
}
@@ -160,14 +157,8 @@
if (ids != null)
encryptedIds.addAll(ids);
}
- }
+ }
- if (authorize != null)
- {
- AuthorizeOperation authorizeOp = new AuthorizeOperation(authorize);
- authorizeOp.process();
- }
-
}
public void verify(List<RequireOperation> requireOperations) throws WSSecurityException
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-01-09 17:12:10 UTC (rev 9005)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2009-01-09 17:56:34 UTC (rev 9006)
@@ -39,6 +39,7 @@
import org.jboss.ws.extensions.security.exception.WSSecurityException;
import org.jboss.ws.extensions.security.nonce.DefaultNonceFactory;
import org.jboss.ws.extensions.security.nonce.NonceFactory;
+import org.jboss.ws.extensions.security.operation.AuthorizeOperation;
import org.jboss.ws.extensions.security.operation.EncodingOperation;
import org.jboss.ws.extensions.security.operation.EncryptionOperation;
import org.jboss.ws.extensions.security.operation.RequireEncryptionOperation;
@@ -81,7 +82,7 @@
Config config = getActualConfig(configuration, operationConfig);
SOAPHeader soapHeader = message.getSOAPHeader();
QName secQName = new QName(Constants.WSSE_NS, "Security");
- Element secHeaderElement = (soapHeader != null) ? Util.findElement(soapHeader, secQName) : null;
+ Element secHeaderElement = (soapHeader != null) ? Util.findElement(soapHeader, secQName) : null;
if (secHeaderElement == null)
{
@@ -91,54 +92,76 @@
if (hasRequirements(config))
throw convertToFault(new InvalidSecurityHeaderException("This service requires <wsse:Security>, which is missing."));
-
- return;
}
try
{
- SecurityStore securityStore = new SecurityStore(configuration.getKeyStoreURL(), configuration.getKeyStoreType(), configuration.getKeyStorePassword(),
- configuration.getKeyPasswords(), configuration.getTrustStoreURL(), configuration.getTrustStoreType(), configuration.getTrustStorePassword());
- NonceFactory factory = Util.loadFactory(NonceFactory.class, configuration.getNonceFactory(), DefaultNonceFactory.class);
-
- Authenticate authenticate = null;
- Authorize authorize = null;
- if (config != null)
+ if (secHeaderElement != null)
{
- authenticate = config.getAuthenticate();
- authorize = config.getAuthorize();
+ decodeHeader(configuration, config, message, secHeaderElement);
}
- SecurityDecoder decoder = new SecurityDecoder(securityStore, factory, configuration.getTimestampVerification(), authenticate, authorize);
-
- decoder.decode(message.getSOAPPart(), secHeaderElement);
-
- if (log.isTraceEnabled())
- log.trace("Decoded Message:\n" + DOMWriter.printNode(message.getSOAPPart(), true));
-
- List<RequireOperation> operations = buildRequireOperations(config);
-
- decoder.verify(operations);
- if(log.isDebugEnabled()) log.debug("Verification is successful");
-
- decoder.complete();
+ authorize(config);
}
catch (WSSecurityException e)
{
if (e.isInternalError())
log.error("Internal error occured handling inbound message:", e);
- else if(log.isDebugEnabled()) log.debug("Returning error to sender: " + e.getMessage());
+ else if (log.isDebugEnabled())
+ log.debug("Returning error to sender: " + e.getMessage());
throw convertToFault(e);
}
-
+
}
+ private void decodeHeader(WSSecurityConfiguration configuration, Config config, SOAPMessage message, Element secHeaderElement) throws WSSecurityException
+ {
+ SecurityStore securityStore = new SecurityStore(configuration.getKeyStoreURL(), configuration.getKeyStoreType(), configuration.getKeyStorePassword(),
+ configuration.getKeyPasswords(), configuration.getTrustStoreURL(), configuration.getTrustStoreType(), configuration.getTrustStorePassword());
+ NonceFactory factory = Util.loadFactory(NonceFactory.class, configuration.getNonceFactory(), DefaultNonceFactory.class);
+
+ Authenticate authenticate = null;
+
+ if (config != null)
+ {
+ authenticate = config.getAuthenticate();
+ }
+
+ SecurityDecoder decoder = new SecurityDecoder(securityStore, factory, configuration.getTimestampVerification(), authenticate);
+
+ decoder.decode(message.getSOAPPart(), secHeaderElement);
+
+ if (log.isTraceEnabled())
+ log.trace("Decoded Message:\n" + DOMWriter.printNode(message.getSOAPPart(), true));
+
+ List<RequireOperation> operations = buildRequireOperations(config);
+
+ decoder.verify(operations);
+ if (log.isDebugEnabled())
+ log.debug("Verification is successful");
+
+ decoder.complete();
+ }
+
+ private void authorize(Config config) throws WSSecurityException
+ {
+ if (config != null)
+ {
+ Authorize authorize = config.getAuthorize();
+ if (authorize != null)
+ {
+ AuthorizeOperation authorizeOp = new AuthorizeOperation(authorize);
+ authorizeOp.process();
+ }
+ }
+ }
+
public void encodeMessage(WSSecurityConfiguration configuration, SOAPMessage message, Config operationConfig, String user, String password) throws SOAPException
{
Config config = getActualConfig(configuration, operationConfig);
log.debug("WS-Security config: " + config);
-
+
// Nothing to process
if (config == null)
return;
@@ -183,12 +206,13 @@
if (operations.size() == 0)
return;
- if(log.isDebugEnabled()) log.debug("Encoding Message:\n" + DOMWriter.printNode(message.getSOAPPart(), true));
+ if (log.isDebugEnabled())
+ log.debug("Encoding Message:\n" + DOMWriter.printNode(message.getSOAPPart(), true));
try
{
SecurityStore securityStore = new SecurityStore(configuration.getKeyStoreURL(), configuration.getKeyStoreType(), configuration.getKeyStorePassword(),
- configuration.getKeyPasswords() , configuration.getTrustStoreURL(), configuration.getTrustStoreType(), configuration.getTrustStorePassword());
+ configuration.getKeyPasswords(), configuration.getTrustStoreURL(), configuration.getTrustStoreType(), configuration.getTrustStorePassword());
SecurityEncoder encoder = new SecurityEncoder(operations, securityStore);
encoder.encode(message.getSOAPPart());
}
@@ -196,7 +220,8 @@
{
if (e.isInternalError())
log.error("Internal error occured handling outbound message:", e);
- else if(log.isDebugEnabled()) log.debug("Returning error to sender: " + e.getMessage());
+ else if (log.isDebugEnabled())
+ log.debug("Returning error to sender: " + e.getMessage());
throw convertToFault(e);
}
@@ -210,7 +235,7 @@
securityAdaptor.setPrincipal(null);
securityAdaptor.setCredential(null);
}
-
+
private List<Target> convertTargets(List<org.jboss.ws.metadata.wsse.Target> targets)
{
if (targets == null)
@@ -243,7 +268,7 @@
{
if (operationConfig == null)
return null;
-
+
Requires requires = operationConfig.getRequires();
if (requires == null)
return null;
@@ -281,7 +306,7 @@
{
EndpointMetaData epMetaData = ctx.getEndpointMetaData();
QName port = epMetaData.getPortName();
-
+
OperationMetaData opMetaData = ctx.getOperationMetaData();
if (opMetaData == null)
{
@@ -304,7 +329,7 @@
//null operationConfig means default behavior
return operationConfig != null ? operationConfig : configuration.getDefaultConfig();
}
-
+
private Config selectOperationConfig(WSSecurityConfiguration configuration, QName portName, QName opName)
{
Port port = configuration.getPorts().get(portName != null ? portName.getLocalPart() : null);
@@ -322,8 +347,7 @@
}
return operation.getConfig();
}
-
-
+
private boolean hasRequirements(Config config)
{
return config != null && config.getRequires() != null;
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java 2009-01-09 17:12:10 UTC (rev 9005)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java 2009-01-09 17:56:34 UTC (rev 9006)
@@ -145,7 +145,6 @@
{
List<Role> roles = authorize.getRoles();
int rolesCount = (roles != null) ? roles.size() : 0;
- log.info(rolesCount);
Set<Principal> expectedRoles = new HashSet<Principal>(rolesCount);
if (roles != null)
15 years, 11 months
JBossWS SVN: r9005 - stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-01-09 12:12:10 -0500 (Fri, 09 Jan 2009)
New Revision: 9005
Modified:
stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java
Log:
Further checks, enhanced TRACE logging and error reporting.
Modified: stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java
===================================================================
--- stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java 2009-01-09 13:36:38 UTC (rev 9004)
+++ stack/native/branches/dlofthouse/JBWS-1999/modules/core/src/main/java/org/jboss/ws/extensions/security/operation/AuthorizeOperation.java 2009-01-09 17:12:10 UTC (rev 9005)
@@ -32,8 +32,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.security.auth.Subject;
-import javax.xml.soap.SOAPException;
-import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.security.AuthenticationManager;
@@ -42,6 +40,8 @@
import org.jboss.security.SecurityContextAssociation;
import org.jboss.security.SimplePrincipal;
import org.jboss.ws.WSException;
+import org.jboss.ws.extensions.security.exception.FailedAuthenticationException;
+import org.jboss.ws.extensions.security.exception.WSSecurityException;
import org.jboss.ws.metadata.wsse.Authorize;
import org.jboss.ws.metadata.wsse.Role;
import org.jboss.wsf.spi.SPIProvider;
@@ -89,36 +89,56 @@
secAdapterfactory = spiProvider.getSPI(SecurityAdaptorFactory.class);
}
- public void process()
+ public void process() throws WSSecurityException
{
- log.trace("About to check authorization, using security domain '" + am.getSecurityDomain() + "'");
+ boolean TRACE = log.isTraceEnabled();
+
+ if (TRACE)
+ log.trace("About to check authorization, using security domain '" + am.getSecurityDomain() + "'");
+
// Step 1 - Authenticate using currently associated principals.
SecurityAdaptor securityAdaptor = secAdapterfactory.newSecurityAdapter();
Principal principal = securityAdaptor.getPrincipal();
Object credential = securityAdaptor.getCredential();
Subject subject = new Subject();
- boolean authorized = am.isValid(principal, credential, subject);
- if (authorized == false)
+ if (am.isValid(principal, credential, subject) == false)
{
- throw new WSException("Authentication failed.");
+ String msg = "Authentication failed, principal=" + principal;
+ log.error(msg);
+ SecurityException e = new SecurityException(msg);
+ throw new FailedAuthenticationException(e);
}
+ pushSubjectContext(principal, credential, subject);
+ if (TRACE)
+ log.trace("Authenticated, principal=" + principal);
- pushSubjectContext(principal, credential, subject);
// Step 2 - If unchecked all ok so return.
if (authorize.isUnchecked())
{
+ if (TRACE)
+ log.trace("authorize.isUnchecked()==true skipping roles check.");
+
return;
}
// Step 3 - If roles specified check user in role.
Set<Principal> expectedRoles = expectedRoles();
- System.out.println(subject.getPrincipals());
+ if (TRACE)
+ log.trace("expectedRoles=" + expectedRoles);
+
if (rm.doesUserHaveRole(principal, expectedRoles) == false)
{
- throw new WSException("User does not have required roles");
+ Set<Principal> userRoles = rm.getUserRoles(principal);
+ String msg = "Insufficient method permissions, principal=" + principal + ", requiredRoles=" + expectedRoles + ", principalRoles=" + userRoles;
+ log.error(msg);
+ SecurityException e = new SecurityException(msg);
+ throw new FailedAuthenticationException(e);
}
+
+ if (TRACE)
+ log.trace("Roles check complete, principal=" + principal + ", requiredRoles=" + expectedRoles);
}
private Set<Principal> expectedRoles()
@@ -138,30 +158,30 @@
return expectedRoles;
}
-
- static SecurityContext getSecurityContext()
- {
- return (SecurityContext)AccessController.doPrivileged(new PrivilegedAction(){
+
+ private static SecurityContext getSecurityContext()
+ {
+ return (SecurityContext)AccessController.doPrivileged(new PrivilegedAction() {
public Object run()
{
return SecurityContextAssociation.getSecurityContext();
}
});
}
-
- static void pushSubjectContext(final Principal p, final Object cred, final Subject s)
+
+ private static void pushSubjectContext(final Principal p, final Object cred, final Subject s)
{
- AccessController.doPrivileged(new PrivilegedAction(){
+ AccessController.doPrivileged(new PrivilegedAction() {
public Object run()
{
- SecurityContext sc = getSecurityContext();
- if(sc == null)
+ SecurityContext sc = getSecurityContext();
+ if (sc == null)
throw new IllegalStateException("Security Context is null");
- sc.getUtil().createSubjectInfo(p, cred, s);
+ sc.getUtil().createSubjectInfo(p, cred, s);
return null;
- }}
- );
- }
+ }
+ });
+ }
}
15 years, 11 months
JBossWS SVN: r9004 - in stack/native/branches/jbossws-native-2.0.1.SP2_CP/src: main/java/org/jboss/ws/tools/wsdl and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-09 08:36:38 -0500 (Fri, 09 Jan 2009)
New Revision: 9004
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/Constants.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
Log:
[JBPAPP-1449] Porting JBWS-1761 fix to EAP branch: wsprovide ignores SOAPBinding declaration
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/Constants.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/Constants.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -90,6 +90,8 @@
static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
/** SOAP-1.2 encoding URI */
static final String URI_SOAP12_ENC = SOAPConstants.URI_NS_SOAP_1_2_ENCODING;
+ /** SOAP HTTP transport URI in wsdl soap binding */
+ static final String URI_SOAP_HTTP = "http://schemas.xmlsoap.org/soap/http";
/** Literal encoding URI */
static final String URI_LITERAL_ENC = "";
/** WSDL 2.0 Encoding Rules */
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Writer.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -468,7 +468,12 @@
if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
style = "document";
appendUnknownExtensibilityElements(buffer, binding);
- buffer.append("<" + soapPrefix + ":binding transport='http://schemas.xmlsoap.org/soap/http' style='" + style + "'/>");
+
+ // The value of the REQUIRED transport attribute (of type xs:anyURI) indicates which transport of SOAP this binding corresponds to.
+ // The URI value "http://schemas.xmlsoap.org/soap/http" corresponds to the HTTP binding.
+ // Other URIs may be used here to indicate other transports (such as SMTP, FTP, etc.).
+
+ buffer.append("<" + soapPrefix + ":binding transport='" + Constants.URI_SOAP_HTTP + "' style='" + style + "'/>");
appendBindingOperations(buffer, binding);
buffer.append("</binding>");
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -27,6 +27,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.soap.SOAPBinding;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.util.PolicyFactory;
@@ -104,6 +105,7 @@
QName bindingQName = new QName(interfaceQName.getNamespaceURI(), interfaceQName.getLocalPart() + "Binding");
WSDLBinding wsdlBinding = new WSDLBinding(wsdl, bindingQName);
wsdlBinding.setInterfaceName(interfaceQName);
+ wsdlBinding.setType(endpoint.getBindingId());
wsdl.addBinding(wsdlBinding);
wsdlEndpoint.setBinding(bindingQName);
@@ -424,9 +426,28 @@
String ns = service.getServiceName().getNamespaceURI();
wsdl.setTargetNamespace(ns);
wsdl.registerNamespaceURI(ns, "tns");
- wsdl.registerNamespaceURI(Constants.NS_SOAP11, "soap");
wsdl.registerNamespaceURI(Constants.NS_SCHEMA_XSD, "xsd");
+ String soapURI = null;
+ String soapPrefix = null;
+ for (EndpointMetaData ep : service.getEndpoints())
+ {
+ String bindingId = ep.getBindingId();
+ if (bindingId.startsWith(SOAPBinding.SOAP11HTTP_BINDING))
+ {
+ soapPrefix = "soap";
+ soapURI = Constants.NS_SOAP11;
+ }
+ else if (bindingId.startsWith(SOAPBinding.SOAP12HTTP_BINDING))
+ {
+ soapPrefix = "soap12";
+ soapURI = Constants.NS_SOAP12;
+ }
+ }
+
+ if (soapURI != null && soapPrefix != null)
+ wsdl.registerNamespaceURI(soapURI, soapPrefix);
+
processTypes();
processService(service);
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/main/java/org/jboss/ws/tools/wsdl/WSDLWriter.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -66,7 +66,6 @@
*/
protected boolean includeSchemaInWSDL = true;
- /** Use WSDLDefinitions.writeWSDL instead. */
public WSDLWriter(WSDLDefinitions wsdl)
{
if (wsdl == null)
@@ -133,7 +132,7 @@
if (prefix.length() > 0)
{
buffer.append(" xmlns:" + prefix + "='" + namespaceURI + "'");
- if (Constants.PREFIX_SOAP11.equals(prefix))
+ if (prefix.startsWith("soap"))
soapPrefix = prefix;
}
}
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -27,6 +27,11 @@
import java.util.ArrayList;
import java.util.List;
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap12.SOAP12Binding;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
@@ -35,6 +40,8 @@
import junit.framework.Test;
import org.jboss.ws.Constants;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
@@ -46,14 +53,47 @@
*/
public class SOAPBindingTestCase extends JBossWSTest
{
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-binding";
+
public static Test suite()
{
return new JBossWSTestSetup(SOAPBindingTestCase.class, "jaxws-binding.war");
}
+
+ // [JBWS-1761] - WSProvide ignores SOAPBinding declaration
+ public void testWSDLAccess() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ //Element root = DOMUtils.parse(wsdlURL.openStream());
+ //System.out.println(DOMWriter.printNode(root, true));
+ WSDLDefinitions defs = WSDLDefinitionsFactory.newInstance().parse(wsdlURL);
+ Definition wsdl = defs.getWsdlOneOneDefinition();
+
+ QName qname = new QName("http://org.jboss.ws/jaxws/binding", "SOAPEndpointBinding");
+ Binding wsdlBinding = wsdl.getBinding(qname);
+ assertNotNull("Cannot find: " + qname, wsdlBinding);
+
+ String transport = null;
+ List<ExtensibilityElement> extList = wsdlBinding.getExtensibilityElements();
+ for (ExtensibilityElement ext : extList)
+ {
+ if (ext instanceof SOAPBinding)
+ {
+ fail("Expected SOAP-1.2 binding");
+ }
+ else if (ext instanceof SOAP12Binding)
+ {
+ SOAP12Binding soapBinding = (SOAP12Binding)ext;
+ transport = soapBinding.getTransportURI();
+ }
+ }
+ assertEquals("Invalid transport uri", Constants.URI_SOAP_HTTP, transport);
+ }
+
public void testClientAccess() throws Exception
{
- URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-binding?wsdl");
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/binding", "SOAPEndpointBeanService");
Service service = Service.create(wsdlURL, qname);
SOAPEndpoint port = (SOAPEndpoint)service.getPort(SOAPEndpoint.class);
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2009-01-09 10:45:25 UTC (rev 9003)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPEndpoint.java 2009-01-09 13:36:38 UTC (rev 9004)
@@ -28,11 +28,12 @@
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.BindingType;
+import static javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+
@WebService(name = "SOAPEndpoint", targetNamespace = "http://org.jboss.ws/jaxws/binding")
@SOAPBinding(style = Style.RPC)
-// This is the SOAP-1.2 binding identifier
-@BindingType(value = "http://www.w3.org/2003/05/soap/bindings/HTTP/")
+@BindingType(SOAP12HTTP_BINDING)
public interface SOAPEndpoint
{
public String namespace();
15 years, 11 months
JBossWS SVN: r9003 - stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-09 05:45:25 -0500 (Fri, 09 Jan 2009)
New Revision: 9003
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
Log:
[JBWS-2444] Fixing testcase
Modified: stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2009-01-09 10:35:58 UTC (rev 9002)
+++ stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws1666/JBWS1666TestCase.java 2009-01-09 10:45:25 UTC (rev 9003)
@@ -73,7 +73,7 @@
// Maybe you should extend the Class-Path in the MANIFEST instead.
StringBuffer cp = new StringBuffer(System.getProperty("test.classes.directory"));
cp.append(PS + jbc + FS + "jbossws-native-client.jar");
- if (isTargetJBoss5())
+ if (isTargetJBoss5OrGreater())
{
cp.append(PS + jbc + FS + "jboss-common-core.jar");
cp.append(PS + jbc + FS + "jboss-logging-spi.jar");
15 years, 11 months