Add support for MTOM Optimized Protocol
parent
ae48a63fad
commit
16d4356f9f
|
@ -571,6 +571,22 @@ public abstract class AbstractEndpoint
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMTOMEnabled() {
|
||||
PolicyReference reference = getPolicyReference();
|
||||
if(reference != null) {
|
||||
String policyReferenceURI = reference.getURI();
|
||||
if(policyReferenceURI == null) {
|
||||
return false;
|
||||
} else {
|
||||
Policy pol = getPolicy(reference);
|
||||
if(pol != null) {
|
||||
return (pol.getOptimizedMimeSerialization() != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Policy getPolicy(PolicyReference pr) {
|
||||
Policy p = null;
|
||||
|
|
|
@ -179,6 +179,8 @@ public interface Endpoint {
|
|||
|
||||
boolean isBasicAuthenticationEnabled();
|
||||
|
||||
boolean isMTOMEnabled();
|
||||
|
||||
EndpointSecurityManager getEndpointSecurityManager();
|
||||
|
||||
QName createOperationAddress(OperationMetaData opMetaData);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*
|
||||
* END_HEADER - DO NOT EDIT
|
||||
*/
|
||||
|
||||
package com.sun.jbi.httpsoapbc.embedded;
|
||||
|
||||
import com.sun.jbi.internationalization.Messages;
|
||||
|
@ -37,6 +36,7 @@ import com.sun.xml.ws.api.message.Packet;
|
|||
import com.sun.xml.ws.api.server.WSEndpoint;
|
||||
import com.sun.xml.ws.api.server.WebServiceContextDelegate;
|
||||
import com.sun.xml.ws.transport.http.WSHTTPConnection;
|
||||
import org.jvnet.ws.message.PropertySet.Property;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -49,6 +49,7 @@ import java.util.List;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -62,16 +63,15 @@ import org.apache.coyote.tomcat5.CoyoteResponse;
|
|||
import org.apache.tomcat.util.http.MimeHeaders;
|
||||
|
||||
/**
|
||||
* Based on JAX-WS WSHTTPConnection used with Java SE endpoints. It provides connection
|
||||
* implementation using Grizzly.
|
||||
* Based on JAX-WS WSHTTPConnection used with Java SE endpoints. It provides
|
||||
* connection implementation using Grizzly.
|
||||
*/
|
||||
public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implements WebServiceContextDelegate {
|
||||
|
||||
private static final Messages mMessages =
|
||||
Messages.getMessages(JAXWSGrizzlyHttpConnection.class);
|
||||
Messages.getMessages(JAXWSGrizzlyHttpConnection.class);
|
||||
private final static Logger mLogger =
|
||||
Messages.getLogger(JAXWSGrizzlyHttpConnection.class);
|
||||
|
||||
Messages.getLogger(JAXWSGrizzlyHttpConnection.class);
|
||||
//private final HttpExchange httpExchange;
|
||||
private Request req;
|
||||
private Response res;
|
||||
|
@ -80,14 +80,14 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
private int status;
|
||||
private int responseContentLength = 0;
|
||||
private Subject basicAuthSubject;
|
||||
|
||||
private boolean outputWritten;
|
||||
private boolean isSecure;
|
||||
|
||||
private AsyncTask grizzlyAsyncTask;
|
||||
private Map<String, List<String>> requestHeaders;
|
||||
private Map<String, List<String>> responseHeaders;
|
||||
|
||||
public JAXWSGrizzlyHttpConnection(@NotNull Request request, @NotNull Response response, @NotNull CoyoteRequest coyoteRequest,
|
||||
@NotNull CoyoteResponse coyoteResponse, AsyncTask grizzlyAsyncTask, boolean isSecure) {
|
||||
public JAXWSGrizzlyHttpConnection(@NotNull Request request, @NotNull Response response, @NotNull CoyoteRequest coyoteRequest,
|
||||
@NotNull CoyoteResponse coyoteResponse, AsyncTask grizzlyAsyncTask, boolean isSecure) {
|
||||
this.req = request;
|
||||
this.res = response;
|
||||
this.coyoteRequest = coyoteRequest;
|
||||
|
@ -97,11 +97,14 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
}
|
||||
|
||||
@Override
|
||||
@Property({MessageContext.HTTP_REQUEST_HEADERS, Packet.INBOUND_TRANSPORT_HEADERS})
|
||||
public @NotNull Map<String,List<String>> getRequestHeaders() {
|
||||
MimeHeaders mimeHeaders = req.getMimeHeaders();
|
||||
Map<String, List<String>> jaxWSHeaders = convertHeaders(mimeHeaders);
|
||||
return jaxWSHeaders;
|
||||
@org.jvnet.ws.message.PropertySet.Property({MessageContext.HTTP_REQUEST_HEADERS, Packet.INBOUND_TRANSPORT_HEADERS})
|
||||
public @NotNull
|
||||
Map<String, List<String>> getRequestHeaders() {
|
||||
if (requestHeaders == null) {
|
||||
requestHeaders = initializeRequestHeaders();
|
||||
}
|
||||
|
||||
return requestHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -109,70 +112,41 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
return req.getHeader(headerName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* there seems to issue with metro implementation while creating soap 1.2
|
||||
* mime headers, for the content-type mime header it does not propagate
|
||||
* the exact value for the content-type mime header, specially in this case
|
||||
* though the http-request contents the value of the action in the content
|
||||
* type , the same value is not propagated from the http transport layer to
|
||||
* the soap message layer
|
||||
*
|
||||
* this is a work around which is used to pass on the action value if
|
||||
* present in the content-type , this code needs to removed once we have the
|
||||
* metro fix
|
||||
*
|
||||
* @param headerName
|
||||
* @return
|
||||
*/
|
||||
private String soapActionHeader(String value) {
|
||||
|
||||
StringTokenizer tk = new StringTokenizer(value,";");
|
||||
String soapAction=null;
|
||||
while(tk.hasMoreTokens()){
|
||||
String t = tk.nextToken();
|
||||
if(t.startsWith("action=")){
|
||||
soapAction= t.substring("action=".length());
|
||||
}
|
||||
}
|
||||
return soapAction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setResponseHeaders(Map<String,List<String>> headers) {
|
||||
if (headers != null) {
|
||||
for (Map.Entry<String,List<String>> entry : headers.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<String> values = entry.getValue();
|
||||
if (values.size() == 1) {
|
||||
res.setHeader(key, values.get(1));
|
||||
} else {
|
||||
// If the header has multiple values, comma separte them
|
||||
StringBuffer concat = new StringBuffer();
|
||||
boolean firstTime = true;
|
||||
for (String aValue : values) {
|
||||
if (!firstTime) {
|
||||
concat.append(',');
|
||||
}
|
||||
concat.append(aValue);
|
||||
firstTime = false;
|
||||
}
|
||||
res.setHeader(key, concat.toString());
|
||||
}
|
||||
}
|
||||
public void setResponseHeaders(Map<String, List<String>> headers) {
|
||||
this.responseHeaders = headers;
|
||||
if (headers == null) {
|
||||
return;
|
||||
|
||||
}
|
||||
if (status != 0) {
|
||||
res.setStatus(status);
|
||||
}
|
||||
|
||||
res.reset(); // clear all the headers
|
||||
|
||||
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
if (name.equalsIgnoreCase("Content-Type") || name.equalsIgnoreCase("Content-Length")) {
|
||||
continue; // ignore headers that interfere with the operation
|
||||
}
|
||||
for (String value : entry.getValue()) {
|
||||
res.addHeader(name, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Property(MessageContext.HTTP_RESPONSE_HEADERS)
|
||||
public Map<String,List<String>> getResponseHeaders() {
|
||||
MimeHeaders mimeHeaders = res.getMimeHeaders();
|
||||
Map<String, List<String>> jaxWSHeaders = convertHeaders(mimeHeaders);
|
||||
return jaxWSHeaders;
|
||||
//@Override
|
||||
public void setResponseHeader(String headerName, List<String> values) {
|
||||
responseHeaders.put(headerName, values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.HTTP_RESPONSE_HEADERS)
|
||||
public Map<String, List<String>> getResponseHeaders() {
|
||||
return responseHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentTypeResponseHeader(@NotNull String value) {
|
||||
res.setHeader("Content-Type", value);
|
||||
|
@ -184,27 +158,29 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
}
|
||||
|
||||
@Override
|
||||
@Property(MessageContext.HTTP_RESPONSE_CODE)
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.HTTP_RESPONSE_CODE)
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Property(MessageContext.SERVLET_REQUEST)
|
||||
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.SERVLET_REQUEST)
|
||||
public HttpServletRequest getRequest() {
|
||||
return coyoteRequest;
|
||||
}
|
||||
|
||||
@Property(MessageContext.SERVLET_RESPONSE)
|
||||
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.SERVLET_RESPONSE)
|
||||
public HttpServletResponse getResponse() {
|
||||
return coyoteResponse;
|
||||
}
|
||||
}
|
||||
|
||||
public @NotNull InputStream getInput() throws IOException{
|
||||
public @NotNull
|
||||
InputStream getInput() throws IOException {
|
||||
return coyoteRequest.getInputStream();
|
||||
//return httpExchange.getRequestBody();
|
||||
}
|
||||
|
||||
public @NotNull OutputStream getOutput() throws IOException {
|
||||
public @NotNull
|
||||
OutputStream getOutput() throws IOException {
|
||||
assert !outputWritten;
|
||||
outputWritten = true;
|
||||
|
||||
|
@ -212,7 +188,8 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
return coyoteResponse.getOutputStream();
|
||||
}
|
||||
|
||||
public @NotNull WebServiceContextDelegate getWebServiceContextDelegate() {
|
||||
public @NotNull
|
||||
WebServiceContextDelegate getWebServiceContextDelegate() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -224,36 +201,38 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
return false;
|
||||
}
|
||||
|
||||
public @NotNull String getEPRAddress(Packet request, WSEndpoint endpoint) {
|
||||
public @NotNull
|
||||
String getEPRAddress(Packet request, WSEndpoint endpoint) {
|
||||
// TODO: verify the kind of address it wants here
|
||||
return coyoteRequest.getRequestURL().toString();
|
||||
}
|
||||
|
||||
public String getWSDLAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint) {
|
||||
String eprAddress = getEPRAddress(request,endpoint);
|
||||
|
||||
public String getWSDLAddress(@NotNull Packet request, @NotNull WSEndpoint endpoint) {
|
||||
String eprAddress = getEPRAddress(request, endpoint);
|
||||
String wsdlAddress = eprAddress + "?wsdl";
|
||||
return wsdlAddress;
|
||||
}
|
||||
return wsdlAddress;
|
||||
}
|
||||
|
||||
//@Override
|
||||
public boolean isSecure() {
|
||||
public boolean isSecure() {
|
||||
return this.isSecure;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Property(MessageContext.HTTP_REQUEST_METHOD)
|
||||
public @NotNull String getRequestMethod() {
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.HTTP_REQUEST_METHOD)
|
||||
public @NotNull
|
||||
String getRequestMethod() {
|
||||
return coyoteRequest.getMethod();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Property(MessageContext.QUERY_STRING)
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.QUERY_STRING)
|
||||
public String getQueryString() {
|
||||
return coyoteRequest.getQueryString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Property(MessageContext.PATH_INFO)
|
||||
@org.jvnet.ws.message.PropertySet.Property(MessageContext.PATH_INFO)
|
||||
public String getPathInfo() {
|
||||
return coyoteRequest.getRequestURI();
|
||||
}
|
||||
|
@ -266,11 +245,11 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
finishGrizzlyResponse();
|
||||
super.close();
|
||||
}
|
||||
|
||||
|
||||
protected PropertyMap getPropertyMap() {
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
void finishGrizzlyResponse() {
|
||||
if (grizzlyAsyncTask != null) {
|
||||
JBIGrizzlyAsyncFilter.finishResponse(grizzlyAsyncTask);
|
||||
|
@ -280,57 +259,33 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from MimeHeaders to the format JAX-WS uses
|
||||
* with the header name as the map key pointing to a list of values
|
||||
* for that header
|
||||
*
|
||||
* This conversion might be expesive, if this is frequently used it may
|
||||
* be worth changing Grizzly or JAX-WS to remove the need for the conversion
|
||||
*/
|
||||
Map<String, List<String>> convertHeaders(MimeHeaders mimeHeaders) {
|
||||
Map<String, List<String>> jaxWSHeaders = new HashMap();
|
||||
Enumeration names = mimeHeaders.names();
|
||||
while (names.hasMoreElements()) {
|
||||
String name = (String) names.nextElement();
|
||||
List jaxWSHeaderValues = new ArrayList();
|
||||
Enumeration values = mimeHeaders.values(name);
|
||||
private Map<String, List<String>> initializeRequestHeaders() {
|
||||
final Map<String, List<String>> headers = new HashMap<String, List<String>>();
|
||||
MimeHeaders mimeHeaders = req.getMimeHeaders();
|
||||
Enumeration names = mimeHeaders.names();
|
||||
while (names.hasMoreElements()) {
|
||||
String name = (String) names.nextElement();
|
||||
List<String> jaxWsValues = new ArrayList<String>();
|
||||
Enumeration values = mimeHeaders.values(name);
|
||||
while (values.hasMoreElements()) {
|
||||
String aValue = (String) values.nextElement();
|
||||
jaxWsValues.add(aValue);
|
||||
}
|
||||
headers.put(name, jaxWsValues);
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("Content-Type")) {
|
||||
while (values.hasMoreElements()) {
|
||||
String aValue = (String) values.nextElement();
|
||||
jaxWSHeaderValues.add(aValue);
|
||||
if(aValue.indexOf("action=") > 0){
|
||||
List soapActions = new ArrayList();
|
||||
soapActions.add(soapActionHeader(aValue));
|
||||
jaxWSHeaders.put("SOAPAction", soapActions);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
while (values.hasMoreElements()) {
|
||||
String aValue = (String) values.nextElement();
|
||||
jaxWSHeaderValues.add(aValue);
|
||||
}
|
||||
}
|
||||
jaxWSHeaders.put(name, jaxWSHeaderValues);
|
||||
}
|
||||
|
||||
return jaxWSHeaders;
|
||||
return headers;
|
||||
}
|
||||
|
||||
|
||||
private static final PropertyMap model;
|
||||
|
||||
static {
|
||||
model = parse(JAXWSGrizzlyHttpConnection.class);
|
||||
model = parse(JAXWSGrizzlyHttpConnection.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the basicAuthSubject
|
||||
*/
|
||||
|
||||
@Property("basicAuthSubject")
|
||||
@org.jvnet.ws.message.PropertySet.Property("basicAuthSubject")
|
||||
public Subject getBasicAuthSubject() {
|
||||
return basicAuthSubject;
|
||||
}
|
||||
|
@ -341,4 +296,34 @@ public final class JAXWSGrizzlyHttpConnection extends WSHTTPConnection implement
|
|||
public void setBasicAuthSubject(Subject basicAuthSubject) {
|
||||
this.basicAuthSubject = basicAuthSubject;
|
||||
}
|
||||
|
||||
//@Override
|
||||
public Set<String> getRequestHeaderNames() {
|
||||
return requestHeaders.keySet();
|
||||
}
|
||||
|
||||
//@Override
|
||||
public List<String> getRequestHeaderValues(String headerName) {
|
||||
return requestHeaders.get(headerName);
|
||||
}
|
||||
|
||||
//@Override
|
||||
public String getRequestURI() {
|
||||
return req.requestURI().getString();
|
||||
}
|
||||
|
||||
//@Override
|
||||
public String getRequestScheme() {
|
||||
return req.scheme().getString();
|
||||
}
|
||||
|
||||
//@Override
|
||||
public String getServerName() {
|
||||
return req.serverName().getString();
|
||||
}
|
||||
|
||||
//@Override
|
||||
public int getServerPort() {
|
||||
return req.getServerPort();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*******************************************************************************
|
||||
* The contents of this file are subject to the terms of the Common Development and
|
||||
* Distribution License(theLicense).You may not use this file except in compliance
|
||||
* with the License.
|
||||
*
|
||||
* You can obtain a copy of the License at http://opensource.org/licenses/CDDL-1.0or
|
||||
* http://opensource.org/licenses/cddl1.txt
|
||||
*
|
||||
* When distributing Covered Code,include this CDDL Header Notice in each file and
|
||||
* include the License file at http://opensource.org/licenses/cddl1.txt. If applicable, add
|
||||
* the following below the CDDL Header, with the fields enclosed by brackets []
|
||||
* replaced by your own identifying information:
|
||||
*
|
||||
* "Portions Copyrighted [year] [name of copyright owner]"
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Portions Copyrighted 2013 OpenESB Community
|
||||
******************************************************************************/
|
||||
|
||||
package com.sun.jbi.httpsoapbc.extensions;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.wsdl.extensions.ExtensibilityElement;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author David BRASSELY (brasseld at gmail.com)
|
||||
* @author OpenESB Community
|
||||
*/
|
||||
public class OptimizedMimeSerialization implements ExtensibilityElement, Serializable {
|
||||
|
||||
public static String NS_URI_HTTPBC_MTOM_EXTENSION = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
|
||||
|
||||
// Local element name
|
||||
public static final String ELEM_OptimizedMimeSerialization = "OptimizedMimeSerialization";
|
||||
|
||||
// QName representing this Extensibility Element
|
||||
private QName QNAME_OptimizedMimeSerialization =
|
||||
new QName(NS_URI_HTTPBC_MTOM_EXTENSION, ELEM_OptimizedMimeSerialization);
|
||||
|
||||
private Boolean mFieldRequired = false;
|
||||
|
||||
public void setElementType(QName elementType) {
|
||||
QNAME_OptimizedMimeSerialization = elementType;
|
||||
}
|
||||
|
||||
public QName getElementType() {
|
||||
return QNAME_OptimizedMimeSerialization;
|
||||
}
|
||||
|
||||
public void setRequired(Boolean arg0) {
|
||||
mFieldRequired = arg0;
|
||||
}
|
||||
|
||||
public Boolean getRequired() {
|
||||
return mFieldRequired;
|
||||
}
|
||||
}
|
|
@ -58,7 +58,9 @@ public class Policy implements ExtensibilityElement, Serializable {
|
|||
|
||||
private MustSupportBasicAuthentication msba;
|
||||
private BasicAuthenticationDetail bad;
|
||||
|
||||
|
||||
private OptimizedMimeSerialization oms;
|
||||
|
||||
public Policy() {
|
||||
}
|
||||
|
||||
|
@ -101,7 +103,6 @@ public class Policy implements ExtensibilityElement, Serializable {
|
|||
return this.password;
|
||||
}
|
||||
|
||||
|
||||
public MustSupportBasicAuthentication getMustSupportBasicAuthentication() {
|
||||
return msba;
|
||||
}
|
||||
|
@ -110,6 +111,14 @@ public class Policy implements ExtensibilityElement, Serializable {
|
|||
msba = val;
|
||||
}
|
||||
|
||||
public OptimizedMimeSerialization getOptimizedMimeSerialization() {
|
||||
return oms;
|
||||
}
|
||||
|
||||
public void setOptimizedMimeSerialization (OptimizedMimeSerialization val) {
|
||||
oms = val;
|
||||
}
|
||||
|
||||
public BasicAuthenticationDetail getBasicAuthenticationDetail() {
|
||||
return bad;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*
|
||||
* END_HEADER - DO NOT EDIT
|
||||
*/
|
||||
|
||||
package com.sun.jbi.httpsoapbc.extensions;
|
||||
|
||||
import com.ibm.wsdl.util.xml.DOMUtils;
|
||||
|
@ -38,6 +37,7 @@ import com.sun.jbi.internationalization.Messages;
|
|||
import java.io.Serializable;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Map;
|
||||
import javax.wsdl.Binding;
|
||||
|
||||
import javax.wsdl.Definition;
|
||||
import javax.wsdl.Port;
|
||||
|
@ -56,14 +56,14 @@ import org.w3c.dom.NamedNodeMap;
|
|||
/**
|
||||
*
|
||||
*
|
||||
* @version
|
||||
* @version
|
||||
*
|
||||
*/
|
||||
public class SOAPExtSerializer
|
||||
implements ExtensionSerializer, ExtensionDeserializer, Serializable {
|
||||
implements ExtensionSerializer, ExtensionDeserializer, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Messages mMessages = Messages.getMessages(SOAPExtSerializer.class);
|
||||
|
||||
// Policy element constants
|
||||
// No I18N
|
||||
private static final String WSP_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/09/policy";
|
||||
|
@ -71,54 +71,67 @@ public class SOAPExtSerializer
|
|||
private static final String MY_SP_NAMESPACE = "http://sun.com/ws/httpbc/security/BasicauthSecurityPolicy";
|
||||
private static final String WSU_NAMESPACE = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
|
||||
private static final String USER_TOKEN_NAME_SPACE = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient";
|
||||
private static final String WSOMA_SP_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization";
|
||||
|
||||
private RuntimeConfigurationMBean mRuntimeConfig = null;
|
||||
private Map mApplicationVariablesMap = null;
|
||||
private boolean mResolveTokens = false;
|
||||
|
||||
|
||||
public SOAPExtSerializer(RuntimeConfigurationMBean runtimeConfig, boolean resolveTokens) {
|
||||
mRuntimeConfig = runtimeConfig;
|
||||
mRuntimeConfig = runtimeConfig;
|
||||
mApplicationVariablesMap = runtimeConfig.retrieveApplicationVariablesMap();
|
||||
mResolveTokens = resolveTokens;
|
||||
}
|
||||
|
||||
public void registerSerializer(ExtensionRegistry registry) {
|
||||
|
||||
registry.registerSerializer(Port.class,
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.registerSerializer(Port.class,
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.registerDeserializer(Port.class,
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
this);
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.mapExtensionTypes(Port.class,
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
PolicyReference.class);
|
||||
|
||||
registry.registerSerializer(Definition.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
PolicyReference.QNAME_ADDRESS,
|
||||
PolicyReference.class);
|
||||
|
||||
registry.registerSerializer(Binding.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.registerDeserializer(Binding.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.mapExtensionTypes(Binding.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
Policy.class);
|
||||
|
||||
registry.registerSerializer(Definition.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.registerDeserializer(Definition.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
Policy.QNAME_ADDRESS,
|
||||
this);
|
||||
registry.mapExtensionTypes(Definition.class,
|
||||
Policy.QNAME_ADDRESS,
|
||||
Policy.class);
|
||||
|
||||
Policy.QNAME_ADDRESS,
|
||||
Policy.class);
|
||||
|
||||
}
|
||||
|
||||
public void marshall(Class parentType, QName elementType,
|
||||
ExtensibilityElement extension, PrintWriter pw,
|
||||
Definition def, ExtensionRegistry extReg)
|
||||
throws WSDLException {
|
||||
ExtensibilityElement extension, PrintWriter pw,
|
||||
Definition def, ExtensionRegistry extReg)
|
||||
throws WSDLException {
|
||||
// NOTE: no I18N
|
||||
String wspNs = (def.getPrefix(WSP_NAMESPACE) != null && !def.getPrefix(WSP_NAMESPACE).equals("")) ? def.getPrefix(WSP_NAMESPACE) : "wsp";
|
||||
String myspNs = (def.getPrefix(MY_SP_NAMESPACE) != null && !def.getPrefix(MY_SP_NAMESPACE).equals(""))? def.getPrefix(MY_SP_NAMESPACE) : "mysp";
|
||||
String wsuNs = (def.getPrefix(WSU_NAMESPACE) != null && !def.getPrefix(WSU_NAMESPACE).equals(""))? def.getPrefix(WSU_NAMESPACE) : "wsu";
|
||||
String spNs = (def.getPrefix(SP_NAMESPACE) != null && !def.getPrefix(SP_NAMESPACE).equals(""))? def.getPrefix(SP_NAMESPACE) : "sp";
|
||||
String myspNs = (def.getPrefix(MY_SP_NAMESPACE) != null && !def.getPrefix(MY_SP_NAMESPACE).equals("")) ? def.getPrefix(MY_SP_NAMESPACE) : "mysp";
|
||||
String wsuNs = (def.getPrefix(WSU_NAMESPACE) != null && !def.getPrefix(WSU_NAMESPACE).equals("")) ? def.getPrefix(WSU_NAMESPACE) : "wsu";
|
||||
String spNs = (def.getPrefix(SP_NAMESPACE) != null && !def.getPrefix(SP_NAMESPACE).equals("")) ? def.getPrefix(SP_NAMESPACE) : "sp";
|
||||
String wsomaNs = (def.getPrefix(WSOMA_SP_NAMESPACE) != null && !def.getPrefix(WSOMA_SP_NAMESPACE).equals("")) ? def.getPrefix(WSOMA_SP_NAMESPACE) : "wsoma";
|
||||
|
||||
if (extension instanceof Policy) {
|
||||
Policy policy = (Policy) extension;
|
||||
|
||||
pw.print("<" + wspNs+":Policy");
|
||||
|
||||
pw.print("<" + wspNs + ":Policy");
|
||||
String policyId = policy.getID();
|
||||
if (policyId != null && !policyId.equals("")) {
|
||||
DOMUtils.printAttribute(wsuNs + ":Id", policyId, pw);
|
||||
|
@ -127,8 +140,8 @@ public class SOAPExtSerializer
|
|||
if (policy.getMustSupportBasicAuthentication() != null) {
|
||||
MustSupportBasicAuthentication msba = policy.getMustSupportBasicAuthentication();
|
||||
pw.print("<" + myspNs + ":MustSupportBasicAuthentication");
|
||||
String authEnabled = msba.getAuthEnabled() == Boolean.TRUE? "true" : "false";
|
||||
DOMUtils.printAttribute("on",authEnabled, pw);
|
||||
String authEnabled = msba.getAuthEnabled() == Boolean.TRUE ? "true" : "false";
|
||||
DOMUtils.printAttribute("on", authEnabled, pw);
|
||||
pw.print(">");
|
||||
if (policy.getBasicAuthenticationDetail() != null) {
|
||||
boolean useUserNameToken = false;
|
||||
|
@ -155,20 +168,23 @@ public class SOAPExtSerializer
|
|||
pw.print("<" + myspNs + ":UsernameToken>");
|
||||
DOMUtils.printAttribute(myspNs + ":IncludeToken", USER_TOKEN_NAME_SPACE, pw);
|
||||
pw.println(">");
|
||||
pw.print("<" + wspNs +":Policy>");
|
||||
pw.print("<" + spNs +":WssUsernameToken10>");
|
||||
pw.print("<" + wspNs + ":Policy>");
|
||||
pw.print("<" + spNs + ":WssUsernameToken10>");
|
||||
StringCompareValidation stringCompare = (StringCompareValidation) policy.getBasicAuthenticationDetail().getCredentialValidation();
|
||||
if (stringCompare.getUsername() != null) {
|
||||
pw.print(stringCompare.getUsername());
|
||||
}
|
||||
pw.print("</" + spNs +":WssUsernameToken10>");
|
||||
pw.print("</" + spNs + ":WssUsernameToken10>");
|
||||
if (stringCompare.getPassword() != null) {
|
||||
pw.print("<" + spNs +":WssPassword>******</" + spNs + ":WssPassword>");
|
||||
pw.print("<" + spNs + ":WssPassword>******</" + spNs + ":WssPassword>");
|
||||
}
|
||||
pw.print("</" + wspNs + ":Policy>");
|
||||
pw.print("</" + myspNs + ":UsernameToken>");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(policy.getOptimizedMimeSerialization() != null) {
|
||||
OptimizedMimeSerialization oms = policy.getOptimizedMimeSerialization();
|
||||
pw.print("<" + wsomaNs + ":OptimizedMimeSerialization/>");
|
||||
}
|
||||
pw.print("</" + wspNs + ":Policy>");
|
||||
} else if (extension instanceof PolicyReference) {
|
||||
|
@ -186,136 +202,147 @@ public class SOAPExtSerializer
|
|||
}
|
||||
|
||||
public ExtensibilityElement unmarshall(Class parentType, QName elementType,
|
||||
Element el, Definition def,
|
||||
ExtensionRegistry extReg)
|
||||
throws WSDLException {
|
||||
Element el, Definition def,
|
||||
ExtensionRegistry extReg)
|
||||
throws WSDLException {
|
||||
|
||||
if(Policy.QNAME_ADDRESS.equals(elementType)) {
|
||||
String wsuNs = (def.getPrefix(WSU_NAMESPACE) != null && !def.getPrefix(WSU_NAMESPACE).equals(""))? def.getPrefix(WSU_NAMESPACE) : "wsu";
|
||||
if (Policy.QNAME_ADDRESS.equals(elementType)) {
|
||||
String wsuNs = (def.getPrefix(WSU_NAMESPACE) != null && !def.getPrefix(WSU_NAMESPACE).equals("")) ? def.getPrefix(WSU_NAMESPACE) : "wsu";
|
||||
String id = DOMUtils.getAttribute(el, wsuNs + ":Id");
|
||||
Policy pol = null;
|
||||
if(id != null) {
|
||||
if (id != null) {
|
||||
NodeList list = el.getElementsByTagNameNS(Policy.NS_URI_BASIC_AUTHENTICATION_SECURITY_POLICY, "MustSupportBasicAuthentication");
|
||||
if(list != null && list.getLength() > 0) {
|
||||
if (list != null && list.getLength() > 0) {
|
||||
Node msbaNode = list.item(0);
|
||||
MustSupportBasicAuthentication msba = new MustSupportBasicAuthentication();
|
||||
NamedNodeMap attrs = msbaNode.getAttributes();
|
||||
Node onNode = attrs.getNamedItem(MustSupportBasicAuthentication.ATTR_ON);
|
||||
if (onNode != null) {
|
||||
String on = onNode.getNodeValue();
|
||||
msba.setAuthEnabled(Boolean.valueOf(on.equalsIgnoreCase("true") ||
|
||||
on.equalsIgnoreCase("yes") ||
|
||||
on.equalsIgnoreCase("1")));
|
||||
msba.setAuthEnabled(Boolean.valueOf(on.equalsIgnoreCase("true")
|
||||
|| on.equalsIgnoreCase("yes")
|
||||
|| on.equalsIgnoreCase("1")));
|
||||
}
|
||||
|
||||
|
||||
BasicAuthenticationDetail bad = new BasicAuthenticationDetail();
|
||||
try {
|
||||
getAuthenticationDetail(msbaNode, bad);
|
||||
} catch (Exception e) {
|
||||
throw new WSDLException("INVALID_WSDL", e.getMessage(), e);
|
||||
throw new WSDLException("INVALID_WSDL", e.getMessage(), e);
|
||||
}
|
||||
|
||||
|
||||
pol = new Policy();
|
||||
pol.setID(id);
|
||||
pol.setMustSupportBasicAuthentication(msba);
|
||||
pol.setBasicAuthenticationDetail(bad);
|
||||
|
||||
NodeList userNameList = el.getElementsByTagNameNS(Policy.NS_URI_SECURITY_POLICY, "WssUsernameToken10");
|
||||
if(userNameList != null) {
|
||||
Element userElem = (Element)userNameList.item(0);
|
||||
if(userElem != null && userElem.getChildNodes().getLength() > 0) {
|
||||
|
||||
NodeList userNameList = el.getElementsByTagNameNS(Policy.NS_URI_SECURITY_POLICY, "WssUsernameToken10");
|
||||
if (userNameList != null) {
|
||||
Element userElem = (Element) userNameList.item(0);
|
||||
if (userElem != null && userElem.getChildNodes().getLength() > 0) {
|
||||
String username = userElem.getChildNodes().item(0).getNodeValue();
|
||||
try {
|
||||
if (isAToken(username)) {
|
||||
String token = username;
|
||||
String appVariableName = getApplicationVariableName(token);
|
||||
|
||||
if (!mResolveTokens) {
|
||||
if (!mApplicationVariablesMap.containsKey(appVariableName)) {
|
||||
String[] metadata = new String[] {null, "STRING"};
|
||||
mApplicationVariablesMap.put(appVariableName, metadata);
|
||||
}
|
||||
} else {
|
||||
String[] metadata = (String[]) mApplicationVariablesMap.get(appVariableName);
|
||||
|
||||
if (metadata == null || metadata[0] == null) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00252.Application_variable_not_defined", token));
|
||||
}
|
||||
|
||||
String token = username;
|
||||
String appVariableName = getApplicationVariableName(token);
|
||||
|
||||
if (!mResolveTokens) {
|
||||
if (!mApplicationVariablesMap.containsKey(appVariableName)) {
|
||||
String[] metadata = new String[]{null, "STRING"};
|
||||
mApplicationVariablesMap.put(appVariableName, metadata);
|
||||
}
|
||||
} else {
|
||||
String[] metadata = (String[]) mApplicationVariablesMap.get(appVariableName);
|
||||
|
||||
if (metadata == null || metadata[0] == null) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00252.Application_variable_not_defined", token));
|
||||
}
|
||||
|
||||
pol.setUserName(metadata[0]);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation)bad.getCredentialValidation();
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation) bad.getCredentialValidation();
|
||||
scv.setUsername(metadata[0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pol.setUserName(username);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation)bad.getCredentialValidation();
|
||||
}
|
||||
} else {
|
||||
pol.setUserName(username);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation) bad.getCredentialValidation();
|
||||
scv.setUsername(username);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new WSDLException("INVALID_WSDL", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
NodeList passwordList = el.getElementsByTagNameNS(Policy.NS_URI_SECURITY_POLICY, "WssPassword");
|
||||
if(passwordList != null) {
|
||||
Element passwordElem = (Element)passwordList.item(0);
|
||||
if(passwordElem != null && passwordElem.getChildNodes().getLength() > 0) {
|
||||
if (passwordList != null) {
|
||||
Element passwordElem = (Element) passwordList.item(0);
|
||||
if (passwordElem != null && passwordElem.getChildNodes().getLength() > 0) {
|
||||
String password = passwordElem.getChildNodes().item(0).getNodeValue();
|
||||
try {
|
||||
if (isAToken(password)) {
|
||||
String token = password;
|
||||
String appVariableName = getApplicationVariableName(token);
|
||||
|
||||
if (!mResolveTokens) {
|
||||
if (!mApplicationVariablesMap.containsKey(appVariableName)) {
|
||||
String[] metadata = new String[] {null, "PASSWORD"};
|
||||
mApplicationVariablesMap.put(appVariableName, metadata);
|
||||
}
|
||||
} else {
|
||||
String[] metadata = (String[]) mApplicationVariablesMap.get(appVariableName);
|
||||
if (metadata == null || metadata[0] == null) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00252.Application_variable_not_defined", token));
|
||||
}
|
||||
|
||||
String token = password;
|
||||
String appVariableName = getApplicationVariableName(token);
|
||||
|
||||
if (!mResolveTokens) {
|
||||
if (!mApplicationVariablesMap.containsKey(appVariableName)) {
|
||||
String[] metadata = new String[]{null, "PASSWORD"};
|
||||
mApplicationVariablesMap.put(appVariableName, metadata);
|
||||
}
|
||||
} else {
|
||||
String[] metadata = (String[]) mApplicationVariablesMap.get(appVariableName);
|
||||
if (metadata == null || metadata[0] == null) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00252.Application_variable_not_defined", token));
|
||||
}
|
||||
|
||||
pol.setPassword(metadata[0]);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation)bad.getCredentialValidation();
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation) bad.getCredentialValidation();
|
||||
scv.setPassword(metadata[0].toCharArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pol.setPassword(password);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation)bad.getCredentialValidation();
|
||||
pol.setPassword(password);
|
||||
|
||||
if (bad.getCredentialValidation() instanceof StringCompareValidation) {
|
||||
StringCompareValidation scv = (StringCompareValidation) bad.getCredentialValidation();
|
||||
scv.setPassword(password.toCharArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new WSDLException("INVALID_WSDL", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((bad.getCredentialValidationType() == BasicAuthenticationDetail.CredentialValidationType.StringCompare) &&
|
||||
(userNameList == null || passwordList == null)) {
|
||||
if ((bad.getCredentialValidationType() == BasicAuthenticationDetail.CredentialValidationType.StringCompare)
|
||||
&& (userNameList == null || passwordList == null)) {
|
||||
throw new WSDLException("INVALID_WSDL", mMessages.getString("HTTPBC-E00256.WssTokenCompare_authentication_no_username_or_password"));
|
||||
}
|
||||
|
||||
return pol;
|
||||
}
|
||||
|
||||
list = el.getElementsByTagNameNS(WSOMA_SP_NAMESPACE, "OptimizedMimeSerialization");
|
||||
if (list != null && list.getLength() > 0) {
|
||||
OptimizedMimeSerialization msba = new OptimizedMimeSerialization();
|
||||
|
||||
pol = new Policy();
|
||||
pol.setID(id);
|
||||
pol.setOptimizedMimeSerialization(msba);
|
||||
|
||||
return pol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(PolicyReference.QNAME_ADDRESS.equals(elementType)) {
|
||||
if (PolicyReference.QNAME_ADDRESS.equals(elementType)) {
|
||||
String URI = DOMUtils.getAttribute(el, "URI");
|
||||
if(URI != null) {
|
||||
if (URI != null) {
|
||||
PolicyReference pref = new PolicyReference();
|
||||
pref.setURI(URI);
|
||||
return pref;
|
||||
|
@ -332,10 +359,9 @@ public class SOAPExtSerializer
|
|||
return extDeserializer.unmarshall(parentType, elementType, el, def, extReg);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isAToken(String name) throws Exception {
|
||||
boolean isToken = false;
|
||||
|
||||
boolean isToken = false;
|
||||
|
||||
if (name.startsWith("${")) {
|
||||
if (name.endsWith("}")) {
|
||||
isToken = true;
|
||||
|
@ -343,52 +369,52 @@ public class SOAPExtSerializer
|
|||
throw new Exception(mMessages.getString("HTTPBC-E00253.Token_name_invalid", name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return isToken;
|
||||
}
|
||||
|
||||
|
||||
protected String getApplicationVariableName(String aToken) throws Exception {
|
||||
String tokenName = null;
|
||||
|
||||
|
||||
if (aToken == null || "".equals(aToken)) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00253.Token_name_invalid", aToken)); // fixme!
|
||||
}
|
||||
|
||||
|
||||
tokenName = aToken.substring(2, aToken.length() - 1);
|
||||
if ("".equals(tokenName)) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00253.Token_name_invalid", aToken)); // fixme!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return tokenName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void getAuthenticationDetail (Node mustSupportAuthNode, BasicAuthenticationDetail detail) throws Exception {
|
||||
private void getAuthenticationDetail(Node mustSupportAuthNode, BasicAuthenticationDetail detail) throws Exception {
|
||||
if (mustSupportAuthNode != null) {
|
||||
NodeList list = mustSupportAuthNode.getChildNodes();
|
||||
if (list == null) { // fall back to string compare
|
||||
detail.setCredentialValidationType(BasicAuthenticationDetail.CredentialValidationType.StringCompare);
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
} else {
|
||||
for (int i=0; i < list.getLength(); i++) {
|
||||
for (int i = 0; i < list.getLength(); i++) {
|
||||
Node cNode = list.item(i);
|
||||
if (cNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element elem = (Element)cNode;
|
||||
Element elem = (Element) cNode;
|
||||
String elemLN = elem.getLocalName();
|
||||
if (elemLN.equals(BasicAuthenticationDetail.ELEM_BasicAuthenticationDetail)) {
|
||||
NodeList detailChildren = cNode.getChildNodes();
|
||||
if (detailChildren == null) { // fall back to string compare
|
||||
detail.setCredentialValidationType(BasicAuthenticationDetail.CredentialValidationType.StringCompare);
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
} else {
|
||||
for (int ii=0; ii < detailChildren.getLength(); ii++) {
|
||||
for (int ii = 0; ii < detailChildren.getLength(); ii++) {
|
||||
Node detailChild = detailChildren.item(ii);
|
||||
if (detailChild.getNodeType() == Node.ELEMENT_NODE) {
|
||||
Element dcelem = (Element)detailChild;
|
||||
Element dcelem = (Element) detailChild;
|
||||
String dcelemLN = dcelem.getLocalName();
|
||||
if (dcelemLN.equals(StringCompareValidation.ELEM_StringCompare)) {
|
||||
detail.setCredentialValidationType(BasicAuthenticationDetail.CredentialValidationType.StringCompare);
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
detail.setCredentialValidation(new StringCompareValidation());
|
||||
break;
|
||||
} else if (dcelemLN.equals(AccessManagerValidation.ELEM_AccessManager)) {
|
||||
AccessManagerValidation am = new AccessManagerValidation();
|
||||
|
@ -396,9 +422,9 @@ public class SOAPExtSerializer
|
|||
detail.setCredentialValidation(am);
|
||||
NamedNodeMap attrs = detailChild.getAttributes();
|
||||
Node authNode = attrs.getNamedItem(AccessManagerValidation.ATTR_AUTHORIZATION);
|
||||
if(authNode != null){
|
||||
String authValue = authNode.getNodeValue();
|
||||
am.setAuthorization(authValue);
|
||||
if (authNode != null) {
|
||||
String authValue = authNode.getNodeValue();
|
||||
am.setAuthorization(authValue);
|
||||
}
|
||||
break;
|
||||
} else if (dcelemLN.equals(RealmValidation.ELEM_Realm)) {
|
||||
|
@ -412,7 +438,7 @@ public class SOAPExtSerializer
|
|||
String appVariableName = getApplicationVariableName(token);
|
||||
if (!mResolveTokens) {
|
||||
if (!mApplicationVariablesMap.containsKey(appVariableName)) {
|
||||
String[] metadata = new String[] {null, "STRING"};
|
||||
String[] metadata = new String[]{null, "STRING"};
|
||||
mApplicationVariablesMap.put(appVariableName, metadata);
|
||||
}
|
||||
} else {
|
||||
|
@ -420,16 +446,16 @@ public class SOAPExtSerializer
|
|||
if (metadata == null || metadata[0] == null) {
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00252.Application_variable_not_defined", token));
|
||||
}
|
||||
rv.setRealmName(metadata[0]);
|
||||
rv.setRealmName(metadata[0]);
|
||||
}
|
||||
} else {
|
||||
rv.setRealmName(realmName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception (mMessages.getString("HTTPBC-E00255.Realm_authentication_no_realm_name"));
|
||||
throw new Exception(mMessages.getString("HTTPBC-E00255.Realm_authentication_no_realm_name"));
|
||||
}
|
||||
detail.setCredentialValidationType(BasicAuthenticationDetail.CredentialValidationType.Realm);
|
||||
detail.setCredentialValidation(rv);
|
||||
detail.setCredentialValidation(rv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -438,7 +464,7 @@ public class SOAPExtSerializer
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,21 +112,27 @@ public class JAXWSEndpointFactory {
|
|||
QName portName = new QName(endpoint.getServiceName().getNamespaceURI(), endpoint.getEndpointName());
|
||||
Container container = null; // This counter can contain info on security/monitoring pipe
|
||||
|
||||
WSBinding binding = null;
|
||||
String lexicalBindingType = null;
|
||||
|
||||
if (endpoint instanceof com.sun.jbi.httpsoapbc.HttpSoap12Endpoint) {
|
||||
String lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;;
|
||||
BindingID bindingID = BindingID.parse(lexicalBindingType);
|
||||
binding = bindingID.createBinding();
|
||||
if (endpoint.isMTOMEnabled()) {
|
||||
lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING;
|
||||
} else {
|
||||
lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
|
||||
}
|
||||
}else if (endpoint instanceof HttpSoapEndpoint) {
|
||||
String lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;;
|
||||
BindingID bindingID = BindingID.parse(lexicalBindingType);
|
||||
binding = bindingID.createBinding();
|
||||
if (endpoint.isMTOMEnabled()) {
|
||||
lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING;
|
||||
} else {
|
||||
lexicalBindingType = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
|
||||
}
|
||||
} else if (endpoint instanceof HttpEndpoint) {
|
||||
String lexicalBindingType = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;;
|
||||
BindingID bindingID = BindingID.parse(lexicalBindingType);
|
||||
binding = bindingID.createBinding();
|
||||
lexicalBindingType = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
|
||||
}
|
||||
|
||||
BindingID bindingID = BindingID.parse(lexicalBindingType);
|
||||
WSBinding binding = bindingID.createBinding();
|
||||
|
||||
if (mLogger.isLoggable(Level.FINE)) {
|
||||
mLogger.log(Level.FINE, "Creating WSEndpoint with primary WSDL URL: " + endpoint.getOriginalWSDL().toURL());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue