Author: thomas.diesler(a)jboss.com
Date: 2007-04-02 11:41:10 -0400 (Mon, 02 Apr 2007)
New Revision: 2748
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.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/SOAPMessageAbstraction.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.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/SOAPConnectionImpl.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/jaxws/client/DispatchHTTPBindingHelper.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
Removed:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.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/jaxws/client/DispatchImpl.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/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/umdm/EndpointMetaData.java
Log:
Partial commit
Modified:
branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-02
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/javax/xml/ws/soap/SOAPBinding.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -34,76 +34,75 @@
* the SOAP binding.
*
* @since JAX-WS 2.0
-**/
-public interface SOAPBinding extends Binding {
+ **/
+public interface SOAPBinding extends Binding
+{
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding.
+ */
+ public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding.
+ */
+ public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
+ /**
+ * A constant representing the identity of the SOAP 1.1 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP11HTTP_MTOM_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
+ /**
+ * A constant representing the identity of the SOAP 1.2 over HTTP binding
+ * with MTOM enabled by default.
+ */
+ public static final String SOAP12HTTP_MTOM_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
-
-
- /** Gets the roles played by the SOAP binding instance.
- *
- * @return Set<String> The set of roles played by the binding instance.
- **/
- public Set<String> getRoles();
+ /** Gets the roles played by the SOAP binding instance.
+ *
+ * @return Set<String> The set of roles played by the binding instance.
+ **/
+ public Set<String> getRoles();
- /** Sets the roles played by the SOAP binding instance.
- *
- * @param roles The set of roles played by the binding instance.
- * @throws WebServiceException On an error in the configuration of
- * the list of roles.
- **/
- public void setRoles(Set<String> roles);
+ /** Sets the roles played by the SOAP binding instance.
+ *
+ * @param roles The set of roles played by the binding instance.
+ * @throws WebServiceException On an error in the configuration of
+ * the list of roles.
+ **/
+ public void setRoles(Set<String> roles);
- /**
- * Returns <code>true</code> if the use of MTOM is enabled.
- *
- * @return <code>true</code> if and only if the use of MTOM is enabled.
- **/
-
- public boolean isMTOMEnabled();
-
- /**
- * Enables or disables use of MTOM.
- *
- * @param flag A <code>boolean</code> specifying whether the use of MTOM
should
- * be enabled or disabled.
- * @throws WebServiceException If the specified setting is not supported
- * by this binding instance.
- * *
- **/
- public void setMTOMEnabled(boolean flag);
-
- /**
- * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP
binding.
- *
- * @return SOAPFactory instance used by this SOAP binding.
- **/
- public SOAPFactory getSOAPFactory();
-
- /**
- * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP
binding.
- *
- * @return MessageFactory instance used by this SOAP binding.
- **/
- public MessageFactory getMessageFactory();
+ /**
+ * Returns <code>true</code> if the use of MTOM is enabled.
+ *
+ * @return <code>true</code> if and only if the use of MTOM is enabled.
+ **/
+
+ public boolean isMTOMEnabled();
+
+ /**
+ * Enables or disables use of MTOM.
+ *
+ * @param flag A <code>boolean</code> specifying whether the use of MTOM
should
+ * be enabled or disabled.
+ * @throws WebServiceException If the specified setting is not supported
+ * by this binding instance.
+ * *
+ **/
+ public void setMTOMEnabled(boolean flag);
+
+ /**
+ * Gets the SAAJ <code>SOAPFactory</code> instance used by this SOAP
binding.
+ *
+ * @return SOAPFactory instance used by this SOAP binding.
+ **/
+ public SOAPFactory getSOAPFactory();
+
+ /**
+ * Gets the SAAJ <code>MessageFactory</code> instance used by this SOAP
binding.
+ *
+ * @return MessageFactory instance used by this SOAP binding.
+ **/
+ public MessageFactory getMessageFactory();
}
Modified: branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java
===================================================================
--- branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-02
12:29:48 UTC (rev 2747)
+++ branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/Constants.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -25,6 +25,8 @@
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPConstants;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.ws.core.soap.NameImpl;
@@ -72,28 +74,18 @@
static final String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime";
/** The namespace for XOP. */
static final String NS_XOP = "http://www.w3.org/2004/08/xop/include";
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding.
- */
- public static final String SOAP11HTTP_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding.
- */
- public static final String SOAP12HTTP_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/";
-
- /**
- * A constant representing the identity of the SOAP 1.1 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP11HTTP_MTOM_BINDING =
"http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
-
- /**
- * A constant representing the identity of the SOAP 1.2 over HTTP binding
- * with MTOM enabled by default.
- */
- public static final String SOAP12HTTP_MTOM_BINDING =
"http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
+ public static final String SOAP11HTTP_BINDING = SOAPBinding.SOAP11HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding. */
+ public static final String SOAP12HTTP_BINDING = SOAPBinding.SOAP12HTTP_BINDING;
+ /** A constant representing the identity of the SOAP 1.1 over HTTP binding with MTOM
enabled by default. */
+ public static final String SOAP11HTTP_MTOM_BINDING =
SOAPBinding.SOAP11HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the SOAP 1.2 over HTTP binding with MTOM
enabled by default. */
+ public static final String SOAP12HTTP_MTOM_BINDING =
SOAPBinding.SOAP12HTTP_MTOM_BINDING;
+ /** A constant representing the identity of the XML/HTTP binding. */
+ public static final String HTTP_BINDING = HTTPBinding.HTTP_BINDING;
+
/** SOAP-1.1 encoding URI */
static final String URI_SOAP11_ENC = SOAPConstants.URI_NS_SOAP_ENCODING;
/** SOAP-1.2 encoding URI */
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/CommonClient.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -46,12 +46,12 @@
import org.jboss.ws.Constants;
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.EndpointInfo;
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;
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * A generic HTTP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface HTTPMessageAbstraction extends MessageAbstraction
+{
+
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/HTTPMessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,35 @@
+/*
+ * 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 javax.xml.soap.MimeHeaders;
+
+/**
+ * A generic message independent of the underlying protocol
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface MessageAbstraction
+{
+ MimeHeaders getMimeHeaders();
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,39 @@
+package org.jboss.ws.core;
+
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.soap.SOAPElementImpl;
+import org.jboss.ws.core.soap.SOAPElementWriter;
+
+public class MessageTracer
+{
+ private static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
+
+ public static void traceMessage(String string, MessageAbstraction message)
+ {
+ if (msgLog.isTraceEnabled())
+ {
+ if (message instanceof SOAPMessage)
+ {
+ try
+ {
+ SOAPEnvelope soapReqEnv =
((SOAPMessage)message).getSOAPPart().getEnvelope();
+ String envStr =
SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv, true);
+ msgLog.trace(string + "\n" + envStr);
+ }
+ catch (SOAPException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ msgLog.trace("Unsupported message type: " + message);
+ }
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/MessageTracer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * A generic SOAP message
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 02-Apr-2007
+ */
+public interface SOAPMessageAbstraction extends MessageAbstraction
+{
+
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/SOAPMessageAbstraction.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java
(from rev 2744,
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java)
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/EndpointInfo.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,99 @@
+/*
+* 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.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+
+/** A wrapper object that associates the target address with some metadata
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 20-Jul-2005
+ */
+public class EndpointInfo
+{
+ private String targetAddress;
+ private Map<String, Object> properties;
+ public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String,
Object> callProps)
+ {
+ this.targetAddress = targetAddress;
+ this.properties = callProps;
+
+ // Add the service properties
+ Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
+ if (serviceProps != null)
+ {
+ Iterator it = serviceProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+ }
+
+ // Add the endpoint properties
+ Properties epProps = epMetaData.getProperties();
+ Iterator it = epProps.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+ properties.put(key, val);
+ }
+
+ }
+
+ public Map<String, Object> getProperties()
+ {
+ return properties;
+ }
+
+ public String getTargetAddress()
+ {
+ return targetAddress;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof EndpointInfo))
+ return false;
+ return toString().equals(obj.toString());
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public String toString()
+ {
+ return "[addr=" + targetAddress + ",props=" + properties +
"]";
+ }
+}
\ No newline at end of file
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,52 @@
+/*
+ * 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 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;
+
+/**
+ * @since 02-Apr-2007
+ */
+public class HTTPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new SOAPMessageMarshaller();
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+import java.io.IOException;
+
+import org.jboss.ws.core.MessageAbstraction;
+
+// $Id$
+
+/**
+ * A remoting connection
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 02-Apr-2007
+ */
+public interface RemotingConnection
+{
+ MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean
oneway) throws IOException;
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,377 @@
+/*
+ * 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 java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.rpc.Stub;
+import javax.xml.soap.MimeHeader;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.addressing.EndpointReference;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
+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.MessageTracer;
+import org.jboss.ws.core.StubExt;
+import org.jboss.ws.core.WSTimeoutException;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ *
+ * @since 02-Feb-2005
+ */
+public abstract class RemotingConnectionImpl implements RemotingConnection
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(RemotingConnectionImpl.class);
+
+ private Map<String, Object> clientConfig = new HashMap<String, Object>();
+
+ private static Map<String, String> metadataMap = new HashMap<String,
String>();
+ static
+ {
+ metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
+ metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
+ metadataMap.put(BindingProvider.USERNAME_PROPERTY,
"http.basic.username");
+ metadataMap.put(BindingProvider.PASSWORD_PROPERTY,
"http.basic.password");
+ }
+ private static Map<String, String> configMap = new HashMap<String,
String>();
+ static
+ {
+ // Remoting constants since 2.0.0.GA
+ //configMap.put(StubExt.PROPERTY_KEY_STORE,
SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE,
SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
+ //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
+
+ configMap.put(StubExt.PROPERTY_KEY_STORE,
"org.jboss.remoting.keyStore");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
"org.jboss.remoting.keyStorePassword");
+ configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
"org.jboss.remoting.keyStoreType");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE,
"org.jboss.remoting.trustStore");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
"org.jboss.remoting.trustStorePassword");
+ configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
"org.jboss.remoting.trustStoreType");
+ }
+
+ private boolean closed;
+
+ public RemotingConnectionImpl()
+ {
+ // HTTPClientInvoker conect sends gratuitous POST
+ //
http://jira.jboss.com/jira/browse/JBWS-711
+ clientConfig.put(Client.ENABLE_LEASE, false);
+ }
+
+ public boolean isClosed()
+ {
+ return closed;
+ }
+
+ public void setClosed(boolean closed)
+ {
+ this.closed = closed;
+ }
+
+ /**
+ * Sends the given message to the specified endpoint.
+ *
+ * A null reqMessage signifies a HTTP GET request.
+ */
+ protected MessageAbstraction invokeInternal(MessageAbstraction reqMessage, Object
endpoint, boolean oneway) throws IOException
+ {
+ if (endpoint == null)
+ throw new IllegalArgumentException("Given endpoint cannot be null");
+
+ if (closed)
+ throw new WSException("Connection is already closed");
+
+ Object timeout = null;
+ String targetAddress;
+ Map<String, Object> callProps = new HashMap<String, Object>();
+
+ if (endpoint instanceof EndpointInfo)
+ {
+ EndpointInfo epInfo = (EndpointInfo)endpoint;
+ targetAddress = epInfo.getTargetAddress();
+ callProps = epInfo.getProperties();
+
+ if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
+ {
+ timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
+ targetAddress = addURLParameter(targetAddress, "timeout",
timeout.toString());
+ }
+
+ }
+ else if (endpoint instanceof EndpointReference)
+ {
+ EndpointReference epr = (EndpointReference)endpoint;
+ targetAddress = epr.getAddress().toString();
+ }
+ else
+ {
+ targetAddress = endpoint.toString();
+ }
+
+ // setup remoting client
+ Map<String, Object> metadata = createRemotingMetaData(reqMessage,
callProps);
+ Client client = createRemotingClient(endpoint, targetAddress, oneway);
+
+ try
+ {
+ // debug the outgoing message
+ MessageTracer.traceMessage("Outgoing Request Message", reqMessage);
+
+ MessageAbstraction resMessage = null;
+ try
+ {
+ if (oneway == true)
+ {
+ client.invokeOneway(reqMessage, metadata, false);
+ }
+ else
+ {
+ resMessage = (MessageAbstraction)client.invoke(reqMessage, metadata);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ Throwable cause = rte.getCause();
+ if (timeout != null && cause instanceof SocketTimeoutException)
+ throw new WSTimeoutException("Timeout after: " + timeout +
"ms", new Long(timeout.toString()));
+ else throw rte;
+ }
+
+ // Disconnect the remoting client
+ client.disconnect();
+
+ callProps.clear();
+ callProps.putAll(metadata);
+
+ // trace the incomming response message
+ MessageTracer.traceMessage("Incoming Response Message", resMessage);
+
+ return resMessage;
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Throwable th)
+ {
+ IOException io = new IOException("Could not transmit message");
+ io.initCause(th);
+ throw io;
+ }
+ }
+
+ private String addURLParameter(String url, String key, String value)
+ {
+ int qmIndex = url.indexOf("?");
+ url += (qmIndex < 0 ? "?" : "&") + key + "=" +
value;
+ return url;
+ }
+
+ private Client createRemotingClient(Object endpoint, String targetAddress, boolean
oneway)
+ {
+ Client client;
+ try
+ {
+ // Get the invoker from Remoting for a given endpoint address
+ log.debug("Get locator for: " + endpoint);
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE,
"SOAPMessage");
+ InvokerLocator locator = new InvokerLocator(targetAddress);
+
+ /* An HTTPClientInvoker may disconnect from the server and recreated by the
remoting layer.
+ * In that case the new invoker does not inherit the marshaller/unmarshaller
from the disconnected invoker.
+ * We therefore explicitly specify the invoker locator datatype and register the
SOAP marshaller/unmarshaller
+ * with the MarshalFactory.
+ *
+ * This applies to remoting-1.4.5
+ */
+ Marshaller marshaller = getMarshaller();
+ UnMarshaller unmarshaller = getUnmarshaller();
+ MarshalFactory.addMarshaller("SOAPMessage", marshaller,
unmarshaller);
+
+ client = new Client(locator, "saaj", clientConfig);
+ client.connect();
+
+ client.setMarshaller(marshaller);
+
+ if (oneway == false)
+ client.setUnMarshaller(unmarshaller);
+ }
+ catch (MalformedURLException e)
+ {
+ throw new IllegalArgumentException("Malformed endpoint address", e);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Could not setup remoting client",
e);
+ }
+ return client;
+ }
+
+ protected abstract UnMarshaller getUnmarshaller();
+
+ protected abstract Marshaller getMarshaller();
+
+ private Map<String, Object> createRemotingMetaData(MessageAbstraction
reqMessage, Map callProps)
+ {
+
+ Map<String, Object> metadata = new HashMap<String, Object>();
+
+ // We need to unmarshall faults (HTTP 500)
+ // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); //
since 2.0.0.GA
+ metadata.put("NoThrowOnError", "true");
+
+ if (reqMessage != null)
+ populateHeaders(reqMessage, metadata);
+ else metadata.put("TYPE", "GET");
+
+ if (callProps != null)
+ {
+ Iterator it = callProps.entrySet().iterator();
+
+ // Get authentication type, default to BASIC authetication
+ String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
+ if (authType == null)
+ authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry)it.next();
+ String key = (String)entry.getKey();
+ Object val = entry.getValue();
+
+ // pass properties to remoting meta data
+ if (metadataMap.containsKey(key))
+ {
+ String remotingKey = metadataMap.get(key);
+ if ("http.basic.username".equals(remotingKey) ||
"http.basic.password".equals(remotingKey))
+ {
+ if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
+ {
+ metadata.put(remotingKey, val);
+ }
+ else
+ {
+ log.warn("Ignore '" + key + "' with auth
typy: " + authType);
+ }
+ }
+ else
+ {
+ metadata.put(remotingKey, val);
+ }
+ }
+
+ // pass properties to remoting client config
+ if (configMap.containsKey(key))
+ {
+ String remotingKey = configMap.get(key);
+ clientConfig.put(remotingKey, val);
+ }
+ }
+ }
+
+ return metadata;
+ }
+
+ private 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);
+
+ Iterator i = mimeHeaders.getAllHeaders();
+ while (i.hasNext())
+ {
+ MimeHeader header = (MimeHeader)i.next();
+ String currentValue = props.getProperty(header.getName());
+
+ /*
+ * Coalesce multiple headers into one
+ *
+ * From HTTP/1.1 RFC 2616:
+ *
+ * Multiple message-header fields with the same field-name MAY be
+ * present in a message if and only if the entire field-value for that
+ * header field is defined as a comma-separated list [i.e., #(values)].
+ * It MUST be possible to combine the multiple header fields into one
+ * "field-name: field-value" pair, without changing the semantics of
+ * the message, by appending each subsequent field-value to the first,
+ * each separated by a comma.
+ */
+ if (currentValue != null)
+ {
+ props.put(header.getName(), currentValue + "," +
header.getValue());
+ }
+ else
+ {
+ props.put(header.getName(), header.getValue());
+ }
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
(from rev 2744,
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java)
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPConnectionImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,121 @@
+/*
+ * 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;
+ }
+
+}
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,95 @@
+/*
+ * 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 java.net.SocketTimeoutException;
+
+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;
+
+/**
+ * SOAPConnection implementation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
+ *
+ * @since 02-Apr-2007
+ */
+public class SOAPRemotingConnection extends RemotingConnectionImpl
+{
+ protected UnMarshaller getUnmarshaller()
+ {
+ return new SOAPMessageUnMarshaller();
+ }
+
+ protected Marshaller getMarshaller()
+ {
+ return new SOAPMessageMarshaller();
+ }
+
+ public MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint,
boolean oneway) throws IOException
+ {
+ try
+ {
+ // enforce xop transitions
+ // TODO: there should be a clear transition to an immutable object model
+ XOPContext.eagerlyCreateAttachments();
+
+ // save object model changes
+ SOAPMessage soapMessage = (SOAPMessage)reqMessage;
+ if (reqMessage != null && soapMessage.saveRequired())
+ soapMessage.saveChanges();
+
+ return invokeInternal(reqMessage, endpoint, oneway);
+ }
+ catch (RuntimeException rte)
+ {
+ 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;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WSException(ex);
+ }
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/client/SOAPRemotingConnection.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -0,0 +1,65 @@
+/*
+ * 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();
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchHTTPBindingHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -23,26 +23,14 @@
// $Id$
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
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.AsyncHandler;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
@@ -51,14 +39,17 @@
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPFaultException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.core.MessageAbstraction;
+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.SOAPBodyImpl;
-import org.jboss.ws.core.soap.SOAPConnectionImpl;
-import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
/**
@@ -117,13 +108,31 @@
private Object invokeInternal(Object obj, Map<String, Object> resContext) throws
SOAPException
{
- SOAPMessage reqMsg = getRequestMessage(obj);
+ MessageAbstraction reqMsg = getRequestMessage(obj);
String targetAddress = epMetaData.getEndpointAddress();
- SOAPMessage resMsg = new SOAPConnectionImpl().call(reqMsg, targetAddress);
+ MessageAbstraction resMsg = getRemotingConnection().invoke(reqMsg, targetAddress);
Object retObj = getReturnObject(resMsg);
return retObj;
}
+ private RemotingConnection getRemotingConnection()
+ {
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ RemotingConnection remotingConnection;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+ else
+ {
+ remotingConnection = new SOAPRemotingConnection();
+ }
+ return remotingConnection;
+ }
+
public Response<T> invokeAsync(T msg)
{
ResponseImpl response = new ResponseImpl();
@@ -144,11 +153,11 @@
public void invokeOneWay(T msg)
{
- SOAPMessage reqMsg = getRequestMessage(msg);
+ MessageAbstraction reqMsg = getRequestMessage(msg);
try
{
String targetAddress = epMetaData.getEndpointAddress();
- new SOAPConnectionImpl().callOneWay(reqMsg, targetAddress);
+ new SOAPConnectionImpl().callOneWay((SOAPMessage)reqMsg, targetAddress);
}
catch (Exception ex)
{
@@ -169,7 +178,7 @@
{
throw (WebServiceException)ex;
}
-
+
String msg = "Cannot dispatch message";
log.error(msg, ex);
throw new WebServiceException(msg, ex);
@@ -210,107 +219,47 @@
}
}
- private SOAPMessage getRequestMessage(Object obj)
+ private MessageAbstraction getRequestMessage(Object obj)
{
// jaxws/api/javax_xml_ws/Dispatch/Client.java#invokeTestJAXBNull
if (obj == null)
throw new SOAPFaultException("Request object cannot be null");
-
- SOAPMessage reqMsg = null;
- try
- {
- MessageFactory factory = MessageFactory.newInstance();
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- reqMsg = (SOAPMessage)obj;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- Source source = (Source)obj;
- if (mode == Mode.PAYLOAD)
- {
- reqMsg = 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 = 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 = factory.createMessage();
- SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMsg.getSOAPBody();
- StreamSource source = new StreamSource(new
ByteArrayInputStream(baos.toByteArray()));
- soapBody.setSource(source);
- }
- }
- catch (RuntimeException rte)
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
+ MessageAbstraction message;
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- throw rte;
+ DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type,
jaxbContext);
+ message = helper.getRequestMessage(obj);
}
- catch (Exception ex)
+ else
{
- throw new WebServiceException("Cannot create request message", ex);
+ DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type,
jaxbContext);
+ message = helper.getRequestMessage(obj);
}
-
- if (reqMsg == null)
- throw new WebServiceException("Cannot create request message for: " +
obj);
-
- return reqMsg;
+ return message;
}
- private Object getReturnObject(SOAPMessage resMsg)
+ private Object getReturnObject(MessageAbstraction resMsg)
{
+ String bindingID = bindingProvider.getBinding().getBindingID();
+ if (EndpointMetaData.SUPPORTED_BINDINGS.contains(bindingID) == false)
+ throw new IllegalStateException("Unsupported binding: " + bindingID);
+
Object retObj = null;
- try
+ if (HTTPBinding.HTTP_BINDING.equals(bindingID))
{
- if (SOAPMessage.class.isAssignableFrom(type))
- {
- retObj = resMsg;
- }
- else if (Source.class.isAssignableFrom(type))
- {
- if (mode == Mode.PAYLOAD)
- {
- SOAPBodyImpl soapBody = (SOAPBodyImpl)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();
-
- if(log.isDebugEnabled()) log.debug("JAXB unmarshal: " +
DOMWriter.printNode(soapElement, false));
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- retObj = unmarshaller.unmarshal(soapElement);
- }
+ DispatchHTTPBindingHelper helper = new DispatchHTTPBindingHelper(mode, type,
jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (RuntimeException rte)
+ else
{
- throw rte;
+ DispatchSOAPBindingHelper helper = new DispatchSOAPBindingHelper(mode, type,
jaxbContext);
+ retObj = helper.getReturnObject(resMsg);
}
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot process response message", ex);
- }
return retObj;
}
@@ -346,7 +295,7 @@
handler.handleResponse(response);
}
}
-
+
// 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked
using an invokeAsync
// method, an implementation MUST throw a WebServiceException if there is any error
in the configuration
// of the Dispatch instance. Errors that occur during the invocation are reported
when the client
@@ -355,7 +304,7 @@
{
String msg = "Cannot dispatch message";
log.error(msg, ex);
-
+
WebServiceException wsex;
if (ex instanceof WebServiceException)
{
Added:
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
(rev 0)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -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 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;
+ }
+}
Property changes on:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/DispatchSOAPBindingHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/server/ServiceEndpointManager.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -59,12 +59,12 @@
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.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;
Deleted:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-02
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/EndpointInfo.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -1,100 +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.soap;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-
-/** A wrapper object that associates the target address with some metadata
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 20-Jul-2005
- */
-public class EndpointInfo
-{
- private String targetAddress;
- private Map<String, Object> properties;
- public EndpointInfo(EndpointMetaData epMetaData, String targetAddress, Map<String,
Object> callProps)
- {
- this.targetAddress = targetAddress;
- this.properties = callProps;
-
- // Add the service properties
- Properties serviceProps = epMetaData.getServiceMetaData().getProperties();
- if (serviceProps != null)
- {
- Iterator it = serviceProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
- }
-
- // Add the endpoint properties
- Properties epProps = epMetaData.getProperties();
- Iterator it = epProps.entrySet().iterator();
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
- properties.put(key, val);
- }
-
- }
-
- public Map<String, Object> getProperties()
- {
- return properties;
- }
-
- public String getTargetAddress()
- {
- return targetAddress;
- }
-
- public boolean equals(Object obj)
- {
- if (!(obj instanceof EndpointInfo))
- return false;
- return toString().equals(obj.toString());
- }
-
- public int hashCode()
- {
- return toString().hashCode();
- }
-
- public String toString()
- {
- return "[addr=" + targetAddress + ",props=" + properties +
"]";
- }
-}
\ No newline at end of file
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionFactoryImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -60,6 +60,8 @@
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
+import org.jboss.ws.core.client.SOAPConnectionImpl;
+
/**
* SOAP Connection Factory implementation
*
Deleted:
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-02
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPConnectionImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -1,426 +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.soap;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.SocketTimeoutException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.rpc.Stub;
-import javax.xml.soap.MimeHeader;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPConnection;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.addressing.EndpointReference;
-
-import org.jboss.logging.Logger;
-import org.jboss.remoting.Client;
-import org.jboss.remoting.InvokerLocator;
-import org.jboss.remoting.marshal.MarshalFactory;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.WSTimeoutException;
-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 static Logger msgLog = Logger.getLogger("jbossws.SOAPMessage");
-
- private Map<String, Object> config = new HashMap<String, Object>();
-
- private static Map<String, String> metadataMap = new HashMap<String,
String>();
- static
- {
- metadataMap.put(Stub.USERNAME_PROPERTY, "http.basic.username");
- metadataMap.put(Stub.PASSWORD_PROPERTY, "http.basic.password");
- metadataMap.put(BindingProvider.USERNAME_PROPERTY,
"http.basic.username");
- metadataMap.put(BindingProvider.PASSWORD_PROPERTY,
"http.basic.password");
- }
- private static Map<String, String> configMap = new HashMap<String,
String>();
- static
- {
- // Remoting constants since 2.0.0.GA
- //configMap.put(StubExt.PROPERTY_KEY_STORE,
SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
SSLSocketBuilder.REMOTING_KEY_STORE_TYPE);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE,
SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD);
- //configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
SSLSocketBuilder.REMOTING_TRUST_STORE_TYPE);
-
- configMap.put(StubExt.PROPERTY_KEY_STORE,
"org.jboss.remoting.keyStore");
- configMap.put(StubExt.PROPERTY_KEY_STORE_PASSWORD,
"org.jboss.remoting.keyStorePassword");
- configMap.put(StubExt.PROPERTY_KEY_STORE_TYPE,
"org.jboss.remoting.keyStoreType");
- configMap.put(StubExt.PROPERTY_TRUST_STORE,
"org.jboss.remoting.trustStore");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_PASSWORD,
"org.jboss.remoting.trustStorePassword");
- configMap.put(StubExt.PROPERTY_TRUST_STORE_TYPE,
"org.jboss.remoting.trustStoreType");
- }
-
- private boolean closed;
-
- public SOAPConnectionImpl()
- {
- // HTTPClientInvoker conect sends gratuitous POST
- //
http://jira.jboss.com/jira/browse/JBWS-711
- config.put(Client.ENABLE_LEASE, false);
- }
-
- /**
- * 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");
- return callInternal(reqMessage, endpoint, false);
- }
-
- /**
- * Sends an HTTP GET request to an endpoint and blocks until a SOAP message is
received
- */
- public SOAPMessage get(Object endpoint) throws SOAPException
- {
- return callInternal(null, endpoint, false);
- }
-
- /**
- * 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");
- return callInternal(reqMessage, endpoint, true);
- }
-
- /**
- * Sends the given message to the specified endpoint.
- *
- * A null reqMessage signifies a HTTP GET request.
- */
- private SOAPMessage callInternal(SOAPMessage reqMessage, Object endpoint, boolean
oneway) throws SOAPException
- {
- if (endpoint == null)
- throw new IllegalArgumentException("Given endpoint cannot be null");
-
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- Object timeout = null;
- String targetAddress;
- Map<String, Object> callProps = new HashMap<String,Object>();
-
- if (endpoint instanceof EndpointInfo)
- {
- EndpointInfo epInfo = (EndpointInfo)endpoint;
- targetAddress = epInfo.getTargetAddress();
- callProps = epInfo.getProperties();
-
- if (callProps.containsKey(StubExt.PROPERTY_CLIENT_TIMEOUT))
- {
- timeout = callProps.get(StubExt.PROPERTY_CLIENT_TIMEOUT);
- targetAddress = addURLParameter(targetAddress, "timeout",
timeout.toString());
- }
-
-
- }
- else if (endpoint instanceof EndpointReference)
- {
- EndpointReference epr = (EndpointReference)endpoint;
- targetAddress = epr.getAddress().toString();
- }
- else
- {
- targetAddress = endpoint.toString();
- }
-
- // enforce xop transitions
- // TODO: there should be a clear transition to an immutable object model
- XOPContext.eagerlyCreateAttachments();
-
- // save object model changes
- if (reqMessage != null && reqMessage.saveRequired())
- reqMessage.saveChanges();
-
- // setup remoting client
- Map<String, Object> metadata = createRemotingMetaData(reqMessage,
callProps);
- Client client = createRemotingClient(endpoint, targetAddress, oneway);
-
- try
- {
- // debug the outgoing message
- if (reqMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapReqEnv = reqMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapReqEnv,
true);
- msgLog.trace("Remoting meta data: " + metadata);
- msgLog.trace("Outgoing SOAPMessage\n" + envStr);
- }
-
- SOAPMessage resMessage = null;
- try
- {
- if (oneway == true)
- {
- client.invokeOneway(reqMessage, metadata, false);
- }
- else
- {
- resMessage = (SOAPMessage)client.invoke(reqMessage, metadata);
- }
- }
- catch (RuntimeException rte)
- {
- Throwable cause = rte.getCause();
- // The CTS expects only SOAPException to be thrown.
- if (cause instanceof IOException && cause.getCause() instanceof
SOAPException)
- throw cause.getCause();
- else if (timeout != null && cause instanceof SocketTimeoutException)
- throw new WSTimeoutException("Timeout after: " + timeout +
"ms", new Long(timeout.toString()));
- else throw rte;
- }
-
- // Disconnect the remoting client
- client.disconnect();
-
- callProps.clear();
- callProps.putAll(metadata);
-
- // debug the incomming response message
- if (resMessage != null && msgLog.isTraceEnabled())
- {
- SOAPEnvelope soapResEnv = resMessage.getSOAPPart().getEnvelope();
- String envStr = SOAPElementWriter.writeElement((SOAPElementImpl)soapResEnv,
true);
- msgLog.trace("Incoming Response SOAPMessage\n" + envStr);
- }
-
- return resMessage;
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Throwable t)
- {
- throw new SOAPException("Could not transmit message", t);
- }
- }
-
- private String addURLParameter(String url, String key, String value)
- {
- int qmIndex = url.indexOf("?");
- url += (qmIndex < 0 ? "?" : "&") + key + "=" +
value;
- return url;
- }
-
- /** Closes this SOAPConnection
- */
- public void close() throws SOAPException
- {
- if (closed)
- throw new SOAPException("SOAPConnection is already closed");
-
- closed = true;
- }
-
- private Client createRemotingClient(Object endpoint, String targetAddress, boolean
oneway) throws SOAPException
- {
- Client client;
- try
- {
- // Get the invoker from Remoting for a given endpoint address
- if(log.isDebugEnabled()) log.debug("Get locator for: " + endpoint);
- targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE,
"SOAPMessage");
- InvokerLocator locator = new InvokerLocator(targetAddress);
-
- /* An HTTPClientInvoker may disconnect from the server and recreated by the
remoting layer.
- * In that case the new invoker does not inherit the marshaller/unmarshaller
from the disconnected invoker.
- * We therefore explicitly specify the invoker locator datatype and register the
SOAP marshaller/unmarshaller
- * with the MarshalFactory.
- *
- * This applies to remoting-1.4.5
- */
- SOAPMessageMarshaller marshaller = new SOAPMessageMarshaller();
- SOAPMessageUnMarshaller unmarshaller = new SOAPMessageUnMarshaller();
- MarshalFactory.addMarshaller("SOAPMessage", marshaller,
unmarshaller);
-
- client = new Client(locator, "saaj", config);
- client.connect();
-
- client.setMarshaller(marshaller);
-
- if (oneway == false)
- client.setUnMarshaller(unmarshaller);
- }
- catch (MalformedURLException e)
- {
- throw new SOAPException("Malformed endpoint address", e);
- }
- catch (Exception e)
- {
- throw new SOAPException("Could not setup remoting client", e);
- }
- return client;
- }
-
- private Map<String, Object> createRemotingMetaData(SOAPMessage reqMessage, Map
callProps) throws SOAPException
- {
-
- Map<String, Object> metadata = new HashMap<String, Object>();
-
- // We need to unmarshall faults (HTTP 500)
- // metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true"); //
since 2.0.0.GA
- metadata.put("NoThrowOnError", "true");
-
- if (reqMessage != null)
- populateHeaders(reqMessage, metadata);
- else
- metadata.put("TYPE", "GET");
-
- if (callProps != null)
- {
- Iterator it = callProps.entrySet().iterator();
-
- // Get authentication type, default to BASIC authetication
- String authType = (String)callProps.get(StubExt.PROPERTY_AUTH_TYPE);
- if (authType == null)
- authType = StubExt.PROPERTY_AUTH_TYPE_BASIC;
-
- while (it.hasNext())
- {
- Map.Entry entry = (Map.Entry)it.next();
- String key = (String)entry.getKey();
- Object val = entry.getValue();
-
- // pass properties to remoting meta data
- if (metadataMap.containsKey(key))
- {
- String remotingKey = metadataMap.get(key);
- if ("http.basic.username".equals(remotingKey) ||
"http.basic.password".equals(remotingKey))
- {
- if (authType.equals(StubExt.PROPERTY_AUTH_TYPE_BASIC))
- {
- metadata.put(remotingKey, val);
- }
- else
- {
- log.warn("Ignore '" + key + "' with auth
typy: " + authType);
- }
- }
- else
- {
- metadata.put(remotingKey, val);
- }
- }
-
- // pass properties to remoting client config
- if (configMap.containsKey(key))
- {
- String remotingKey = configMap.get(key);
- config.put(remotingKey, val);
- }
- }
- }
-
- return metadata;
- }
-
- private void populateHeaders(SOAPMessage 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);
-
- Iterator i = mimeHeaders.getAllHeaders();
- while (i.hasNext())
- {
- MimeHeader header = (MimeHeader)i.next();
- String currentValue = props.getProperty(header.getName());
-
- /*
- * Coalesce multiple headers into one
- *
- * From HTTP/1.1 RFC 2616:
- *
- * Multiple message-header fields with the same field-name MAY be
- * present in a message if and only if the entire field-value for that
- * header field is defined as a comma-separated list [i.e., #(values)].
- * It MUST be possible to combine the multiple header fields into one
- * "field-name: field-value" pair, without changing the semantics of
- * the message, by appending each subsequent field-value to the first,
- * each separated by a comma.
- */
- if (currentValue != null)
- {
- props.put(header.getName(), currentValue + "," +
header.getValue());
- }
- else
- {
- props.put(header.getName(), header.getValue());
- }
- }
- }
-}
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/core/soap/SOAPMessageImpl.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -42,6 +42,7 @@
import javax.xml.soap.SOAPPart;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.SOAPMessageAbstraction;
import org.jboss.ws.core.soap.attachment.AttachmentPartImpl;
import org.jboss.ws.core.soap.attachment.CIDGenerator;
import org.jboss.ws.core.soap.attachment.MimeConstants;
@@ -59,7 +60,7 @@
* @author Thomas.Diesler(a)jboss.org
* @author <a href="mailto:jason@stacksmash.com">Jason T.
Greene</a>
*/
-public class SOAPMessageImpl extends SOAPMessage
+public class SOAPMessageImpl extends SOAPMessage implements SOAPMessageAbstraction
{
private boolean saveRequired = true;
private MimeHeaders mimeHeaders = new MimeHeaders();
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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/eventing/mgmt/Subscription.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -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.soap.SOAPConnectionImpl;
+import org.jboss.ws.core.client.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
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/extensions/xop/XOPContext.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -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.soap.SOAPConnectionImpl#callInternal(javax.xml.soap.SOAPMessage, Object,
boolean)
+ * @see
org.jboss.ws.core.client.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/umdm/EndpointMetaData.java
===================================================================
---
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-02
12:29:48 UTC (rev 2747)
+++
branches/tdiesler/trunk/jbossws-core/src/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-04-02
15:41:10 UTC (rev 2748)
@@ -28,10 +28,12 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Properties;
+import java.util.Set;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
@@ -60,8 +62,8 @@
import org.jboss.ws.metadata.config.ConfigurationProvider;
import org.jboss.ws.metadata.config.EndpointFeature;
import org.jboss.ws.metadata.config.JBossWSConfigFactory;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
-import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
/**
* A Service component describes a set of endpoints.
@@ -79,6 +81,16 @@
JAXRPC, JAXWS
}
+ public static final Set<String> SUPPORTED_BINDINGS = new
HashSet<String>();
+ static
+ {
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP11HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.SOAP12HTTP_MTOM_BINDING);
+ SUPPORTED_BINDINGS.add(Constants.HTTP_BINDING);
+ }
+
// The parent meta data.
private ServiceMetaData serviceMetaData;
@@ -154,7 +166,7 @@
}
public void setPortName(QName portName)
- {
+ {
this.portName = portName;
}
@@ -180,11 +192,8 @@
public void setBindingId(String bindingId)
{
- if (!Constants.SOAP11HTTP_BINDING.equals(bindingId) &&
!Constants.SOAP12HTTP_BINDING.equals(bindingId) &&
!Constants.SOAP11HTTP_MTOM_BINDING.equals(bindingId)
- && !Constants.SOAP12HTTP_MTOM_BINDING.equals(bindingId))
- {
+ if (SUPPORTED_BINDINGS.contains(bindingId) == false)
throw new WSException("Unsupported binding: " + bindingId);
- }
this.bindingId = bindingId;
}
@@ -327,7 +336,7 @@
public Properties getProperties()
{
- if(null == this.properties)
+ if (null == this.properties)
this.properties = new Properties();
return this.properties;
}
@@ -734,8 +743,7 @@
boolean match;
if (seiName != null && portName != null)
match = getServiceEndpointInterfaceName().equals(seiName) &&
portName.equals(portName);
- else
- match = getServiceEndpointInterfaceName().equals(seiName) ||
getPortName().equals(portName);
+ else match = getServiceEndpointInterfaceName().equals(seiName) ||
getPortName().equals(portName);
return match;
}