Author: tho...@jb...
Date: 2006-06-30 02:54:49 -0400 (Fri, 30 Jun 2006)
New Revision: 522
Added:
trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java
trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java
trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java
trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSDeployment.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
trunk/src/test/java/org/jboss/test/ws/jaxws/
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanMessage.java
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayloadJAXB.java
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/UserType.java
trunk/src/test/resources/jaxws/
trunk/src/test/resources/jaxws/provider/
trunk/src/test/resources/jaxws/provider/message/
trunk/src/test/resources/jaxws/provider/message/WEB-INF/
trunk/src/test/resources/jaxws/provider/message/WEB-INF/web.xml
Removed:
trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java
trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java
trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java
Modified:
trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java
trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientDeployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109Deployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181Deployment.java
trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/deployment/ServiceEndpointDeployer.java
trunk/src/main/java/org/jboss/ws/deployment/UnifiedDeploymentInfo.java
trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorEJB21.java
trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorEJB3.java
trunk/src/main/java/org/jboss/ws/integration/jboss/DeployerInterceptorJSE.java
trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceClientDeployer.java
trunk/src/main/java/org/jboss/ws/integration/other/GenericServiceEndpointServlet.java
trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ParameterWrapping.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceObjectFactory.java
trunk/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ServiceMetaData.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpoint.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInfo.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointInvoker.java
trunk/src/main/java/org/jboss/ws/server/ServiceEndpointManager.java
trunk/src/main/java/org/jboss/ws/soap/SOAPMessageDispatcher.java
trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
trunk/src/main/java/org/jboss/ws/wsse/WSSecurityDispatcher.java
trunk/src/test/ant/build-jars.xml
trunk/src/test/build.xml
trunk/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
trunk/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java
Log:
JBWS-1020: Implement javax.xml.ws.Provider
Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -37,6 +37,9 @@
*/
public interface BindingProvider
{
+ static String JAXRPC_SOAP11_BINDING = "org.jboss.ws.binding.jaxrpc.soap11";
+ static String JAXWS_MESSAGE_BINDING = "org.jboss.ws.binding.jaxws.message";
+
/** On the client side, generate the SOAPMessage from IN parameters. */
SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
Modified: trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -1,35 +1,34 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.ws.binding;
// $Id$
import java.util.HashMap;
-import javax.xml.rpc.JAXRPCException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP11;
+import org.jboss.ws.binding.soap.JAXWSBindingProviderMessage;
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.soap.SOAP11BindingProvider;
-
/** A registry of binding providers.
*
* @author Tho...@jb...
@@ -37,13 +36,13 @@
*/
public class BindingProviderRegistry
{
- private static Class defaultProvider = SOAP11BindingProvider.class;
+ private static Class defaultProvider = JAXRPCBindingProviderSOAP11.class;
private static HashMap providers = new HashMap();
- // Put the default provider in the map
static
{
- providers.put(Constants.NS_SOAP11_ENV, defaultProvider);
+ providers.put(BindingProvider.JAXRPC_SOAP11_BINDING, defaultProvider);
+ providers.put(BindingProvider.JAXWS_MESSAGE_BINDING, JAXWSBindingProviderMessage.class);
}
/** Get a binding provider for a given URI
@@ -65,7 +64,7 @@
}
catch (Exception e)
{
- throw new JAXRPCException(e);
+ throw new WSException(e);
}
}
@@ -83,7 +82,7 @@
}
catch (Exception e)
{
- throw new JAXRPCException(e);
+ throw new WSException(e);
}
}
}
Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-28 02:58:55 UTC (rev 502)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -0,0 +1,795 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.binding.soap;
+
+// $Id$
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.BindingProvider;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.soap.*;
+import org.jboss.ws.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.soap.attachment.CIDGenerator;
+import org.jboss.ws.soap.attachment.MimeConstants;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.utils.MimeUtils;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.Element;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/** An abstract BindingProvider for SOAP that is independent of the SOAP version.
+ *
+ * @author Tho...@jb...
+ * @since 16-Oct-2004
+ */
+public abstract class JAXRPCBindingProvider implements BindingProvider
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JAXRPCBindingProvider.class);
+
+ /** Create the SOAPMessage */
+ protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException;
+
+ /** On the client side, generate the payload from IN parameters. */
+ public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ log.debug("bindRequestMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setMessage(reqMessage);
+
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getXmlName();
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+
+ log.debug("Create RPC body element: " + opName);
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement;
+ SOAPContentElement contentElement = addParameterToMessage(paramMetaData, value, soapElement);
+
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBody;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ // Add unbound headers
+ if (unboundHeaders != null)
+ {
+ Iterator it = unboundHeaders.values().iterator();
+ while (it.hasNext())
+ {
+ UnboundHeader unboundHeader = (UnboundHeader)it.next();
+ if (unboundHeader.getMode() != ParameterMode.OUT)
+ {
+ QName xmlName = unboundHeader.getXmlName();
+ Object value = unboundHeader.getHeaderValue();
+
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
+
+ SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName);
+ contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+ contentElement.setObjectValue(value);
+
+ log.debug("Add unboundHeader element: " + soapName);
+ soapHeader.addChildElement(contentElement);
+ }
+ }
+ }
+
+ return reqMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ // Read the SOAPEnvelope from the reqMessage
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ if (opMetaData.isMessageEndpoint() == false)
+ {
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name elName = soapBodyElement.getElementName();
+
+ QName elQName = new QName(elName.getURI(), elName.getLocalName(), elName.getPrefix());
+ elQName = namespaceRegistry.registerQName(elQName);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.getMode() == ParameterMode.OUT)
+ {
+ epInv.setRequestParamValue(xmlName, null);
+ }
+ else
+ {
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader() == false)
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBodyElement, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Document style
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ if (paramMetaData.getMode() == ParameterMode.IN)
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, true);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBody, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Generic message endpoint
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = soapBody.getChildElements().next();
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, generate the payload from OUT parameters. */
+ public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ {
+ log.debug("bindResponseMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setMessage(resMessage);
+
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWayOperation())
+ {
+ resMessage.getSOAPPart().setContent(null);
+ return resMessage;
+ }
+
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getResponseName();
+
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ // Add the return to the message
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBodyElement);
+ epInv.setReturnValue(soapElement);
+ soapElement.setObjectValue(value);
+ }
+ }
+
+ // Add the out parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getResponseParamValue(xmlName);
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ else
+ {
+ addParameterToMessage(paramMetaData, value, soapBodyElement);
+ }
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (opMetaData.isDocumentWrapped())
+ value = ParameterWrapping.wrapResponseParameter(opMetaData, value);
+
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBody);
+ epInv.setReturnValue(soapElement);
+ }
+ }
+
+ // Add the out header parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = epInv.getResponseParamValue(xmlName);
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the client side, extract the OUT parameters from the payload and return them to the client. */
+ public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ log.debug("unbindResponseMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWayOperation() == true)
+ {
+ return;
+ }
+
+ // WS-Addressing might redirect the response, which results in an empty envelope
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ if (soapEnvelope == null)
+ {
+ return;
+ }
+
+ // Get the SOAP message context that is associated with the current thread
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ Iterator bodyChildren = soapBody.getChildElements();
+
+ SOAPBodyElement soapBodyElement = null;
+ if (bodyChildren.hasNext() != false)
+ soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+
+ // Translate the SOAPFault to an exception and throw it
+ if (soapBodyElement instanceof SOAPFaultImpl)
+ {
+ SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement;
+ SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault);
+ throw faultEx;
+ }
+
+ // Extract unbound OUT headers
+ if (unboundHeaders != null)
+ {
+ Map<QName, UnboundHeader> outHeaders = new HashMap<QName, UnboundHeader>();
+ Iterator itHeaderElements = soapHeader.getChildElements();
+ while (itHeaderElements.hasNext())
+ {
+ SOAPContentElement soapHeaderElement = (SOAPHeaderElementImpl)itHeaderElements.next();
+ Name elName = soapHeaderElement.getElementName();
+ QName xmlName = new QName(elName.getURI(), elName.getLocalName());
+
+ UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
+ if (unboundHeader != null)
+ {
+ soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+
+ // Do the unmarshalling
+ Object value = soapHeaderElement.getObjectValue();
+ unboundHeader.setHeaderValue(value);
+ outHeaders.put(xmlName, unboundHeader);
+ }
+ }
+ unboundHeaders.clear();
+ unboundHeaders.putAll(outHeaders);
+ }
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBodyElement, false);
+ epInv.setReturnValue(value);
+ }
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, resMessage);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader : (SOAPElement)soapBodyElement;
+ Object value = getParameterFromMessage(paramMetaData, soapElement, false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+
+ // WS-Eventing has no message part for UnsubscribeResponseMsg
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBody, false);
+ epInv.setReturnValue(value);
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ }
+ }
+
+ private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
+ {
+ String partName = paramMetaData.getXmlName().getLocalPart();
+ Set mimeTypes = paramMetaData.getMimeTypes();
+
+ AttachmentPart part = new AttachmentPartImpl();
+ if (value instanceof DataHandler)
+ {
+ DataHandler handler = (DataHandler)value;
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new BindingException("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes);
+
+ part.setDataHandler((DataHandler)value);
+ }
+ else
+ {
+ String mimeType = null;
+ if (mimeTypes != null && mimeTypes.size() > 0)
+ {
+ mimeType = (String)mimeTypes.iterator().next();
+ }
+ else
+ {
+ mimeType = MimeUtils.resolveMimeType(value);
+ }
+
+ if (mimeType == null)
+ throw new BindingException("Could not determine mime type for attachment parameter: " + partName);
+
+ part.setContent(value, mimeType);
+ }
+
+ if (paramMetaData.isSwA())
+ {
+ String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>';
+ part.setContentId(swaCID);
+ }
+ if (paramMetaData.isXOP())
+ {
+ String xopCID = '<' + cidGenerator.generateFromName(partName) + '>';
+ part.setContentId(xopCID);
+ }
+
+ return part;
+ }
+
+ private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage message) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+
+ AttachmentPart part = ((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
+ if (part == null)
+ throw new BindingException("Could not locate attachment for parameter: " + paramMetaData.getXmlName());
+
+ return part;
+ }
+
+ /** Marshall the given parameter and add it to the SOAPMessage */
+ private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData, Object value, SOAPElement soapElement) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ if (value != null && paramMetaData.isXOP() == false)
+ {
+ Class valueType = value.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new BindingException("javaType " + javaType.getName() + " is not assignable from: " + valueType.getName());
+ }
+
+ // Make sure we have a prefix on qualified names
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ }
+
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
+ if (paramMetaData.isSOAPArrayParam())
+ soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement contentElement;
+ if (soapElement instanceof SOAPHeader)
+ {
+ contentElement = new SOAPHeaderElementImpl(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ Style style = paramMetaData.getOperationMetaData().getStyle();
+ if (style == Style.DOCUMENT)
+ {
+ contentElement = new SOAPBodyElementDoc(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ contentElement = new SOAPContentElement(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ }
+
+ contentElement.setParamMetaData(paramMetaData);
+
+ if (paramMetaData.isSOAPArrayParam())
+ contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ // The object value needs to be set after xmime:contentType
+ if (paramMetaData.isXOP() == false)
+ {
+ contentElement.setObjectValue(value);
+ }
+ else
+ {
+ contentElement.setXMimeContentType(MimeUtils.resolveMimeType(value));
+ contentElement.setObjectValue(value);
+ }
+
+ return contentElement;
+ }
+
+ /** Unmarshall a message element and add it to the parameter list
+ * @param optional TODO*/
+ private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException
+ {
+ Name xmlName = new NameImpl(paramMetaData.getXmlName());
+ Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement soapContentElement = null;
+ Iterator childElements = soapElement.getChildElements();
+ while (childElements.hasNext())
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // If this message was manipulated by a handler the child may not be a content element
+ if (!(childElement instanceof SOAPContentElement))
+ childElement = (SOAPContentElement)soapElement.replaceChild(new SOAPContentElement(childElement), childElement);
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+
+ if (xmlName.equals(elName))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+
+ if (soapArrayName.equals(elName))
+ {
+ QName compXMLName = paramMetaData.getXmlName();
+ Element compElement = DOMUtils.getFirstChildElement(aux);
+ if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+ }
+ }
+
+ // If matching by name fails, try to match by xmlType
+ // This maybe necessary when wsa:Action dispatches to the operation
+ if (soapContentElement == null)
+ {
+ childElements = soapElement.getChildElements();
+ OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+ QName elType = null;
+
+ XSElementDeclaration xsdElement = typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(), elName.getURI());
+ if (xsdElement != null && xsdElement.getTypeDefinition() != null)
+ {
+ XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
+ elType = new QName(xsdType.getNamespace(), xsdType.getName());
+ }
+
+ if (paramMetaData.getXmlType().equals(elType))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ }
+ }
+ }
+
+ if (soapContentElement == null && optional == false)
+ throw new JAXRPCException("Cannot find child element: " + xmlName);
+
+ if(paramMetaData.isXOP())
+ soapContentElement.setXMimeContentType(MimeUtils.resolveMimeType(paramMetaData.getJavaType()));
+ return soapContentElement;
+ }
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-28 02:58:55 UTC (rev 502)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -0,0 +1,67 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.binding.soap;
+
+// $Id$
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageFactoryImpl;
+
+/** A BindingProvider that implements the SOAP-1.1 specifics.
+ *
+ * @author Tho...@jb...
+ * @since 09-Nov-2004
+ */
+public class JAXRPCBindingProviderSOAP11 extends JAXRPCBindingProvider
+{
+ /** Create the SOAP-1.1 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
+ return factory.createMessage();
+ }
+
+ /** On the client side, generate the payload from IN parameters. */
+ public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+
+ // Set the SOAPAction
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String soapAction = opMetaData.getSOAPAction();
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ return reqMessage;
+ }
+}
Copied: trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java (from rev 502, trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java)
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-28 02:58:55 UTC (rev 502)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.binding.soap;
+
+// $Id$
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageFactoryImpl;
+
+/** A BindingProvider that implements the SOAP-1.2 specifics.
+ *
+ * @author Tho...@jb...
+ * @since 09-Nov-2004
+ */
+public class JAXRPCBindingProviderSOAP12 extends JAXRPCBindingProvider
+{
+ /** Create the SOAP-1.2 message */
+ protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
+ return factory.createMessage();
+ }
+}
Added: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.binding.soap;
+
+// $Id$
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.BindingProvider;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.SOAPMessageContextImpl;
+
+/** A BindingProvider for unprocessed SOAP Messages
+ *
+ * @author Tho...@jb...
+ * @since 27-Jun-2006
+ */
+public class JAXWSBindingProviderMessage implements BindingProvider
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(JAXWSBindingProviderMessage.class);
+
+ /** On the client side, generate the payload from IN parameters. */
+ public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
+ QName xmlName = paramMetaData.getXmlName();
+ epInv.setRequestParamValue(xmlName, reqMessage);
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, generate the payload from OUT parameters. */
+ public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ {
+ log.debug("bindResponseMessage: " + opMetaData.getXmlName());
+
+ try
+ {
+ SOAPMessageContextImpl msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
+ msgContext.setMessage(resMessage);
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the client side, extract the OUT parameters from the payload and return them to the client. */
+ public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
+}
Property changes on: trunk/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAP11BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -1,67 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/** A BindingProvider that implements the SOAP-1.1 specifics.
- *
- * @author Tho...@jb...
- * @since 09-Nov-2004
- */
-public class SOAP11BindingProvider extends SOAPBindingProvider
-{
- /** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- return factory.createMessage();
- }
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
-
- // Set the SOAPAction
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String soapAction = opMetaData.getSOAPAction();
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
-
- return reqMessage;
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAP12BindingProvider.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -1,47 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/** A BindingProvider that implements the SOAP-1.2 specifics.
- *
- * @author Tho...@jb...
- * @since 09-Nov-2004
- */
-public class SOAP12BindingProvider extends SOAPBindingProvider
-{
- /** Create the SOAP-1.2 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
- }
-}
Deleted: trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-29 12:44:24 UTC (rev 521)
+++ trunk/src/main/java/org/jboss/ws/binding/soap/SOAPBindingProvider.java 2006-06-30 06:54:49 UTC (rev 522)
@@ -1,795 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.jaxrpc.ParameterWrapping;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.soap.*;
-import org.jboss.ws.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.soap.attachment.CIDGenerator;
-import org.jboss.ws.soap.attachment.MimeConstants;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.utils.MimeUtils;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Element;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.*;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/** An abstract BindingProvider for SOAP that is independent of the SOAP version.
- *
- * @author Tho...@jb...
- * @since 16-Oct-2004
- */
-public abstract class SOAPBindingProvider implements BindingProvider
-{
- // provide logging
- private static final Logger log = Logge...
[truncated message content] |