Author: thomas.diesler(a)jboss.com
Date: 2007-04-03 10:54:13 -0400 (Tue, 03 Apr 2007)
New Revision: 2749
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
Removed:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
Modified:
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
Log:
Partial commit
Modified:
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/ServiceEndpointInterceptor.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -33,7 +33,9 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java
===================================================================
---
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/integration-jboss42/src/java/org/jboss/ws/integration/jboss42/jms/JMSMessageDispatcher.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -36,6 +36,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.server.ServiceEndpoint;
import org.jboss.ws.core.server.ServiceEndpointInvoker;
@@ -90,7 +91,7 @@
// Process the request message and return the already serialized response
// Legacy implementations of the JMSTransportSupport dont provide a msg
// context which is needed for serialization.
- resMessage = sep.handleRequest(null, null, reqMessage);
+ resMessage = (SOAPMessage)sep.processRequest(null, null, reqMessage);
resMessage.writeTo(new ByteArrayOutputStream());
return resMessage;
}
Modified:
branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
===================================================================
---
branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -33,6 +33,7 @@
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -26,6 +26,7 @@
import java.util.Map;
import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.UnboundHeader;
@@ -40,19 +41,19 @@
public interface CommonBinding
{
/** On the client side, generate the Object from IN parameters. */
- Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv,
Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+ MessageAbstraction bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
/** On the server side, extract the IN parameters from the Object and populate an
Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException;
+ EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException;
/** On the server side, generate the Object from OUT parameters in the Invocation
object. */
- Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv)
throws BindingException;
+ MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException;
/** On the client side, extract the OUT parameters from the Object and return them to
the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException;
+ void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException;
/** bind an exception to a fault message */
- Object bindFaultMessage(Exception ex);
+ MessageAbstraction bindFaultMessage(Exception ex);
void setHeaderSource(HeaderSource source);
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -47,11 +47,11 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.client.EndpointInfo;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.jaxrpc.ParameterWrapping;
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
@@ -361,7 +361,7 @@
if (handlerPass)
{
// unbind the return values
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv,
unboundHeaders);
}
@@ -374,7 +374,7 @@
if (((SOAPBodyImpl)reqMessage.getSOAPBody()).isModifiedFromSource())
{
log.debug("Handler modified body payload, unbind message
again");
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
binding.unbindResponseMessage(opMetaData, resMessage, epInv,
unboundHeaders);
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonMessageContext.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -35,6 +35,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxrpc.binding.SerializationContext;
import org.jboss.ws.core.server.PropertyCallback;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.xb.binding.NamespaceRegistry;
@@ -61,8 +62,8 @@
private EndpointMetaData epMetaData;
// The operation for this message ctx
private OperationMetaData opMetaData;
- // The SOAPMessage in this message context
- private SOAPMessage soapMessage;
+ // The Message in this message context
+ private MessageAbstraction message;
// The map of scoped properties
protected Map<String, ScopedProperty> scopedProps = new HashMap<String,
ScopedProperty>();
// The current property scope
@@ -77,7 +78,7 @@
{
this.epMetaData = msgContext.epMetaData;
this.opMetaData = msgContext.opMetaData;
- this.soapMessage = msgContext.soapMessage;
+ this.message = msgContext.message;
this.serContext = msgContext.serContext;
this.scopedProps = new HashMap<String,
ScopedProperty>(msgContext.scopedProps);
this.currentScope = msgContext.currentScope;
@@ -118,14 +119,24 @@
public SOAPMessage getSOAPMessage()
{
- return soapMessage;
+ return (SOAPMessage)message;
}
public void setSOAPMessage(SOAPMessage soapMessage)
{
- this.soapMessage = soapMessage;
+ this.message = (MessageAbstraction)soapMessage;
}
+ public MessageAbstraction getMessageAbstraction()
+ {
+ return message;
+ }
+
+ public void setMessageAbstraction(MessageAbstraction message)
+ {
+ this.message = message;
+ }
+
public SerializationContext getSerializationContext()
{
if (serContext == null)
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP11Binding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -35,6 +35,7 @@
import org.jboss.ws.core.jaxrpc.Use;
import org.jboss.ws.core.soap.MessageFactoryImpl;
import org.jboss.ws.core.soap.SOAPFaultImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
/**
@@ -50,11 +51,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws
SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
Use encStyle = opMetaData.getEndpointMetaData().getEncodingStyle();
if (Use.ENCODED.equals(encStyle))
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAP12Binding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -52,11 +52,11 @@
}
/** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException
+ protected MessageAbstraction createMessage(OperationMetaData opMetaData) throws
SOAPException
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
+ return (MessageAbstraction)factory.createMessage();
}
protected abstract Set<String> getRoles();
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonSOAPBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -129,11 +129,11 @@
this.mtomEnabled = flag;
}
- /** Create the SOAP-1.1 message */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws
SOAPException;
+ /** Create the message */
+ protected abstract MessageAbstraction createMessage(OperationMetaData opMetaData)
throws SOAPException;
/** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
{
if (log.isDebugEnabled())
log.debug("bindRequestMessage: " + opMetaData.getQName());
@@ -250,7 +250,7 @@
public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage
reqMessage);
/** On the server side, extract the IN parameters from the payload and populate an
Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction payload) throws BindingException
{
if (log.isDebugEnabled())
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -346,7 +346,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
if (log.isDebugEnabled())
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -475,7 +475,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to
the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object payload,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
if (log.isDebugEnabled())
@@ -610,9 +610,9 @@
}
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = createFaultMessageFromException(ex);
+ SOAPMessageImpl faultMessage =
(SOAPMessageImpl)createFaultMessageFromException(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -0,0 +1,106 @@
+/*
+ * 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.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.ws.core.soap.XMLFragment;
+import org.jboss.ws.core.soap.attachment.MimeConstants;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class HTTPMessageImpl implements HTTPMessageAbstraction
+{
+ private MimeHeaders mimeHeaders;
+ private XMLFragment xmlFragment;
+
+ public HTTPMessageImpl(MimeHeaders mimeHeaders, InputStream inputStream)
+ {
+ this.mimeHeaders = mimeHeaders;
+ this.xmlFragment = new XMLFragment(new StreamSource(inputStream));
+ }
+
+ public HTTPMessageImpl(Source source)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(source);
+
+ initDefaultMimeHeaders();
+ }
+
+ public HTTPMessageImpl(Result result)
+ {
+ this.mimeHeaders = new MimeHeaders();
+ this.xmlFragment = new XMLFragment(result);
+
+ initDefaultMimeHeaders();
+ }
+
+ private void initDefaultMimeHeaders()
+ {
+ mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, MimeConstants.TYPE_XML_UTF8);
+ }
+
+ public XMLFragment getXmlFragment()
+ {
+ return xmlFragment;
+ }
+
+ public void setXmlFragment(XMLFragment xmlFragment)
+ {
+ this.xmlFragment = xmlFragment;
+ }
+
+ public MimeHeaders getMimeHeaders()
+ {
+ if (mimeHeaders == null)
+ mimeHeaders = new MimeHeaders();
+
+ return mimeHeaders;
+ }
+
+ public void setMimeHeaders(MimeHeaders mimeHeaders)
+ {
+ this.mimeHeaders = mimeHeaders;
+ }
+
+ public void writeTo(OutputStream outputStream) throws IOException
+ {
+ xmlFragment.writeTo(outputStream);
+ }
+
+ public boolean isFaultMessage()
+ {
+ return false;
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -21,6 +21,9 @@
*/
package org.jboss.ws.core;
+import java.io.IOException;
+import java.io.OutputStream;
+
import javax.xml.soap.MimeHeaders;
/**
@@ -32,4 +35,8 @@
public interface MessageAbstraction
{
MimeHeaders getMimeHeaders();
+
+ void writeTo(OutputStream outputStream) throws IOException;
+
+ boolean isFaultMessage();
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -8,10 +8,15 @@
import org.jboss.ws.core.soap.SOAPElementImpl;
import org.jboss.ws.core.soap.SOAPElementWriter;
-public class MessageTracer
+public final class MessageTracer
{
private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+ // Hide ctor
+ private MessageTracer()
+ {
+ }
+
public static void traceMessage(String string, MessageAbstraction message)
{
if (msgLog.isTraceEnabled())
@@ -20,19 +25,21 @@
{
try
{
- SOAPEnvelope soapReqEnv =
((SOAPMessage)message).getSOAPPart().getEnvelope();
- String envStr =
SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
- msgLog.trace(string + "\n" + envStr);
+ SOAPEnvelope soapEnv =
((SOAPMessage)message).getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ String envStr =
SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv, true);
+ msgLog.trace(string + "\n" + envStr);
+ }
}
- catch (SOAPException e)
+ catch (SOAPException ex)
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ msgLog.error("Cannot trace SOAPMessage", ex);
}
}
else
{
- msgLog.trace("Unsupported message type: " + message);
+ msgLog.warn("Unsupported message type: " + message);
}
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -25,9 +25,8 @@
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPMessageMarshaller;
-import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageMarshaller;
+import org.jboss.ws.core.jaxws.binding.HTTPMessageUnMarshaller;
/**
* @since 02-Apr-2007
@@ -36,17 +35,11 @@
{
protected UnMarshaller getUnmarshaller()
{
- return new SOAPMessageUnMarshaller();
+ return new HTTPMessageUnMarshaller();
}
protected Marshaller getMarshaller()
{
- return new SOAPMessageMarshaller();
+ return new HTTPMessageMarshaller();
}
-
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway)
- {
- // TODO Auto-generated method stub
- return null;
- }
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -21,6 +21,7 @@
*/
package org.jboss.ws.core.client;
+
import java.io.IOException;
import org.jboss.ws.core.MessageAbstraction;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -115,7 +115,7 @@
*
* A null reqMessage signifies a HTTP GET request.
*/
- protected MessageAbstraction invokeInternal(MessageAbstraction reqMessage, Object
endpoint, boolean oneway) throws IOException
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
{
if (endpoint == null)
throw new IllegalArgumentException("Given endpoint cannot be null");
@@ -216,7 +216,7 @@
{
// Get the invoker from Remoting for a given endpoint address
log.debug("Get locator for: " + endpoint);
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE,
"SOAPMessage");
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE,
"JBossWSMessage");
InvokerLocator locator = new InvokerLocator(targetAddress);
/* An HTTPClientInvoker may disconnect from the server and recreated by the
remoting layer.
@@ -228,9 +228,9 @@
*/
Marshaller marshaller = getMarshaller();
UnMarshaller unmarshaller = getUnmarshaller();
- MarshalFactory.addMarshaller("SOAPMessage", marshaller,
unmarshaller);
+ MarshalFactory.addMarshaller("JBossWSMessage", marshaller,
unmarshaller);
- client = new Client(locator, "saaj", clientConfig);
+ client = new Client(locator, "jbossws", clientConfig);
client.connect();
client.setMarshaller(marshaller);
@@ -263,8 +263,13 @@
metadata.put("NoThrowOnError", "true");
if (reqMessage != null)
+ {
populateHeaders(reqMessage, metadata);
- else metadata.put("TYPE", "GET");
+ }
+ else
+ {
+ metadata.put("TYPE", "GET");
+ }
if (callProps != null)
{
@@ -314,34 +319,10 @@
return metadata;
}
- private void populateHeaders(MessageAbstraction reqMessage, Map<String, Object>
metadata)
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String,
Object> metadata)
{
- // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted value equal to the value of the soapAction attribute of
- // soapbind:operation, if present in the corresponding WSDL description.
-
- // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
- // with a quoted empty string value, if in the corresponding WSDL description,
- // the soapAction attribute of soapbind:operation is either not present, or
- // present with an empty string as its value.
-
MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String[] action = mimeHeaders.getHeader("SOAPAction");
- if (action != null && action.length > 0)
- {
- String soapAction = action[0];
-
- // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE
MUST be a quoted string.
- if (soapAction.startsWith("\"") == false ||
soapAction.endsWith("\"") == false)
- soapAction = "\"" + soapAction + "\"";
-
- mimeHeaders.setHeader("SOAPAction", soapAction);
- }
- else
- {
- mimeHeaders.setHeader("SOAPAction", "\"\"");
- }
-
+
Properties props = new Properties();
metadata.put("HEADER", props);
Deleted:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -1,121 +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.core.client;
-
-// $Id$
-
-import java.io.IOException;
-
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.extensions.xop.XOPContext;
-
-/**
- * SOAPConnection implementation
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
- *
- * @since 02-Feb-2005
- */
-public class SOAPConnectionImpl extends SOAPConnection
-{
- // provide logging
- private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
-
- private RemotingConnectionImpl remotingConnection;
-
- public SOAPConnectionImpl()
- {
- remotingConnection = new SOAPRemotingConnection();
- }
-
- /**
- * Sends the given message to the specified endpoint and blocks until it has
- * returned the response.
- */
- public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
-
- MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
- return (SOAPMessage)resMessage;
- }
-
- /**
- * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is
received
- */
- public SOAPMessage get(Object endpoint) throws SOAPException
- {
- MessageAbstraction resMessage = callInternal(null, endpoint, false);
- return (SOAPMessage)resMessage;
- }
-
- /**
- * Sends the given message to the specified endpoint. This method is logically
- * non blocking.
- */
- public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws
SOAPException
- {
- if (reqMessage == null)
- throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
-
- MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint,
true);
- return (SOAPMessage)resMessage;
- }
-
- /** Closes this SOAPConnection
- */
- public void close() throws SOAPException
- {
- if (remotingConnection.isClosed())
- throw new SOAPException("SOAPConnection is already closed");
-
- remotingConnection.setClosed(true);
- }
-
- private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint,
boolean oneway) throws SOAPException
- {
- MessageAbstraction resMessage;
- try
- {
- resMessage = remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint,
oneway);
- }
- catch (IOException ex)
- {
- Throwable cause = ex.getCause();
- if (cause instanceof SOAPException)
- {
- throw (SOAPException)cause;
- }
- }
- return resMessage;
- }
-
-}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -24,17 +24,19 @@
// $Id$
import java.io.IOException;
-import java.net.SocketTimeoutException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
-import org.jboss.logging.Logger;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.WSException;
import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.WSTimeoutException;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -59,7 +61,7 @@
return new SOAPMessageMarshaller();
}
- public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
{
try
{
@@ -72,24 +74,47 @@
if (reqMessage != null && soapMessage.saveRequired())
soapMessage.saveChanges();
- return invokeInternal(reqMessage, endpoint, oneway);
+ return super.invoke(reqMessage, endpoint, oneway);
}
- catch (RuntimeException rte)
+ catch (SOAPException ex)
{
- Throwable cause = rte.getCause();
-
- // The CTS expects only SOAPException to be thrown.
- if (cause instanceof IOException && cause.getCause() instanceof
SOAPException)
- {
-
- }
- throw new WSException((SOAPException)cause.getCause());
-
- else throw rte;
+ IOException io = new IOException();
+ io.initCause(ex);
+ throw io;
}
- catch (SOAPException ex)
+ }
+
+ protected void populateHeaders(MessageAbstraction reqMessage, Map<String,
Object> metadata)
+ {
+ super.populateHeaders(reqMessage, metadata);
+
+ Properties props = (Properties)metadata.get("HEADER");
+
+ // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted value equal to the value of the soapAction attribute of
+ // soapbind:operation, if present in the corresponding WSDL description.
+
+ // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+ // with a quoted empty string value, if in the corresponding WSDL description,
+ // the soapAction attribute of soapbind:operation is either not present, or
+ // present with an empty string as its value.
+
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String[] action = mimeHeaders.getHeader("SOAPAction");
+ if (action != null && action.length > 0)
{
- throw new WSException(ex);
+ String soapAction = action[0];
+
+ // R1109 The value of the SOAPAction HTTP header field in a HTTP request MESSAGE
MUST be a quoted string.
+ if (soapAction.startsWith("\"") == false ||
soapAction.endsWith("\"") == false)
+ soapAction = "\"" + soapAction + "\"";
+
+ props.put("SOAPAction", soapAction);
}
+ else
+ {
+ props.put("SOAPAction", "\"\"");
+ }
+
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP11BindingJAXRPC.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -28,8 +28,8 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP11Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.RoleSource;
-import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAP12BindingJAXRPC.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -28,6 +28,7 @@
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.RoleSource;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.soap.SOAPFaultImpl;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/SOAPFaultHelperJAXRPC.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -48,6 +48,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
import org.jboss.ws.core.jaxrpc.binding.DeserializerSupport;
@@ -59,6 +60,7 @@
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPEnvelopeImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -171,7 +173,7 @@
/** Translate the request exception into a SOAPFault message.
*/
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
// Get or create the SOAPFaultException
SOAPFaultException faultEx;
@@ -192,7 +194,7 @@
try
{
- SOAPMessage faultMessage = toSOAPMessage(faultEx);
+ SOAPMessageImpl faultMessage = toSOAPMessage(faultEx);
return faultMessage;
}
catch (RuntimeException rte)
@@ -206,7 +208,7 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
{
assertFaultCode(faultEx.getFaultCode());
@@ -215,7 +217,7 @@
NamespaceRegistry nsRegistry = serContext.getNamespaceRegistry();
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPEnvelopeImpl soapEnvelope =
(SOAPEnvelopeImpl)soapMessage.getSOAPPart().getEnvelope();
SOAPBody soapBody = soapEnvelope.getBody();
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/HandlerChainBaseImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -284,7 +284,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleRequest - "
+ currHandler, soapPart, lastMessageTrace);
}
@@ -292,7 +292,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleRequest - "
+ currHandler, soapPart, lastMessageTrace);
}
}
@@ -366,7 +366,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("BEFORE handleResponse -
" + currHandler, soapPart, lastMessageTrace);
}
@@ -374,7 +374,7 @@
if (log.isTraceEnabled())
{
- SOAPPart soapPart = jaxrpcContext.getMessage().getSOAPPart();
+ SOAPPart soapPart = jaxrpcContext.getSOAPMessage().getSOAPPart();
lastMessageTrace = traceSOAPPart("AFTER handleResponse - "
+ currHandler, soapPart, lastMessageTrace);
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/handler/MessageContextJAXRPC.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -74,7 +74,7 @@
public void setMessage(SOAPMessage message)
{
- setSOAPMessage(message);
+ setMessage(message);
}
/** Create the serialization context
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -36,6 +36,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxrpc.binding.DeserializerFactoryBase;
@@ -46,6 +47,7 @@
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.XMLFragment;
import org.jboss.ws.metadata.umdm.FaultMetaData;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -140,13 +142,13 @@
}
/** Translate the request exception into a SOAPFault message. */
- public static SOAPMessage exceptionToFaultMessage(Exception reqEx)
+ public static SOAPMessageImpl exceptionToFaultMessage(Exception reqEx)
{
log.error("SOAP request exception", reqEx);
try
{
- SOAPMessage faultMessage;
+ SOAPMessageImpl faultMessage;
if (reqEx instanceof SOAPFaultException)
{
faultMessage = toSOAPMessage((SOAPFaultException)reqEx);
@@ -171,10 +173,10 @@
}
}
- private static SOAPMessage toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
+ private static SOAPMessageImpl toSOAPMessage(SOAPFaultException faultEx) throws
SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
populateSOAPFault(soapBody, faultEx);
@@ -227,10 +229,10 @@
targetFault.setFaultActor(faultActor);
}
- private static SOAPMessage toSOAPMessage(Exception ex) throws SOAPException
+ private static SOAPMessageImpl toSOAPMessage(Exception ex) throws SOAPException
{
MessageFactory factory = MessageFactory.newInstance();
- SOAPMessage soapMessage = factory.createMessage();
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)factory.createMessage();
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFault soapFault;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPBindingJAXWS.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -31,9 +31,11 @@
import javax.xml.ws.http.HTTPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.HeaderSource;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -49,27 +51,27 @@
{
private BindingImpl delegate = new BindingImpl();
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction bindRequestMessage(OperationMetaData opMetaData,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
{
throw new NotImplementedException();
}
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
throw new NotImplementedException();
}
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object
reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException
{
throw new NotImplementedException();
}
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws
BindingException
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
throw new NotImplementedException();
}
@@ -96,7 +98,7 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.HTTP_BINDING;
}
public void setHeaderSource(HeaderSource source)
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -0,0 +1,80 @@
+/*
+ * 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.core.jaxws.binding;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.invocation.OnewayInvocation;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+import org.w3c.dom.Element;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageMarshaller implements Marshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageMarshaller.class);
+
+ /**
+ * Marshaller will need to take the dataObject and convert
+ * into primitive java data types and write to the
+ * given output.
+ *
+ * @param dataObject Object to be writen to output
+ * @param output The data output to write the object
+ * data to.
+ */
+ public void write(Object dataObject, OutputStream output) throws IOException
+ {
+ if (dataObject instanceof InvocationRequest)
+ dataObject = ((InvocationRequest)dataObject).getParameter();
+
+ if (dataObject instanceof OnewayInvocation)
+ dataObject = ((OnewayInvocation)dataObject).getParameters()[0];
+
+ if ((dataObject instanceof HTTPMessageImpl) == false)
+ throw new IllegalArgumentException("Not a HTTPMessage: " +
dataObject);
+
+ HTTPMessageImpl httpMessage = (HTTPMessageImpl)dataObject;
+ Element root = httpMessage.getXmlFragment().toElement();
+
+ // debug the outgoing message
+ if (log.isTraceEnabled())
+ {
+ log.trace("Outgoing Message\n" + DOMWriter.printNode(root, true));
+ }
+
+ new DOMWriter(output).print(root);
+ }
+
+ public Marshaller cloneMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageMarshaller();
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -0,0 +1,114 @@
+/*
+ * 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.core.jaxws.binding;
+
+// $Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.HTTPMessageImpl;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Nov-2004
+ */
+public class HTTPMessageUnMarshaller implements UnMarshaller
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(HTTPMessageUnMarshaller.class);
+
+ private static List validResponseCodes = new ArrayList();
+ static
+ {
+ validResponseCodes.add(HttpServletResponse.SC_OK);
+ validResponseCodes.add(HttpServletResponse.SC_ACCEPTED);
+ validResponseCodes.add(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException,
ClassNotFoundException
+ {
+ if (log.isTraceEnabled())
+ {
+ log.trace("Read input stream with metadata=" + metadata);
+ }
+
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ String resMessage =
(String)metadata.get(HTTPMetadataConstants.RESPONSE_CODE_MESSAGE);
+ if (resCode != null && validResponseCodes.contains(resCode) == false)
+ throw new WSException("Invalid HTTP server response [" + resCode +
"] - " + resMessage);
+
+ MimeHeaders mimeHeaders = getMimeHeaders(metadata);
+ HTTPMessageImpl soapMsg = new HTTPMessageImpl(mimeHeaders, inputStream);
+ return soapMsg;
+ }
+
+ /**
+ * Set the class loader to use for unmarhsalling. This may
+ * be needed when need to have access to class definitions that
+ * are not part of this unmarshaller's parent classloader (especially
+ * when doing remote classloading).
+ *
+ * @param classloader
+ */
+ public void setClassLoader(ClassLoader classloader)
+ {
+ //NO OP
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new HTTPMessageUnMarshaller();
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/HTTPMessageUnMarshaller.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/MessageBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -37,11 +37,13 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.HeaderSource;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.server.ServerHandlerDelegate;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.ParameterMetaData;
@@ -61,13 +63,13 @@
private BindingImpl delegate = new BindingImpl();
/** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction 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, Object
reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction reqMessage) throws BindingException
{
if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " +
opMetaData.getQName());
@@ -94,7 +96,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
if(log.isDebugEnabled()) log.debug("bindResponseMessage: " +
opMetaData.getQName());
@@ -105,8 +107,8 @@
throw new WSException("MessageContext not available");
// Associate current message with message context
- SOAPMessage resMessage = (SOAPMessage)epInv.getReturnValue();
- msgContext.setMessage(resMessage);
+ MessageAbstraction resMessage = (MessageAbstraction)epInv.getReturnValue();
+ msgContext.setMessageAbstraction(resMessage);
return resMessage;
}
@@ -118,15 +120,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to
the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/PayloadBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -39,6 +39,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.HeaderSource;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
@@ -66,13 +67,13 @@
private BindingImpl delegate = new BindingImpl();
/** On the client side, generate the payload from IN parameters. */
- public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation
epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public MessageAbstraction 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, Object
payload) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData,
MessageAbstraction payload) throws BindingException
{
if(log.isDebugEnabled()) log.debug("unbindRequestMessage: " +
opMetaData.getQName());
@@ -107,7 +108,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation
epInv) throws BindingException
+ public MessageAbstraction bindResponseMessage(OperationMetaData opMetaData,
EndpointInvocation epInv) throws BindingException
{
if(log.isDebugEnabled()) log.debug("bindResponseMessage: " +
opMetaData.getQName());
@@ -121,7 +122,7 @@
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvNamespace(Constants.NS_SOAP11_ENV);
SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage();
- msgContext.setMessage(resMessage);
+ msgContext.setSOAPMessage(resMessage);
Source payload = (Source)epInv.getReturnValue();
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
@@ -137,15 +138,15 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to
the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage,
EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, MessageAbstraction
resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
}
- public Object bindFaultMessage(Exception ex)
+ public MessageAbstraction bindFaultMessage(Exception ex)
{
- SOAPMessage faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
+ SOAPMessageImpl faultMessage = SOAPFaultHelperJAXWS.exceptionToFaultMessage(ex);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
{
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP11BindingJAXWS.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -38,6 +38,7 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP11Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
@@ -118,6 +119,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.SOAP11HTTP_BINDING;
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/binding/SOAP12BindingJAXWS.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -34,7 +34,9 @@
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.core.CommonSOAP12Binding;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS;
import org.jboss.ws.core.soap.SOAPFaultImpl;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -120,6 +122,6 @@
public String getBindingID()
{
- throw new NotImplementedException();
+ return Constants.SOAP12HTTP_BINDING;
}
}
Copied:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
(from rev 2748,
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java)
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -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.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.jaxrpc.binding.BufferedStreamResult;
+
+/**
+ * The Dispatch interface provides support for the dynamic invocation of a service
endpoint operations.
+ * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch
instances.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 04-Jul-2006
+ */
+public class DispatchHTTPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchHTTPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchHTTPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ HTTPMessageImpl reqMsg = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ reqMsg = new HTTPMessageImpl(source);
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ BufferedStreamResult result = new BufferedStreamResult();
+ marshaller.marshal(obj, result);
+
+ reqMsg = new HTTPMessageImpl(result);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " +
obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ HTTPMessageImpl resMsg = (HTTPMessageImpl)message;
+
+ Object retObj = null;
+ try
+ {
+ if (Source.class.isAssignableFrom(type))
+ {
+ retObj = resMsg.getXmlFragment().getSource();
+ }
+ else if (jaxbContext != null)
+ {
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Source source = resMsg.getXmlFragment().getSource();
+ retObj = unmarshaller.unmarshal(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Deleted:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -1,65 +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.core.jaxws.client;
-
-// $Id$
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.NotImplementedException;
-import org.jboss.ws.core.MessageAbstraction;
-
-/**
- * The Dispatch interface provides support for the dynamic invocation of a service
endpoint operations.
- * The javax.xml.ws.Service interface acts as a factory for the creation of Dispatch
instances.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Jul-2006
- */
-public class DispatchHTTPBindingHelper
-{
- // provide logging
- private final Logger log = Logger.getLogger(DispatchHTTPBindingHelper.class);
-
- private JAXBContext jaxbContext;
- private Class type;
- private Mode mode;
-
- public DispatchHTTPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
- {
- this.mode = mode;
- this.type = type;
- this.jaxbContext = jaxbContext;
- }
-
- public MessageAbstraction getRequestMessage(Object obj)
- {
- throw new NotImplementedException();
- }
-
- public Object getReturnObject(MessageAbstraction message)
- {
- throw new NotImplementedException();
- }
-}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -23,12 +23,12 @@
// $Id$
+import java.io.IOException;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
-import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.ws.AsyncHandler;
@@ -45,11 +45,10 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.HTTPRemotingConnection;
import org.jboss.ws.core.client.RemotingConnection;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
import org.jboss.ws.core.client.SOAPRemotingConnection;
import org.jboss.ws.core.jaxws.binding.BindingProviderImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
@@ -106,11 +105,11 @@
return retObj;
}
- private Object invokeInternal(Object obj, Map<String, Object> resContext) throws
SOAPException
+ private Object invokeInternal(Object obj, Map<String, Object> resContext) throws
IOException
{
MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
- MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress);
+ MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress,
false);
Object retObj = getReturnObject(resMsg);
return retObj;
}
@@ -124,7 +123,7 @@
RemotingConnection remotingConnection;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- remotingConnection = new SOAPRemotingConnection();
+ remotingConnection = new HTTPRemotingConnection();
}
else
{
@@ -157,7 +156,7 @@
try
{
String targetAddress = epMetaData.getEndpointAddress();
- new SOAPConnectionImpl().callOneWay((SOAPMessage)reqMsg, targetAddress);
+ getRemotingConnection().invoke(reqMsg, targetAddress, true);
}
catch (Exception ex)
{
@@ -232,12 +231,12 @@
MessageAbstraction message;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type,
jaxbContext);
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
message = helper.getRequestMessage(obj);
}
else
{
- DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type,
jaxbContext);
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
message = helper.getRequestMessage(obj);
}
return message;
@@ -252,12 +251,12 @@
Object retObj = null;
if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type,
jaxbContext);
+ DispatchHTTPBinding helper = new DispatchHTTPBinding(mode, type, jaxbContext);
retObj = helper.getReturnObject(resMsg);
}
else
{
- DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type,
jaxbContext);
+ DispatchSOAPBinding helper = new DispatchSOAPBinding(mode, type, jaxbContext);
retObj = helper.getReturnObject(resMsg);
}
return retObj;
Copied:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java
(from rev 2748,
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java)
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBinding.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -0,0 +1,175 @@
+/*
+ * 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.core.jaxws.client;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.SOAPBodyImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.core.utils.DOMWriter;
+
+/**
+ * A helper that
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public class DispatchSOAPBinding
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(DispatchSOAPBinding.class);
+
+ private JAXBContext jaxbContext;
+ private Class type;
+ private Mode mode;
+
+ public DispatchSOAPBinding(Mode mode, Class type, JAXBContext jaxbContext)
+ {
+ this.mode = mode;
+ this.type = type;
+ this.jaxbContext = jaxbContext;
+ }
+
+ public MessageAbstraction getRequestMessage(Object obj)
+ {
+ SOAPMessageImpl reqMsg = null;
+ try
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ reqMsg = (SOAPMessageImpl)obj;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ Source source = (Source)obj;
+ if (mode == Mode.PAYLOAD)
+ {
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ soapBody.setSource(source);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ tf.newTransformer().transform(source, new StreamResult(baos));
+ reqMsg = (SOAPMessageImpl)factory.createMessage(null, new
ByteArrayInputStream(baos.toByteArray()));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ marshaller.marshal(obj, baos);
+
+ reqMsg = (SOAPMessageImpl)factory.createMessage();
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
+ StreamSource source = new StreamSource(new
ByteArrayInputStream(baos.toByteArray()));
+ soapBody.setSource(source);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot create request message", ex);
+ }
+
+ if (reqMsg == null)
+ throw new WebServiceException("Cannot create request message for: " +
obj);
+
+ return reqMsg;
+ }
+
+ public Object getReturnObject(MessageAbstraction message)
+ {
+ SOAPMessage resMsg = (SOAPMessage)message;
+
+ Object retObj = null;
+ try
+ {
+ if (SOAPMessage.class.isAssignableFrom(type))
+ {
+ retObj = resMsg;
+ }
+ else if (Source.class.isAssignableFrom(type))
+ {
+ if (mode == Mode.PAYLOAD)
+ {
+ SOAPBody soapBody = resMsg.getSOAPBody();
+ SOAPElement soapElement =
(SOAPElement)soapBody.getChildElements().next();
+ retObj = new DOMSource(soapElement);
+ }
+ if (mode == Mode.MESSAGE)
+ {
+ SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
+ String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
+ retObj = new StreamSource(new StringReader(xmlMessage));
+ }
+ }
+ else if (jaxbContext != null)
+ {
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
+ SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
+
+ log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement,
false));
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ retObj = unmarshaller.unmarshal(soapElement);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Cannot process response message", ex);
+ }
+ return retObj;
+ }
+}
Deleted:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -1,175 +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.core.jaxws.client;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.Service.Mode;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.MessageAbstraction;
-import org.jboss.ws.core.soap.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPMessageImpl;
-import org.jboss.ws.core.utils.DOMWriter;
-
-/**
- * A helper that
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 02-Apr-2007
- */
-public class DispatchSOAPBindingHelper
-{
- // provide logging
- private final Logger log = Logger.getLogger(DispatchSOAPBindingHelper.class);
-
- private JAXBContext jaxbContext;
- private Class type;
- private Mode mode;
-
- public DispatchSOAPBindingHelper(Mode mode, Class type, JAXBContext jaxbContext)
- {
- this.mode = mode;
- this.type = type;
- this.jaxbContext = jaxbContext;
- }
-
- public MessageAbstraction getRequestMessage(Object obj)
- {
- SOAPMessageImpl reqMsg = null;
- try
- {
- MessageFactory factory = MessageFactory.newInstance();
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- reqMsg = (SOAPMessageImpl)obj;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- Source source = (Source)obj;
- if (mode == Mode.PAYLOAD)
- {
- reqMsg = (SOAPMessageImpl)factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- soapBody.setSource(source);
- }
- if (mode == Mode.MESSAGE)
- {
- TransformerFactory tf = TransformerFactory.newInstance();
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- tf.newTransformer().transform(source, new StreamResult(baos));
- reqMsg = (SOAPMessageImpl)factory.createMessage(null, new
ByteArrayInputStream(baos.toByteArray()));
- }
- }
- else if (jaxbContext != null)
- {
- Marshaller marshaller = jaxbContext.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- marshaller.marshal(obj, baos);
-
- reqMsg = (SOAPMessageImpl)factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- StreamSource source = new StreamSource(new
ByteArrayInputStream(baos.toByteArray()));
- soapBody.setSource(source);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot create request message", ex);
- }
-
- if (reqMsg == null)
- throw new WebServiceException("Cannot create request message for: " +
obj);
-
- return reqMsg;
- }
-
- public Object getReturnObject(MessageAbstraction message)
- {
- SOAPMessage resMsg = (SOAPMessage)message;
-
- Object retObj = null;
- try
- {
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- retObj = resMsg;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- if (mode == Mode.PAYLOAD)
- {
- SOAPBody soapBody = resMsg.getSOAPBody();
- SOAPElement soapElement =
(SOAPElement)soapBody.getChildElements().next();
- retObj = new DOMSource(soapElement);
- }
- if (mode == Mode.MESSAGE)
- {
- SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
- String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
- retObj = new StreamSource(new StringReader(xmlMessage));
- }
- }
- else if (jaxbContext != null)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
- SOAPElement soapElement = (SOAPElement)soapBody.getChildElements().next();
-
- log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement,
false));
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- retObj = unmarshaller.unmarshal(soapElement);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot process response message", ex);
- }
- return retObj;
- }
-}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/handler/LogicalMessageContextImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -53,7 +53,7 @@
this.delegate = soapContext;
Style style = soapContext.getEndpointMetaData().getStyle();
- SOAPMessage soapMessage = soapContext.getMessage();
+ SOAPMessage soapMessage = soapContext.getSOAPMessage();
logicalMessage = new LogicalMessageImpl(soapMessage, style);
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -38,6 +38,7 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
@@ -47,6 +48,7 @@
import org.jboss.ws.core.CommonSOAPBinding;
import org.jboss.ws.core.DirectionHolder;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.DirectionHolder.Direction;
import org.jboss.ws.core.jaxrpc.handler.HandlerDelegateJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
@@ -128,11 +130,11 @@
}
/** Invoke the the service endpoint */
- public SOAPMessage invoke(Object context) throws Exception
+ public MessageAbstraction invoke(Object context) throws Exception
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
ServerEndpointMetaData sepMetaData =
(ServerEndpointMetaData)msgContext.getEndpointMetaData();
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+ MessageAbstraction reqMessage = msgContext.getMessageAbstraction();
// Load the endpoint implementation bean
Class seImpl = loadServiceEndpoint();
@@ -149,7 +151,7 @@
// Set the required inbound context properties
setInboundContextProperties();
-
+
try
{
boolean oneway = false;
@@ -196,11 +198,15 @@
try
{
// Check if protocol handlers modified the payload
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- if (soapBody.isModifiedFromSource())
+ if (reqMessage instanceof SOAPMessage)
{
- log.debug("Handler modified body payload, unbind message
again");
- epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+ SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
+ if (soapBody.isModifiedFromSource())
+ {
+ log.debug("Handler modified body payload, unbind message
again");
+ epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
+ }
}
// Invoke the service endpoint
@@ -216,7 +222,7 @@
// Set the required outbound context properties
setOutboundContextProperties();
-
+
if (binding instanceof CommonSOAPBinding)
XOPContext.setMTOMEnabled(((CommonSOAPBinding)binding).isMTOMEnabled());
@@ -243,7 +249,7 @@
faultType[0] = null;
}
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
return resMessage;
}
catch (RuntimeException ex)
@@ -320,39 +326,54 @@
return msgContext;
}
- private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
SOAPMessageImpl reqMessage) throws SOAPException
+ private OperationMetaData getDispatchDestination(EndpointMetaData epMetaData,
MessageAbstraction reqMessage) throws SOAPException
{
- OperationMetaData opMetaData = reqMessage.getOperationMetaData(epMetaData);
- SOAPHeader soapHeader = reqMessage.getSOAPHeader();
+ OperationMetaData opMetaData;
- // Report a MustUnderstand fault
- if (opMetaData == null)
+ String bindingID = epMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- String faultString;
- SOAPBody soapBody = reqMessage.getSOAPBody();
- if (soapBody.getChildElements().hasNext())
+ if (epMetaData.getOperations().size() != 1)
+ throw new IllegalStateException("Multiple operations not supported for
HTTP binding");
+
+ opMetaData = epMetaData.getOperations().get(0);
+ }
+ else
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)reqMessage;
+
+ opMetaData = soapMessage.getOperationMetaData(epMetaData);
+ SOAPHeader soapHeader = soapMessage.getSOAPHeader();
+
+ // Report a MustUnderstand fault
+ if (opMetaData == null)
{
- SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
- Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getPortName() + " does
not contain operation meta data for: " + soapName;
- }
- else
- {
- faultString = "Endpoint " + epMetaData.getPortName() + " does
not contain operation meta data for empty soap body";
- }
+ String faultString;
+ SOAPBody soapBody = soapMessage.getSOAPBody();
+ if (soapBody.getChildElements().hasNext())
+ {
+ SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
+ Name soapName = soapBodyElement.getElementName();
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for: " + soapName;
+ }
+ else
+ {
+ faultString = "Endpoint " + epMetaData.getPortName() + "
does not contain operation meta data for empty soap body";
+ }
- // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
- // with a faultcode of "Client", unless a "MustUnderstand"
or "VersionMismatch" fault is generated.
- if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- throw new SOAPFaultException(faultCode, faultString, null, null);
+ // R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
+ // with a faultcode of "Client", unless a
"MustUnderstand" or "VersionMismatch" fault is generated.
+ if (soapHeader != null &&
soapHeader.examineMustUnderstandHeaderElements(Constants.URI_SOAP11_NEXT_ACTOR).hasNext())
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
+ else
+ {
+ QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
+ throw new SOAPFaultException(faultCode, faultString, null, null);
+ }
}
- else
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_CLIENT;
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
}
return opMetaData;
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/AbstractServiceEndpointServlet.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -111,7 +111,7 @@
try
{
EndpointContext context = new EndpointContext(getServletContext(), req, res);
- epManager.processSOAPRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
+ epManager.processRequest(sepId, req.getInputStream(), res.getOutputStream(),
context);
}
catch (Exception ex)
{
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpoint.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -30,22 +30,23 @@
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonBinding;
import org.jboss.ws.core.CommonBindingProvider;
import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.HTTPMessageImpl;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.MessageTracer;
import org.jboss.ws.core.jaxrpc.binding.BindingException;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
-import org.jboss.ws.core.soap.SOAPElementImpl;
-import org.jboss.ws.core.soap.SOAPElementWriter;
import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.xop.XOPContext;
@@ -64,7 +65,6 @@
{
// provide logging
private static Logger log = Logger.getLogger(ServiceEndpoint.class);
- private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
/** Endpoint type enum */
public enum State
@@ -88,7 +88,7 @@
{
return seInfo.getState();
}
-
+
public ServiceEndpointInfo getServiceEndpointInfo()
{
return seInfo;
@@ -110,7 +110,7 @@
ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
UnifiedMetaData wsMetaData = epMetaData.getServiceMetaData().getUnifiedMetaData();
wsMetaData.eagerInitialize();
-
+
seMetrics.start();
seInfo.setState(State.STARTED);
}
@@ -119,7 +119,8 @@
{
seMetrics.stop();
seInfo.setState(State.STOPED);
- if(log.isDebugEnabled()) log.debug("Stop Endpoint" + seMetrics);
+ if (log.isDebugEnabled())
+ log.debug("Stop Endpoint" + seMetrics);
}
public void destroy()
@@ -143,7 +144,8 @@
{
wsdlHost = epManager.getWebServiceHost();
}
- if(log.isDebugEnabled()) log.debug("WSDL request, using host: " +
wsdlHost);
+ if (log.isDebugEnabled())
+ log.debug("WSDL request, using host: " + wsdlHost);
WSDLRequestHandler wsdlRequestHandler = new WSDLRequestHandler(epMetaData);
Document document = wsdlRequestHandler.getDocumentForPath(reqURL, wsdlHost,
resPath);
@@ -157,10 +159,10 @@
/**
* Handle a request to this web service endpoint
*/
- public SOAPMessage handleRequest(MimeHeaderSource headerSource, EndpointContext
context, InputStream inputStream) throws BindingException
+ public MessageAbstraction processRequest(MimeHeaderSource headerSource,
EndpointContext context, InputStream inputStream) throws BindingException
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
long beginProcessing = 0;
ClassLoader ctxClassLoader = Thread.currentThread().getContextClassLoader();
@@ -174,34 +176,40 @@
throw new SOAPFaultException(faultCode, faultString, null, null);
}
- if(log.isDebugEnabled()) log.debug("BEGIN handleRequest: " +
seInfo.getServiceEndpointID());
+ log.debug("BEGIN handleRequest: " + seInfo.getServiceEndpointID());
beginProcessing = seMetrics.processRequestMessage();
- MessageFactoryImpl msgFactory = new MessageFactoryImpl();
- msgFactory.setServiceMode(epMetaData.getServiceMode());
- msgFactory.setStyle(epMetaData.getStyle());
-
MimeHeaders headers = (headerSource != null ? headerSource.getMimeHeaders() :
null);
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers,
inputStream);
+ MessageAbstraction reqMessage;
+
+ String bindingID = sepMetaData.getBindingId();
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ reqMessage = new HTTPMessageImpl(headers, inputStream);
+ }
+ else
+ {
+ MessageFactoryImpl msgFactory = new MessageFactoryImpl();
+ msgFactory.setServiceMode(sepMetaData.getServiceMode());
+ msgFactory.setStyle(sepMetaData.getStyle());
+
+ reqMessage = (SOAPMessageImpl)msgFactory.createMessage(headers,
inputStream);
+ }
+
// Associate current message with message context
- msgContext.setSOAPMessage(reqMessage);
+ msgContext.setMessageAbstraction(reqMessage);
// debug the incomming message
- if (msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- msgLog.trace("Incoming SOAPMessage\n" + envStr);
- }
+ MessageTracer.traceMessage("Incoming Request Message", reqMessage);
// Set the thread context class loader
- ClassLoader classLoader = epMetaData.getClassLoader();
+ ClassLoader classLoader = sepMetaData.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
// Invoke the service endpoint
ServiceEndpointInvoker seInvoker = seInfo.getInvoker();
- SOAPMessage resMessage = seInvoker.invoke(context);
+ MessageAbstraction resMessage = seInvoker.invoke(context);
if (resMessage != null)
postProcessResponse(headerSource, resMessage);
@@ -210,15 +218,15 @@
}
catch (Exception ex)
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
// In case we have an exception before the invoker is called
// we create the fault message here.
- if (resMessage == null || ((SOAPMessageImpl)resMessage).isFaultMessage() ==
false)
+ if (resMessage == null || resMessage.isFaultMessage() == false)
{
CommonBindingProvider bindingProvider = getCommonBindingProvider();
CommonBinding binding = bindingProvider.getCommonBinding();
- resMessage = (SOAPMessage)binding.bindFaultMessage(ex);
+ resMessage = binding.bindFaultMessage(ex);
}
if (resMessage != null)
@@ -230,10 +238,10 @@
{
try
{
- SOAPMessage soapMessage = msgContext.getSOAPMessage();
- if (soapMessage != null && soapMessage.getSOAPPart().getEnvelope() !=
null)
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
+ if (resMessage != null)
{
- if (soapMessage.getSOAPPart().getEnvelope().getBody().hasFault())
+ if (resMessage.isFaultMessage())
{
seMetrics.processFaultMessage(beginProcessing);
}
@@ -250,39 +258,31 @@
// Reset the thread context class loader
Thread.currentThread().setContextClassLoader(ctxClassLoader);
- if(log.isDebugEnabled()) log.debug("END handleRequest: " +
seInfo.getServiceEndpointID());
+ if (log.isDebugEnabled())
+ log.debug("END handleRequest: " + seInfo.getServiceEndpointID());
}
}
/** Set response mime headers
*/
- private void postProcessResponse(MimeHeaderSource headerSource, SOAPMessage
resMessage)
+ private void postProcessResponse(MimeHeaderSource headerSource, MessageAbstraction
resMessage)
{
try
{
// Set the outbound headers
- if (headerSource != null)
+ if (headerSource != null && resMessage instanceof SOAPMessage)
{
XOPContext.eagerlyCreateAttachments();
- resMessage.saveChanges();
+ ((SOAPMessage)resMessage).saveChanges();
headerSource.setMimeHeaders(resMessage.getMimeHeaders());
}
// debug the outgoing message
- if (msgLog.isTraceEnabled())
- {
- resMessage.saveChanges();
- SOAPEnvelope soapEnv = resMessage.getSOAPPart().getEnvelope();
- if (soapEnv != null)
- {
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
- }
+ MessageTracer.traceMessage("Outgoing Response Message", resMessage);
}
catch (Exception ex)
{
- throw new JAXRPCException("Faild to post process response message",
ex);
+ WSException.rethrow("Faild to post process response message", ex);
}
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointInvoker.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -23,7 +23,7 @@
// $Id$
-import javax.xml.soap.SOAPMessage;
+import org.jboss.ws.core.MessageAbstraction;
/** An implementation handles invocations on the endpoint
*
@@ -36,5 +36,5 @@
void init(ServiceEndpointInfo seInfo);
/** Invoke the the service endpoint */
- SOAPMessage invoke(Object endpointContext) throws Exception;
+ MessageAbstraction invoke(Object endpointContext) throws Exception;
}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -59,12 +59,13 @@
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
+import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.jaxrpc.handler.MessageContextJAXRPC;
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.jaxws.handler.MessageContextJAXWS;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.ThreadLocalAssociation;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -397,7 +398,7 @@
wsEndpoint.handleWSDLRequest(outStream, requestURL, resourcePath);
}
- public void processSOAPRequest(ObjectName sepID, InputStream inStream, OutputStream
outStream, EndpointContext context) throws Exception
+ public void processRequest(ObjectName sepID, InputStream inStream, OutputStream
outStream, EndpointContext context) throws Exception
{
final String SESSION_COOKIES = "org.jboss.ws.cookies";
@@ -444,9 +445,9 @@
MessageContextAssociation.pushMessageContext(msgContext);
try
{
- SOAPMessage resMessage = wsEndpoint.handleRequest(headerSource, context,
inStream);
+ MessageAbstraction resMessage = wsEndpoint.processRequest(headerSource, context,
inStream);
- // REplace the message context with the response context
+ // Replace the message context with the response context
msgContext = MessageContextAssociation.peekMessageContext();
Map<String, List<String>> headers = (Map<String,
List<String>>)msgContext.get(MessageContextJAXWS.HTTP_RESPONSE_HEADERS);
@@ -457,20 +458,24 @@
if (code != null)
httpResponse.setStatus(code.intValue());
- SOAPPart part = resMessage.getSOAPPart();
- if (part == null)
- throw new SOAPException("Cannot obtain SOAPPart from response
message");
+ boolean isFault = false;
+ if (resMessage instanceof SOAPMessage)
+ {
+ SOAPPart part = ((SOAPMessage)resMessage).getSOAPPart();
+ if (part == null)
+ throw new SOAPException("Cannot obtain SOAPPart from response
message");
- // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
- // if the response envelope is a Fault.
- //
- // Also, a one-way operation must show up as empty content, and can be detected
- // by a null envelope.
- SOAPEnvelope soapEnv = part.getEnvelope();
- boolean isFault = soapEnv != null && soapEnv.getBody().hasFault();
- if (isFault && httpResponse != null)
- {
- httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ // R1126 An INSTANCE MUST return a "500 Internal Server Error" HTTP
status code
+ // if the response envelope is a Fault.
+ //
+ // Also, a one-way operation must show up as empty content, and can be
detected
+ // by a null envelope.
+ SOAPEnvelope soapEnv = part.getEnvelope();
+ isFault = soapEnv != null && soapEnv.getBody().hasFault();
+ if (isFault && httpResponse != null)
+ {
+ httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
}
sendResponse(outStream, msgContext, isFault);
@@ -490,7 +495,7 @@
private void sendResponse(OutputStream outputStream, CommonMessageContext msgContext,
boolean isFault) throws SOAPException, IOException
{
- SOAPMessage resMessage = msgContext.getSOAPMessage();
+ MessageAbstraction resMessage = msgContext.getMessageAbstraction();
String wsaTo = null;
// Get the destination from the AddressingProperties
@@ -505,7 +510,7 @@
if (wsaTo != null)
{
log.debug("Sending response to addressing destination: " + wsaTo);
- new SOAPConnectionImpl().callOneWay(resMessage, wsaTo);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)resMessage, wsaTo);
}
else
{
@@ -515,14 +520,14 @@
/** Process the given SOAPRequest and return the corresponding SOAPResponse
*/
- public String processSOAPRequest(ObjectName sepID, String inMessage) throws Exception
+ public String processRequest(ObjectName sepID, String inMessage) throws Exception
{
log.debug("processSOAPRequest: " + sepID);
ByteArrayInputStream inputStream = new
ByteArrayInputStream(inMessage.getBytes("UTF-8"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(512);
- processSOAPRequest(sepID, inputStream, outputStream, null);
+ processRequest(sepID, inputStream, outputStream, null);
String outMsg = new String(outputStream.toByteArray());
return outMsg;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -60,7 +60,6 @@
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
/**
* SOAP Connection Factory implementation
Copied:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
(from rev 2748,
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java)
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -0,0 +1,122 @@
+/*
+ * 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.core.soap;
+
+// $Id$
+
+import java.io.IOException;
+
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.client.RemotingConnectionImpl;
+import org.jboss.ws.core.client.SOAPRemotingConnection;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public class SOAPConnectionImpl extends SOAPConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPConnectionImpl.class);
+
+ private RemotingConnectionImpl remotingConnection;
+
+ public SOAPConnectionImpl()
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+
+ /**
+ * Sends the given message to the specified endpoint and blocks until it has
+ * returned the response.
+ */
+ public SOAPMessage call(SOAPMessage reqMessage, Object endpoint) throws SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
+
+ MessageAbstraction resMessage = callInternal(reqMessage, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is
received
+ */
+ public SOAPMessage get(Object endpoint) throws SOAPException
+ {
+ MessageAbstraction resMessage = callInternal(null, endpoint, false);
+ return (SOAPMessage)resMessage;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint. This method is logically
+ * non blocking.
+ */
+ public SOAPMessage callOneWay(SOAPMessage reqMessage, Object endpoint) throws
SOAPException
+ {
+ if (reqMessage == null)
+ throw new IllegalArgumentException("Given SOAPMessage cannot be
null");
+
+ MessageAbstraction resMessage = callInternal((SOAPMessageImpl)reqMessage, endpoint,
true);
+ return (SOAPMessage)resMessage;
+ }
+
+ /** Closes this SOAPConnection
+ */
+ public void close() throws SOAPException
+ {
+ if (remotingConnection.isClosed())
+ throw new SOAPException("SOAPConnection is already closed");
+
+ remotingConnection.setClosed(true);
+ }
+
+ private MessageAbstraction callInternal(SOAPMessage reqMessage, Object endpoint,
boolean oneway) throws SOAPException
+ {
+ try
+ {
+ MessageAbstraction resMessage =
remotingConnection.invoke((SOAPMessageImpl)reqMessage, endpoint, oneway);
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof SOAPException)
+ throw (SOAPException)cause;
+
+ throw new SOAPException(ex);
+ }
+ }
+}
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -252,7 +252,6 @@
}
mimeHeaders.setHeader(MimeConstants.CONTENT_TYPE, contentType);
-
}
catch (MessagingException ex)
{
@@ -279,27 +278,34 @@
return saveRequired;
}
- public void writeTo(OutputStream outs) throws SOAPException, IOException
+ public void writeTo(OutputStream outs) throws IOException
{
- // Save all changes
- saveChanges();
+ try
+ {
+ // Save all changes
+ saveChanges();
- // If there are attachments then we delegate encoding to MultipartRelatedEncoder
- if (attachments.size() > 0)
- {
- multipartRelatedEncoder.writeTo(outs);
- }
- else
- {
- SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
- if (soapEnv != null)
+ // If there are attachments then we delegate encoding to
MultipartRelatedEncoder
+ if (attachments.size() > 0)
{
- boolean writeXML = isWriteXMLDeclaration();
- String charsetEncoding = getCharSetEncoding();
- SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
-
writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ multipartRelatedEncoder.writeTo(outs);
}
+ else
+ {
+ SOAPEnvelope soapEnv = getSOAPPart().getEnvelope();
+ if (soapEnv != null)
+ {
+ boolean writeXML = isWriteXMLDeclaration();
+ String charsetEncoding = getCharSetEncoding();
+ SOAPElementWriter writer = new SOAPElementWriter(outs, charsetEncoding);
+
writer.setWriteXMLDeclaration(writeXML).writeElement((SOAPEnvelopeImpl)soapEnv);
+ }
+ }
}
+ catch (SOAPException ex)
+ {
+ WSException.rethrow(ex);
+ }
}
private String getCharSetEncoding() throws SOAPException
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageMarshaller.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -1,30 +1,29 @@
/*
-* 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.core.soap;
import java.io.IOException;
import java.io.OutputStream;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
@@ -32,6 +31,7 @@
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.invocation.OnewayInvocation;
import org.jboss.remoting.marshal.Marshaller;
+
/**
* @author Thomas.Diesler(a)jboss.org
* @since 25-Nov-2004
@@ -61,25 +61,8 @@
if ((dataObject instanceof SOAPMessage) == false)
throw new IllegalArgumentException("Not a SOAPMessage: " +
dataObject);
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
-
- // debug the outgoing message
- if (log.isTraceEnabled())
- {
- SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapEnv,
true);
- log.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- soapMessage.writeTo(output);
- }
- catch (SOAPException e)
- {
- log.error("Cannot marshall SOAPMessage", e);
- throw new IOException(e.toString());
- }
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)dataObject;
+ soapMessage.writeTo(output);
}
public Marshaller cloneMarshaller() throws CloneNotSupportedException
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -37,7 +37,7 @@
import org.apache.xpath.XPathAPI;
import org.apache.xpath.objects.XObject;
import org.jboss.logging.Logger;
-import org.jboss.ws.core.client.SOAPConnectionImpl;
+import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.eventing.EventingConstants;
import org.jboss.ws.extensions.eventing.jaxws.AttributedURIType;
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -202,7 +202,7 @@
* If we would do this lazily (i.e. upon remoting callback) the previous content-type
* would already have been written.
*
- * @see
org.jboss.ws.core.client.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage,
Object, boolean)
+ * @see
org.jboss.ws.core.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object,
boolean)
* @see org.jboss.ws.core.soap.SOAPMessageMarshaller#write(Object,
java.io.OutputStream)
*/
public static void eagerlyCreateAttachments()
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -113,8 +113,7 @@
{
if (wsClass.isAnnotationPresent(BindingType.class))
{
- if (log.isDebugEnabled())
- log.debug("processBindingType on: " + wsClass.getName());
+ log.debug("processBindingType on: " + wsClass.getName());
BindingType anBindingType =
(BindingType)wsClass.getAnnotation(BindingType.class);
epMetaData.setBindingId(anBindingType.value());
}
@@ -124,8 +123,7 @@
{
if (wsClass.isAnnotationPresent(SOAPBinding.class))
{
- if (log.isDebugEnabled())
- log.debug("processSOAPBinding on: " + wsClass.getName());
+ log.debug("processSOAPBinding on: " + wsClass.getName());
SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
SOAPBinding.Style attrStyle = anSoapBinding.style();
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -126,6 +126,9 @@
serviceMetaData.setWsdlLocation(wsdlURL);
}
+ // process binding type
+ processBindingType(sepMetaData, sepClass);
+
// process handler chain
processHandlerChain(sepMetaData, sepClass);
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -45,6 +45,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -250,7 +251,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(reqEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -277,7 +278,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(reqEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -300,7 +301,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(reqEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage reqMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(reqMessage);
@@ -344,7 +345,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(resEnvelope.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -364,7 +365,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -395,7 +396,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
@@ -423,7 +424,7 @@
ByteArrayInputStream inputStream = new
ByteArrayInputStream(resEnvelopeWithFault.getBytes());
MessageFactory factory = new MessageFactoryImpl();
- SOAPMessage resMessage = factory.createMessage(null, inputStream);
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)factory.createMessage(null,
inputStream);
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setSOAPMessage(resMessage);
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/SOAPFaultTestCase.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -49,9 +49,19 @@
*/
public class SOAPFaultTestCase extends JBossWSTest
{
- private String envStr = "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" + "
<env:Header/>" + " <env:Body>" + "
<env:Fault>"
- + " <faultcode>env:Client</faultcode>" + "
<faultstring>Some fault message</faultstring>" + "
<faultactor>Some fault actor</faultactor>" + "
<detail>"
- + " <ns1:name
xmlns:ns1='http://somens'>Kermit</ns1:name>" + "
</detail>" + " </env:Fault>" + " </env:Body>"
+ "</env:Envelope>";
+ private String envStr = "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <env:Header/>" +
+ " <env:Body>" +
+ " <env:Fault>" +
+ " <faultcode>env:Client</faultcode>" +
+ " <faultstring>Some fault message</faultstring>" +
+ " <faultactor>Some fault actor</faultactor>" +
+ " <detail>" +
+ " <ns1:name
xmlns:ns1='http://somens'>Kermit</ns1:name>" +
+ " </detail>" +
+ " </env:Fault>" +
+ " </env:Body>" +
+ "</env:Envelope>";
public void testExceptionToFault() throws Exception
{
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -49,6 +49,7 @@
import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.soap.MessageFactoryImpl;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.core.soap.attachment.MimeConstants;
import org.jboss.ws.metadata.umdm.OperationMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
@@ -165,7 +166,7 @@
MimeHeaders headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg2 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg2 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
epInv = binding.unbindRequestMessage(opMetaData, msg2);
@@ -185,7 +186,7 @@
headers = new MimeHeaders();
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
- SOAPMessage msg3 = new MessageFactoryImpl().createMessage(headers, in);
+ SOAPMessageImpl msg3 = (SOAPMessageImpl)new
MessageFactoryImpl().createMessage(headers, in);
binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/HttpJAXBTestCase.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -23,23 +23,16 @@
// $Id$
-import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPConnectionFactory;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
-import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.http.HTTPBinding;
import junit.framework.Test;
@@ -47,14 +40,12 @@
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.w3c.dom.Element;
/**
- * Test a Provider<SOAPMessage>
+ * Test HTTP Binding
*
* @author Thomas.Diesler(a)jboss.org
- * @author <a href="jason.greene(a)jboss.com">Jason T. Greene</a>
- * @since 29-Jun-2006
+ * @since 02-Apr-2007
*/
public class HttpJAXBTestCase extends JBossWSTest
{
@@ -83,18 +74,6 @@
assertEquals(user.getQname(), userRes.getQname());
}
- public void testWebServiceDispatch() throws Exception
- {
- Dispatch<Object> dispatch = createDispatch("WebServiceEndpoint");
-
- UserType user = new UserType();
- user.setString("Kermit");
- user.setQname(new QName("TheFrog"));
- UserType userRes = (UserType)dispatch.invoke(user);
- assertEquals(user.getString(), userRes.getString());
- assertEquals(user.getQname(), userRes.getQname());
- }
-
private Dispatch<Object> createDispatch(String target) throws
MalformedURLException, JAXBException
{
String targetNS = "http://org.jboss.ws/httpbinding";
@@ -103,39 +82,10 @@
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-httpbinding-jaxb/" + target + "?wsdl");
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
-
+ service.addPort(portName, HTTPBinding.HTTP_BINDING, wsdlURL.toExternalForm());
+
JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
Dispatch<Object> dispatch = service.createDispatch(portName, jbc,
Mode.PAYLOAD);
return dispatch;
}
-
- public void testProviderMessage() throws Exception
- {
- String reqString =
- "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
- " <env:Body>" +
- " <ns1:user
xmlns:ns1='http://org.jboss.ws/httpbinding'>" +
- " <string>Kermit</string>" +
- " <qname>The Frog</qname>" +
- " </ns1:user>" +
- " </env:Body>" +
- "</env:Envelope>";
-
- MessageFactory msgFactory = MessageFactory.newInstance();
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(reqString.getBytes()));
-
- URL epURL = new URL("http://" + getServerHost() +
":8080/jaxws-samples-httpbinding-jaxb/ProviderEndpoint");
- SOAPMessage resMsg = con.call(reqMsg, epURL);
- SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
-
- Element child = (Element)resEnv.getBody().getChildElements().next();
- JAXBContext jc = JAXBContext.newInstance(new Class[]{UserType.class});
- UserType user = (UserType)jc.createUnmarshaller().unmarshal(new DOMSource(child));
-
- assertEquals("Kermit", user.getString());
- assertEquals(new QName("The Frog"), user.getQname());
- }
}
\ No newline at end of file
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanJAXB.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -26,11 +26,13 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.util.JAXBSource;
import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
import javax.xml.ws.Service;
import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
import org.jboss.logging.Logger;
@@ -43,7 +45,9 @@
* @since 29-Jun-2006
*/
@WebServiceProvider(serviceName = "ProviderService", portName =
"ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding",
wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-@ServiceMode(value = Service.Mode.PAYLOAD)
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
public class ProviderBeanJAXB implements Provider<Source>
{
// provide logging
Modified:
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java
===================================================================
---
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-02
15:41:10 UTC (rev 2748)
+++
branches/tdiesler/trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/httpbinding/ProviderBeanPayload.java 2007-04-03
14:54:13 UTC (rev 2749)
@@ -34,9 +34,13 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingType;
import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
/**
* Test a Provider<Source>
@@ -45,9 +49,11 @@
* @since 29-Jun-2006
*/
+@WebServiceProvider(serviceName = "ProviderService", portName =
"ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding",
wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
+
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
@HandlerChain(file = "httpbinding-handlers.xml")
-@WebServiceProvider(serviceName = "ProviderService", portName =
"ProviderPort", targetNamespace = "http://org.jboss.ws/httpbinding",
wsdlLocation = "WEB-INF/wsdl/HttpBinding.wsdl")
-// @ServiceMode(value = Service.Mode.PAYLOAD) - PAYLOAD is implicit
public class ProviderBeanPayload implements Provider<Source>
{
public Source invoke(Source req)