[jboss-svn-commits] JBossWS SVN: r709 - in trunk-tdiesler: . src/main/java/javax/xml src/main/java/javax/xml/soap src/main/java/javax/xml/ws/handler src/main/java/javax/xml/ws/spi src/main/java/org/jboss/ws/addressing/jaxws src/main/java/org/jboss/ws/binding src/main/java/org/jboss/ws/binding/soap src/main/java/org/jboss/ws/common src/main/java/org/jboss/ws/deployment src/main/java/org/jboss/ws/integration/jboss src/main/java/org/jboss/ws/jaxrpc src/main/java/org/jboss/ws/jaxrpc/handler src/main/java/org/jboss/ws/jaxws src/main/java/org/jboss/ws/jaxws/client src/main/java/org/jboss/ws/jaxws/core src/main/java/org/jboss/ws/jaxws/handler src/main/java/org/jboss/ws/jaxws/spi src/main/java/org/jboss/ws/metadata src/main/java/org/jboss/ws/metadata/wsdl src/main/java/org/jboss/ws/server src/main/java/org/jboss/ws/tools/metadata src/main/java/org/jboss/ws/wsse/jaxws src/test/ant src/test/java/org/jboss/test/ws/addressing/action src/test/java/org/jboss/test/ws/binding src/test/java/org/jboss/! test/ws/jsr181/handlerchain src/test/java/org/jboss/test/ws/jsr181/webservice src/test/java/org/jboss/test/ws/soap/attachment src/test/resources/jsr181/handlerchain/WEB-INF
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Aug 8 16:08:23 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-08-08 16:06:38 -0400 (Tue, 08 Aug 2006)
New Revision: 709
Added:
trunk-tdiesler/src/main/java/javax/xml/soap/
trunk-tdiesler/src/main/java/javax/xml/soap/AttachmentPart.java
trunk-tdiesler/src/main/java/javax/xml/soap/Detail.java
trunk-tdiesler/src/main/java/javax/xml/soap/DetailEntry.java
trunk-tdiesler/src/main/java/javax/xml/soap/MessageFactory.java
trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeader.java
trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeaders.java
trunk-tdiesler/src/main/java/javax/xml/soap/Name.java
trunk-tdiesler/src/main/java/javax/xml/soap/Node.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBody.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBodyElement.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnection.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConstants.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElement.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElementFactory.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPEnvelope.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPException.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFactory.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFault.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFaultElement.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeader.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeaderElement.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPMessage.java
trunk-tdiesler/src/main/java/javax/xml/soap/SOAPPart.java
trunk-tdiesler/src/main/java/javax/xml/soap/Text.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/PortInfoImpl.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/Endpoint.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/EndpointImpl.java
Removed:
trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProvider.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainBaseImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerInfo.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/ServerHandlerChain.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java
Modified:
trunk-tdiesler/.project
trunk-tdiesler/build-thirdparty.xml
trunk-tdiesler/src/main/java/javax/xml/ws/handler/HandlerResolver.java
trunk-tdiesler/src/main/java/javax/xml/ws/spi/ServiceDelegate.java
trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingClientHandler.java
trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java
trunk-tdiesler/src/main/java/org/jboss/ws/common/CommonClient.java
trunk-tdiesler/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
trunk-tdiesler/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/PortProxy.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerWrapper.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
trunk-tdiesler/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java
trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java
trunk-tdiesler/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
trunk-tdiesler/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerInbound.java
trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerOutbound.java
trunk-tdiesler/src/test/ant/build-jars.xml
trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionDocEndpointImpl.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionRpcEndpointImpl.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/AuthorizationHandler.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/JSR181HandlerChainTestCase.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/LogHandler.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/RoutingHandler.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean01.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean02.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean01.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean02.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EndpointInterface03.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean01.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean02.java
trunk-tdiesler/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java
trunk-tdiesler/src/test/resources/jsr181/handlerchain/WEB-INF/web.xml
Log:
Add SAAJ API
Implement JAXWS client side handlers
Unifiy BindingProvider
Modified: trunk-tdiesler/.project
===================================================================
--- trunk-tdiesler/.project 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/.project 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>trunk</name>
+ <name>trunk-tdiesler</name>
<comment></comment>
<projects>
</projects>
Modified: trunk-tdiesler/build-thirdparty.xml
===================================================================
--- trunk-tdiesler/build-thirdparty.xml 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/build-thirdparty.xml 2006-08-08 20:06:38 UTC (rev 709)
@@ -92,7 +92,6 @@
<path id="jboss.core.classpath">
<pathelement location="${jboss.server.lib}/jboss-j2ee.jar"/>
<pathelement location="${jboss.server.lib}/jboss-jaxrpc.jar"/>
- <pathelement location="${jboss.server.lib}/jboss-saaj.jar"/>
<pathelement location="${jboss.server.deploy}/ejb3.deployer/jboss-annotations-ejb3.jar"/>
<pathelement location="${jboss.server.deploy}/ejb3.deployer/jboss-ejb3x.jar"/>
</path>
Added: trunk-tdiesler/src/main/java/javax/xml/soap/AttachmentPart.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/AttachmentPart.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/AttachmentPart.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,271 @@
+/*
+* 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 javax.xml.soap;
+
+import javax.activation.DataHandler;
+import java.util.Iterator;
+
+/**
+ * A single attachment to a SOAPMessage object. A SOAPMessage object may contain zero, one, or many AttachmentPart objects.
+ * Each AttachmentPart object consists of two parts, application-specific content and associated MIME headers.
+ * The MIME headers consists of name/value pairs that can be used to identify and describe the content.
+ *
+ * An AttachmentPart object must conform to certain standards.
+ *
+ * 1. It must conform to MIME [RFC2045] standards</li>
+ * 2. It MUST contain content</li>
+ * 3. The header portion MUST include the following header:
+ *
+ * Content-Type
+ * This header identifies the type of data in the content of an AttachmentPart object and MUST conform to [RFC2045].
+ * The following is an example of a Content-Type header:
+ *
+ * Content-Type: application/xml
+ *
+ * The following line of code, in which ap is an AttachmentPart object, sets the header shown in the previous example.
+ *
+ * ap.setMimeHeader("Content-Type", "application/xml");
+ *
+ * There are no restrictions on the content portion of an AttachmentPart object. The content may be anything from a
+ * simple plain text object to a complex XML document or image file.
+ *
+ * An AttachmentPart object is created with the method SOAPMessage.createAttachmentPart.
+ * After setting its MIME headers, the AttachmentPart object is added to the message that
+ * created it with the method SOAPMessage.addAttachmentPart.
+ *
+ * The following code fragment, in which m is a SOAPMessage object and contentStringl is a String,
+ * creates an instance of AttachmentPart, sets the AttachmentPart object with some content and header information,
+ * and adds the AttachmentPart object to the SOAPMessage object.
+ *
+ * AttachmentPart ap1 = m.createAttachmentPart();
+ * ap1.setContent(contentString1, "text/plain");
+ * m.addAttachmentPart(ap1);
+ *
+ * The following code fragment creates and adds a second AttachmentPart instance to the same message.
+ * jpegData is a binary byte buffer representing the jpeg file.
+ *
+ * AttachmentPart ap2 = m.createAttachmentPart();
+ * byte[] jpegData = ...;
+ * ap2.setContent(new ByteArrayInputStream(jpegData), "image/jpeg");
+ * m.addAttachmentPart(ap2);
+ *
+ * The getContent method retrieves the contents and header from an AttachmentPart object.
+ * Depending on the DataContentHandler objects present, the returned Object can either be a typed Java object
+ * corresponding to the MIME type or an InputStream object that contains the content as bytes.
+ *
+ * String content1 = ap1.getContent();
+ * java.io.InputStream content2 = ap2.getContent();
+ *
+ * The method clearContent removes all the content from an AttachmentPart object but does not affect its header information.
+ *
+ * ap1.clearContent();
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class AttachmentPart
+{
+ private String contentId;
+ private String contentLocation;
+ private String contentType;
+
+ /**
+ * Adds a MIME header with the specified name and value to this AttachmentPart object.
+ *
+ * Note that RFC822 headers can contain only US-ASCII characters.
+ * @param name a String giving the name of the header to be added
+ * @param value a String giving the value of the header to be added
+ */
+ public abstract void addMimeHeader(String name, String value);
+
+ /**
+ * Clears out the content of this AttachmentPart object. The MIME header portion is left untouched.
+ */
+ public abstract void clearContent();
+
+ /**
+ * Retrieves all the headers for this AttachmentPart object as an iterator over the MimeHeader objects.
+ * @return an Iterator object with all of the Mime headers for this AttachmentPart object
+ */
+ public abstract Iterator getAllMimeHeaders();
+
+ /**
+ * Gets the content of this AttachmentPart object as a Java object.
+ * The type of the returned Java object depends on
+ * (1) the DataContentHandler object that is used to interpret the bytes and
+ * (2) the Content-Type given in the header.
+ *
+ * For the MIME content types "text/plain", "text/html" and "text/xml", the DataContentHandler object does the
+ * conversions to and from the Java types corresponding to the MIME types.
+ *
+ * For other MIME types,the DataContentHandler object can return an InputStream object that contains the content
+ * data as raw bytes.
+ *
+ * A SAAJ-compliant implementation must, as a minimum, return a java.lang.String object corresponding to any
+ * content stream with a Content-Type value of text/plain, a javax.xml.transform.stream.StreamSource object
+ * corresponding to a content stream with a Content-Type value of text/xml,
+ * a java.awt.Image object corresponding to a content stream with a Content-Type value of image/gif or image/jpeg.
+ *
+ * For those content types that an installed DataContentHandler object does not understand, the DataContentHandler
+ * object is required to return a java.io.InputStream object with the raw bytes.
+ *
+ * @return a Java object with the content of this AttachmentPart object
+ * @throws SOAPException if there is no content set into this AttachmentPart object or if there was a data transformation error
+ */
+ public abstract Object getContent() throws SOAPException;
+
+ /**
+ * Gets the DataHandler object for this AttachmentPart object.
+ * @return object associated with this AttachmentPart object
+ * @throws SOAPException if there is no data in this AttachmentPart object
+ */
+ public abstract DataHandler getDataHandler() throws SOAPException;
+
+ /**
+ * Retrieves all MimeHeader objects that match a name in the given array.
+ * @param names a String array with the name(s) of the MIME headers to be returned
+ * @return all of the MIME headers that match one of the names in the given array as an Iterator object
+ */
+ public abstract Iterator getMatchingMimeHeaders(String[] names);
+
+ /**
+ * Gets all the values of the header identified by the given String.
+ * @param name the name of the header; example: "Content-Type"
+ * @return a String array giving the value for the specified header
+ */
+ public abstract String[] getMimeHeader(String name);
+
+ /**
+ * Retrieves all MimeHeader objects whose name does not match a name in the given array.
+ * @param names a String array with the name(s) of the MIME headers not to be returned
+ * @return all of the MIME headers in this AttachmentPart object except those that match one of the names
+ * in the given array. The nonmatching MIME headers are returned as an Iterator object.
+ */
+ public abstract Iterator getNonMatchingMimeHeaders(String[] names);
+
+ /**
+ * Returns the number of bytes in this AttachmentPart object.
+ * @return the size of this AttachmentPart object in bytes or -1 if the size cannot be determined
+ * @throws SOAPException if the content of this attachment is corrupted of if there was an exception while trying to determine the size.
+ */
+ public abstract int getSize() throws SOAPException;
+
+ /**
+ * Removes all the MIME header entries.
+ */
+ public abstract void removeAllMimeHeaders();
+
+ /**
+ * Removes all MIME headers that match the given name.
+ * @param name the string name of the MIME header/s to be removed
+ */
+ public abstract void removeMimeHeader(String name);
+
+ /**
+ * Sets the content of this attachment part to that of the given Object and sets the value of the Content-Type header
+ * to the given type. The type of the Object should correspond to the value given for the Content-Type.
+ * This depends on the particular set of DataContentHandler objects in use.
+ *
+ * @param object the Java object that makes up the content for this attachment part
+ * @param contentType the MIME string that specifies the type of the content
+ * @throws IllegalArgumentException if the contentType does not match the type of the content object,
+ * or if there was no DataContentHandler object for this content object
+ */
+ public abstract void setContent(Object object, String contentType);
+
+ /**
+ * Sets the given DataHandler object as the data handler for this AttachmentPart object.
+ * Typically, on an incoming message, the data handler is automatically set.
+ * When a message is being created and populated with content, the setDataHandler method can be used to get data
+ * from various data sources into the message.
+ * @param dataHandler the DataHandler object to be set
+ * @throws IllegalArgumentException if there was a problem with the specified DataHandler object
+ */
+ public abstract void setDataHandler(DataHandler dataHandler);
+
+ /**
+ * Changes the first header entry that matches the given name to the given value, adding a new header if no existing
+ * header matches. This method also removes all matching headers but the first.
+ *
+ * Note that RFC822 headers can only contain US-ASCII characters.
+ * @param name a String giving the name of the header for which to search
+ * @param value a String giving the value to be set for the header whose name matches the given name
+ * @throws IllegalArgumentException if there was a problem with the specified mime header name or value
+ */
+ public abstract void setMimeHeader(String name, String value);
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-Id".
+ * @return a String giving the value of the "Content-Id" header or null if there is none
+ */
+ public String getContentId()
+ {
+ return contentId;
+ }
+
+ /**
+ * Sets the MIME header whose name is "Content-Id" with the given value.
+ * @param contentId a String giving the value of the "Content-Id" header
+ * @throws IllegalArgumentException if there was a problem with the specified contentId value
+ */
+ public void setContentId(String contentId)
+ {
+ this.contentId = contentId;
+ }
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-Location".
+ * @return a String giving the value of the "Content-Location" header or null if there is none
+ */
+ public String getContentLocation()
+ {
+ return contentLocation;
+ }
+
+ /**
+ * Sets the MIME header whose name is "Content-Location" with the given value.
+ * @throws IllegalArgumentException if there was a problem with the specified content location
+ */
+ public void setContentLocation(String contentLocation)
+ {
+ this.contentLocation = contentLocation;
+ }
+
+ /**
+ * Gets the value of the MIME header whose name is "Content-Type".
+ * @return a String giving the value of the "Content-Type" header or null if there is none
+ */
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ /**
+ * Sets the MIME header whose name is "Content-Type" with the given value.
+ * @param contentType a String giving the value of the "Content-Type" header
+ * @throws IllegalArgumentException if there was a problem with the specified content type
+ */
+ public void setContentType(String contentType)
+ {
+ this.contentType = contentType;
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/AttachmentPart.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/Detail.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/Detail.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/Detail.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,55 @@
+/*
+* 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 javax.xml.soap;
+
+import java.util.Iterator;
+
+/** A container for DetailEntry objects. DetailEntry objects give detailed
+ * error information that is application-specific and related to the SOAPBody
+ * object that contains it.
+ *
+ * A Detail object, which is part of a SOAPFault object, can be retrieved using
+ * the method SOAPFault.getDetail. The Detail interface provides two methods.
+ * One creates a new DetailEntry object and also automatically adds it to the
+ * Detail object. The second method gets a list of the DetailEntry objects
+ * contained in a Detail object.
+ *
+ * The following code fragment, in which sf is a SOAPFault object, gets its
+ * Detail object (d), adds a new DetailEntry object to d, and then gets a list
+ * of all the DetailEntry objects in d. The code also creates a Name object to
+ * pass to the method addDetailEntry. The variable se, used to create the Name
+ * object, is a SOAPEnvelope object.
+ Detail d = sf.getDetail();
+ Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ "http://www.wombat.org/trader");
+ d.addDetailEntry(name);
+ Iterator it = d.getDetailEntries();
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface Detail
+ extends SOAPFaultElement
+{
+ public DetailEntry addDetailEntry(Name name) throws SOAPException;
+ public Iterator getDetailEntries();
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/Detail.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/DetailEntry.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/DetailEntry.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/DetailEntry.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package javax.xml.soap;
+
+/** The content for a Detail object, giving details for a SOAPFault object. A
+ * DetailEntry object, which carries information about errors related to the
+ * SOAPBody object that contains it, is application-specific.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface DetailEntry
+ extends SOAPElement
+{
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/DetailEntry.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/MessageFactory.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/MessageFactory.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/MessageFactory.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,154 @@
+/*
+* 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 javax.xml.soap;
+
+import org.jboss.logging.Logger;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * A factory for creating SOAPMessage objects.
+ *
+ * A SAAJ client can create a MessageFactory object using the method newInstance, as shown in the following line of code.
+ *
+ * MessageFactory mf = MessageFactory.newInstance();
+ *
+ * A standalone client (a client that is not running in a container) can use the newInstance method to create a MessageFactory object.
+ *
+ * All MessageFactory objects, regardless of how they are created, will produce SOAPMessage objects that have the following elements by default:
+ *
+ * A SOAPPart object
+ * A SOAPEnvelope object
+ * A SOAPBody object
+ * A SOAPHeader object
+ *
+ * MessageFactory objects can be initialized with a JAXM profile. In such a case it will produce messages that also
+ * come prepopulated with additional entries in the SOAPHeader object and the SOAPBody object. The content of a new
+ * SOAPMessage object depends on which of the two MessageFactory methods is used to create it.
+ *
+ * createMessage() -- message has no content
+ * This is the method clients would normally use to create a request message.
+ *
+ * createMessage(MimeHeaders, java.io.InputStream) -- message has content from the InputStream object and headers from the MimeHeaders object
+ * This method can be used internally by a service implementation to create a message that is a response to a request.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class MessageFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(MessageFactory.class);
+
+ private static final String DEFAULT_MESSAGE_FACTORY = "org.jboss.ws.soap.MessageFactoryImpl";
+ private static final String[] alternativeFactories = new String[]{
+ "org.jboss.axis.soap.MessageFactoryImpl"
+ };
+
+ /** Creates a new MessageFactory object that is an instance of the default implementation.
+ */
+ public static MessageFactory newInstance() throws SOAPException
+ {
+ PrivilegedAction action = new PropertyAccessAction(MessageFactory.class.getName(), DEFAULT_MESSAGE_FACTORY);
+ String factoryName = (String)AccessController.doPrivileged(action);
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (MessageFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Throw the exception if the user asked for a specific factory
+ if (factoryName.equals(DEFAULT_MESSAGE_FACTORY) == false)
+ throw e;
+
+ for (int i = 0; i < alternativeFactories.length; i++)
+ {
+ factoryName = alternativeFactories[i];
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (MessageFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e1)
+ {
+ log.debug("Cannot load factory: " + factoryName);
+ }
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new SOAPException("Failed to create MessageFactory: " + factoryName, t);
+ }
+
+ throw new SOAPException("Cannot find MessageFactory implementation");
+ }
+
+ /**
+ * Creates a new SOAPMessage object with the default SOAPPart, SOAPEnvelope, SOAPBody, and SOAPHeader objects.
+ * Profile-specific message factories can choose to prepopulate the SOAPMessage object with profile-specific headers.
+ *
+ * Content can be added to this message's SOAPPart object, and the message can be sent "as is" when a message
+ * containing only a SOAP part is sufficient. Otherwise, the SOAPMessage object needs to create one or more
+ * AttachmentPart objects and add them to itself. Any content that is not in XML format must be in an AttachmentPart object.
+ *
+ * @return a new SOAPMessage object
+ * @throws SOAPException if a SOAP error occurs
+ */
+ public abstract SOAPMessage createMessage() throws SOAPException;
+
+ /**
+ * Internalizes the contents of the given InputStream object into a new SOAPMessage object and returns the SOAPMessage object.
+ *
+ * @param headers the transport-specific headers passed to the message in a transport-independent fashion for creation of the message
+ * @param in the InputStream object that contains the data for a message
+ * @return a new SOAPMessage object containing the data from the given InputStream object
+ * @throws IOException if there is a problem in reading data from the input stream
+ * @throws SOAPException if the message is invalid
+ */
+ public abstract SOAPMessage createMessage(MimeHeaders headers, InputStream in) throws IOException, SOAPException;
+
+ private static class PropertyAccessAction implements PrivilegedAction
+ {
+ private String name;
+ private String defaultValue;
+
+ PropertyAccessAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/MessageFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeader.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeader.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeader.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,68 @@
+/*
+* 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 javax.xml.soap;
+
+
+/** An object that stores a MIME header name and its value. One or more
+ * MimeHeader objects may be contained in a MimeHeaders object.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class MimeHeader
+{
+ private String name;
+ private String value;
+
+ public MimeHeader(String name, String value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof MimeHeader)) return false;
+ MimeHeader other = (MimeHeader)obj;
+ return toString().equals(other.toString());
+ }
+
+ public String toString()
+ {
+ return "[" + name + "=" + value + "]";
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeader.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeaders.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeaders.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeaders.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,196 @@
+/*
+* 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 javax.xml.soap;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/** A container for MimeHeader objects, which represent the MIME headers present
+ * in a MIME part of a message.
+ *
+ * This class is used primarily when an application wants to retrieve specific
+ * attachments based on certain MIME headers and values. This class will most
+ * likely be used by implementations of AttachmentPart and other MIME dependent
+ * parts of the SAAJ API.
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class MimeHeaders
+{
+ private LinkedList headers = new LinkedList();
+
+ public MimeHeaders()
+ {
+ }
+
+ /**
+ *
+ * @param name
+ * @param value
+ * @throws IllegalArgumentException - if name is null or empty.
+ */
+ public void addHeader(String name, String value)
+ throws IllegalArgumentException
+ {
+ if( name == null || name.length() == 0 )
+ throw new IllegalArgumentException("Invalid null or empty header name");
+ MimeHeader header = new MimeHeader(name, value);
+ headers.add(header);
+ }
+
+ public Iterator getAllHeaders()
+ {
+ return headers.iterator();
+ }
+
+ /**
+ *
+ * @param name
+ * @return All matching header values if found, null otherwise
+ */
+ public String[] getHeader(String name)
+ {
+ ArrayList tmp = new ArrayList();
+ for(int n = 0; n < headers.size(); n ++)
+ {
+ MimeHeader mh = (MimeHeader) headers.get(n);
+ if( mh.getName().equalsIgnoreCase(name) )
+ tmp.add(mh.getValue());
+ }
+ String[] values = null;
+ if( tmp.size() > 0 )
+ {
+ values = new String[tmp.size()];
+ tmp.toArray(values);
+ }
+ return values;
+ }
+
+ public Iterator getMatchingHeaders(String[] names)
+ {
+ MatchingIter iter = new MatchingIter(headers, names, true);
+ return iter;
+ }
+
+ public Iterator getNonMatchingHeaders(String[] names)
+ {
+ MatchingIter iter = new MatchingIter(headers, names, false);
+ return iter;
+ }
+
+ public void removeAllHeaders()
+ {
+ headers.clear();
+ }
+
+ public void removeHeader(String name)
+ {
+ Iterator iter = headers.iterator();
+ while( iter.hasNext() )
+ {
+ MimeHeader mh = (MimeHeader) iter.next();
+ if( mh.getName().equalsIgnoreCase(name) )
+ iter.remove();
+ }
+ }
+
+ /** Replaces the current value of the first header entry whose name matches
+ * the given name with the given value, adding a new header if no existing
+ * header name matches. This method also removes all matching headers after
+ * the first one.
+ *
+ */
+ public void setHeader(String name, String value)
+ {
+ boolean didSet = false;
+ for(int n = 0; n < headers.size(); n ++)
+ {
+ MimeHeader mh = (MimeHeader) headers.get(n);
+ if( mh.getName().equalsIgnoreCase(name) )
+ {
+ if( didSet == true )
+ {
+ headers.remove(n);
+ n --;
+ }
+ else
+ {
+ mh = new MimeHeader(name, value);
+ headers.set(n, mh);
+ didSet = true;
+ }
+ }
+ }
+
+ if( didSet == false )
+ {
+ this.addHeader(name, value);
+ }
+ }
+
+ private static class MatchingIter implements Iterator
+ {
+ private LinkedList headers;
+ private HashSet names;
+ private boolean match;
+ private int index;
+ private MimeHeader mh;
+
+ MatchingIter(LinkedList headers, String[] names, boolean match)
+ {
+ this.headers = headers;
+ this.index = 0;
+ this.names = new HashSet();
+ for(int n = 0; n < names.length; n ++)
+ this.names.add(names[n].toLowerCase());
+ this.match = match;
+ }
+
+ public boolean hasNext()
+ {
+ boolean hasNext = index < headers.size();
+ while( hasNext == true )
+ {
+ mh = (MimeHeader) headers.get(index);
+ index ++;
+ String name = mh.getName().toLowerCase();
+ if( names.contains(name) == match )
+ break;
+ hasNext = index < headers.size();
+ }
+ return hasNext;
+ }
+
+ public Object next()
+ {
+ return mh;
+ }
+
+ public void remove()
+ {
+ headers.remove(index-1);
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/MimeHeaders.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/Name.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/Name.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/Name.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,87 @@
+/*
+* 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 javax.xml.soap;
+
+/** A representation of an XML name. This interface provides methods for
+ getting the local and namespace-qualified names and also for getting the
+ prefix associated with the namespace for the name. It is also possible to get
+ the URI of the namespace.
+
+ The following is an example of a namespace declaration in an element.
+
+ <wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">
+
+ ("xmlns" stands for "XML namespace".) The following shows what the methods in
+ the Name interface will return.
+
+ getQualifiedName will return "prefix:LocalName" = "WOMBAT:GetLastTradePrice"
+ getURI will return "http://www.wombat.org/trader"
+ getLocalName will return "GetLastTracePrice"
+ getPrefix will return "WOMBAT"
+ XML namespaces are used to disambiguate SOAP identifiers from
+ application-specific identifiers.
+ Name objects are created using the method SOAPEnvelope.createName, which has
+ two versions. One method creates Name objects with a local name, a namespace
+ prefix, and a namespace URI. and the second creates Name objects with just a
+ local name. The following line of code, in which se is a SOAPEnvelope object,
+ creates a new Name object with all three.
+
+ Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ "http://www.wombat.org/trader");
+
+ The following line of code gives an example of how a Name object can be used.
+ The variable element is a SOAPElement object. This code creates a new
+ SOAPElement object with the given name and adds it to element.
+
+ element.addChildElement(name);
+
+ @author Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public interface Name
+{
+ /** Gets the local name part of the XML name that this Name object represents.
+ *
+ * @return a string giving the local name
+ */
+ public String getLocalName();
+
+
+ /** Returns the prefix that was specified when this Name object was initialized.
+ * This prefix is associated with the namespace for the XML name that this Name object represents.
+ *
+ * @return the prefix as a string
+ */
+ public String getPrefix();
+
+ /** Gets the namespace-qualified name of the XML name that this Name object represents.
+ *
+ * @return the namespace-qualified name as a string
+ */
+ public String getQualifiedName();
+
+ /** Returns the URI of the namespace for the XML name that this Name object represents.
+ *
+ * @return the URI as a string
+ */
+ public String getURI();
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/Name.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/Node.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/Node.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/Node.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,79 @@
+/*
+* 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 javax.xml.soap;
+
+/** A representation of a node (element) in an XML document. This interface
+ * extnends the standard DOM Node interface with methods for getting and setting
+ * the value of a node, for getting and setting the parent of a node, and for
+ * removing a node
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface Node extends org.w3c.dom.Node
+{
+
+ /**
+ * Removes this Node object from the tree.
+ */
+ public void detachNode();
+
+ /**
+ * Returns the parent element of this Node object.
+ * This method can throw an UnsupportedOperationException if the tree is not kept in memory.
+ * @return the SOAPElement object that is the parent of this Node object or null if this Node object is root
+ */
+ public SOAPElement getParentElement();
+
+ /**
+ * Sets the parent of this Node object to the given SOAPElement object.
+ * @param parent the SOAPElement object to be set as the parent of this Node object
+ * @throws SOAPException if there is a problem in setting the parent to the given element
+ */
+ public void setParentElement(SOAPElement parent) throws SOAPException;
+
+ /**
+ * Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise.
+ * If there is an immediate child of this Node that it is a Text node then it's value will be returned.
+ * If there is more than one Text node then the value of the first Text Node will be returned.
+ * Otherwise null is returned.
+ * @return a String with the text of this node if this is a Text node or the text contained by the first immediate
+ * child of this Node object that is a Text object if such a child exists; null otherwise.
+ */
+ public String getValue();
+
+ /**
+ * If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text)
+ * child of this node. The value of the immediate child of this node can be set only if, there is one child node and
+ * that node is a Text node, or if there are no children in which case a child Text node will be created.
+ * @param value A value string
+ * @throws IllegalStateException if the node is not a Text node and either has more than one child node or has a child node that is not a Text node.
+ */
+ public void setValue(String value);
+
+ /**
+ * Notifies the implementation that this Node object is no longer being used by the application and that the
+ * implementation is free to reuse this object for nodes that may be created later.
+ * Calling the method recycleNode implies that the method detachNode has been called previously.
+ */
+ public void recycleNode();
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/Node.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBody.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBody.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBody.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,112 @@
+/*
+* 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 javax.xml.soap;
+
+import org.w3c.dom.Document;
+
+import java.util.Locale;
+
+/** An object that represents the contents of the SOAP body element in a SOAP
+ * message. A SOAP body element consists of XML data that affects the way the
+ * application-specific content is processed.
+ *
+ * A SOAPBody object contains SOAPBodyElement objects, which have the content
+ * for the SOAP body. A SOAPFault object, which carries status and/or error
+ * information, is an example of a SOAPBodyElement object.
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPBody
+ extends SOAPElement
+{
+ /** Creates a new SOAPBodyElement object with the specified name and adds it to this SOAPBody object.
+ *
+ * @param name a Name object with the name for the new SOAPBodyElement object
+ * @return the new SOAPBodyElement object
+ * @throws SOAPException if a SOAP error occurs
+ */
+ public abstract SOAPBodyElement addBodyElement(Name name) throws SOAPException;
+
+ /** Adds the root node of the DOM Document to this SOAPBody object.
+ *
+ * Calling this method invalidates the document parameter.
+ * The client application should discard all references to this Document and its contents upon calling addDocument.
+ * The behavior of an application that continues to use such references is undefined.
+ *
+ * @param doc the Document object whose root node will be added to this SOAPBody.
+ * @return the SOAPBodyElement that represents the root node that was added.
+ * @throws SOAPException if the Document cannot be added
+ */
+ public abstract SOAPBodyElement addDocument(Document doc) throws SOAPException;
+
+ /** Creates a new SOAPFault object and adds it to this SOAPBody object.
+ *
+ * The new SOAPFault will have default values set for the mandatory child elements faultcode and faultstring.
+ * A SOAPBody may contain at most one SOAPFault child element
+ *
+ * @return the new SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPFault addFault() throws SOAPException;
+
+ /** Creates a new SOAPFault object and adds it to this SOAPBody object.
+ *
+ * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring
+ * set to faultString.
+ *
+ * A SOAPBody may contain at most one SOAPFault child element
+ *
+ * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
+ * @param faultString a String giving an explanation of the fault
+ * @return the new SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPFault addFault(Name faultCode, String faultString) throws SOAPException;
+
+ /** Creates a new SOAPFault object and adds it to this SOAPBody object.
+ *
+ * The new SOAPFault will have a faultcode element that is set to the faultCode parameter and a faultstring
+ * set to faultString and localized to locale.
+ *
+ * A SOAPBody may contain at most one SOAPFault child element
+ *
+ * @param faultCode a Name object giving the fault code to be set; must be one of the fault codes defined in the SOAP 1.1 specification and of type QName
+ * @param faultString a String giving an explanation of the fault
+ * @param locale a Locale object indicating the native language of the faultString
+ * @return the new SOAPFault object
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPFault addFault(Name faultCode, String faultString, Locale locale) throws SOAPException;
+
+ /** Returns the SOAPFault object in this SOAPBody object.
+ *
+ * @return the SOAPFault object in this SOAPBody object
+ */
+ public abstract SOAPFault getFault();
+
+ /** Indicates whether a SOAPFault object exists in this SOAPBody object.
+ *
+ * @return true if a SOAPFault object exists in this SOAPBody object; false otherwise
+ */
+ public abstract boolean hasFault();
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBody.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBodyElement.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBodyElement.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBodyElement.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -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 javax.xml.soap;
+
+/** A SOAPBodyElement object represents the contents in a SOAPBody object.
+ * The SOAPFault interface is a SOAPBodyElement object that has been defined.
+ *
+ * A new SOAPBodyElement object can be created and added to a SOAPBody object
+ * with the SOAPBody method addBodyElement. In the following line of code, sb
+ * is a SOAPBody object, and myName is a Name object.
+
+ SOAPBodyElement sbe = sb.addBodyElement(myName);
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPBodyElement
+ extends SOAPElement
+{
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPBodyElement.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnection.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnection.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnection.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,62 @@
+/*
+* 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 javax.xml.soap;
+
+/** A point-to-point connection that a client can use for sending messages directly to a remote
+ * party (represented by a URL, for instance).
+ *
+ * The SOAPConnection class is optional. Some implementations may not implement this interface in which case the call
+ * to SOAPConnectionFactory.newInstance() (see below) will throw an UnsupportedOperationException.
+ *
+ * A client can obtain a SOAPConnection object using a SOAPConnectionFactory object as in the following example:
+ *
+ * SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
+ * SOAPConnection con = factory.createConnection();
+ *
+ * A SOAPConnection object can be used to send messages directly to a URL following the request/response paradigm.
+ * That is, messages are sent using the method call, which sends the message and then waits until it gets a reply.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class SOAPConnection
+{
+ public SOAPConnection()
+ {
+ }
+
+ /** Sends the given message to the specified endpoint and blocks until it has returned the response.
+ *
+ * @param request the SOAPMessage object to be sent
+ * @param to an Object that identifies where the message should be sent.
+ * It is required to support Objects of type java.lang.String, java.net.URL, and when JAXM is present javax.xml.messaging.URLEndpoint
+ * @return the SOAPMessage object that is the response to the message that was sent
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPMessage call(SOAPMessage request, Object to) throws SOAPException;
+
+ /** Closes this SOAPConnection object.
+ *
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract void close() throws SOAPException;
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnection.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnectionFactory.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnectionFactory.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,117 @@
+/*
+* 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 javax.xml.soap;
+
+import org.jboss.logging.Logger;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** A factory for creating SOAPConnection objects. Implementation of this class
+ * is optional. If SOAPConnectionFactory.newInstance() throws an
+ * UnsupportedOperationException then the implementation does not support the
+ * SAAJ communication infrastructure. Otherwise SOAPConnection objects can be
+ * created by calling createConnection() on the newly created
+ * SOAPConnectionFactory object.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author Thomas.Diesler at jboss.org
+ * @version $Revision$
+ */
+public abstract class SOAPConnectionFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPConnectionFactory.class);
+
+ private static final String DEFAULT_SOAP_CONNECTION_FACTORY = "org.jboss.ws.soap.SOAPConnectionFactoryImpl";
+ private static final String[] alternativeFactories = new String[]{
+ "org.jboss.webservice.soap.SOAPConnectionFactoryImpl",
+ "org.jboss.axis.soap.SOAPConnectionFactoryImpl"
+ };
+
+ /** Creates an instance of the default SOAPConnectionFactory object.
+ *
+ * @return
+ * @throws SOAPException
+ * @throws UnsupportedOperationException
+ */
+ public static SOAPConnectionFactory newInstance() throws SOAPException, UnsupportedOperationException
+ {
+ PrivilegedAction action = new PropertyAccessAction(SOAPConnectionFactory.class.getName(), DEFAULT_SOAP_CONNECTION_FACTORY);
+ String factoryName = (String)AccessController.doPrivileged(action);
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (SOAPConnectionFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Throw the exception if the user asked for a specific factory
+ if (factoryName.equals(DEFAULT_SOAP_CONNECTION_FACTORY) == false)
+ throw e;
+
+ for (int i = 0; i < alternativeFactories.length; i++)
+ {
+ factoryName = alternativeFactories[i];
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (SOAPConnectionFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e1)
+ {
+ log.debug("Cannot load factory: " + factoryName);
+ }
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new SOAPException("Failed to create SOAPConnectionFactory: " + factoryName, t);
+ }
+
+ throw new SOAPException("Cannot find SOAPConnectionFactory implementation");
+ }
+
+ public abstract SOAPConnection createConnection() throws SOAPException;
+
+ private static class PropertyAccessAction implements PrivilegedAction
+ {
+ private String name;
+ private String defaultValue;
+
+ PropertyAccessAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConnectionFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConstants.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConstants.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConstants.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package javax.xml.soap;
+
+
+/** The definition of constants pertaining to the SOAP 1.1 protocol.
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPConstants
+{
+ public static final String URI_NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";
+ public static final String URI_NS_SOAP_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/";
+ public static final String URI_SOAP_ACTOR_NEXT = "http://schemas.xmlsoap.org/soap/actor/next";
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPConstants.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElement.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElement.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElement.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,228 @@
+/*
+* 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 javax.xml.soap;
+
+import java.util.Iterator;
+
+import org.w3c.dom.Element;
+
+/** An object representing an element of a SOAP message that is allowed but not
+ * specifically prescribed by a SOAP specification. This interface serves as the
+ * base interface for those objects that are specifically prescribed by a SOAP
+ * specification.
+ *
+ * Methods in this interface that are required to return SAAJ specific objects
+ * may "silently" replace nodes in the tree as required to successfully return
+ * objects of the correct type. See getChildElements() and javax.xml.soap for
+ * details.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPElement extends Node, Element
+{
+ /** Adds an attribute with the specified name and value to this SOAPElement object.
+ *
+ * @param name a Name object with the name of the attribute
+ * @param value a String giving the value of the attribute
+ * @return the SOAPElement object into which the attribute was inserted
+ * @throws SOAPException if there is an error in creating the Attribute
+ */
+ public abstract SOAPElement addAttribute(Name name, String value) throws SOAPException;
+
+ /** Creates a new SOAPElement object initialized with the specified local name and adds the new element to this SOAPElement object.
+ *
+ * @param name a String giving the local name for the element
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement addChildElement(String name) throws SOAPException;
+
+ /** Creates a new SOAPElement object initialized with the specified local name and prefix and adds the new element to this SOAPElement object.
+ *
+ * @param localName a String giving the local name for the new element
+ * @param prefix a String giving the namespace prefix for the new element
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement addChildElement(String localName, String prefix) throws SOAPException;
+
+ /** Creates a new SOAPElement object initialized with the specified local name, prefix, and URI and adds the new element to this SOAPElement object.
+ *
+ * @param localName a String giving the local name for the new element
+ * @param prefix a String giving the namespace prefix for the new element
+ * @param uri a String giving the URI of the namespace to which the new element belongs
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException;
+
+ /** Creates a new SOAPElement object initialized with the given Name object and adds the new element to this SOAPElement object.
+ *
+ * @param name a Name object with the XML name for the new element
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement addChildElement(Name name) throws SOAPException;
+
+ /** Add a SOAPElement as a child of this SOAPElement instance. The SOAPElement is expected to be created by a SOAPElementFactory.
+ *
+ * Callers should not rely on the element instance being added as is into the XML tree.
+ * Implementations could end up copying the content of the SOAPElement passed into an instance of a different SOAPElement
+ * implementation. For instance if addChildElement() is called on a SOAPHeader, element will be copied into an instance of a SOAPHeaderElement.
+ *
+ * The fragment rooted in element is either added as a whole or not at all, if there was an error.
+ *
+ * The fragment rooted in element cannot contain elements named "Envelope", "Header" or "Body" and in the SOAP namespace.
+ * Any namespace prefixes present in the fragment should be fully resolved using appropriate namespace declarations within the fragment itself.
+ *
+ * @param child the SOAPElement to be added as a new child
+ * @return an instance representing the new SOAP element that was actually added to the tree.
+ * @throws SOAPException if there was an error in adding this element as a child
+ */
+ public abstract SOAPElement addChildElement(SOAPElement child) throws SOAPException;
+
+ /** Adds a namespace declaration with the specified prefix and URI to this SOAPElement object.
+ *
+ * @param prefix a String giving the prefix of the namespace
+ * @param uri a String giving the uri of the namespace
+ * @return the SOAPElement object into which this namespace declaration was inserted.
+ * @throws SOAPException if there is an error in creating the namespace
+ */
+ public abstract SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException;
+
+ /** Creates a new Text object initialized with the given String and adds it to this SOAPElement object.
+ *
+ * @param text a String object with the textual content to be added
+ * @return the SOAPElement object into which the new Text object was inserted
+ * @throws SOAPException if there is an error in creating the new Text object
+ */
+ public abstract SOAPElement addTextNode(String text) throws SOAPException;
+
+ /** Returns an Iterator over all of the attribute Name objects in this SOAPElement object.
+ *
+ * The iterator can be used to get the attribute names, which can then be passed to the method getAttributeValue to
+ * retrieve the value of each attribute.
+ *
+ * @return an iterator over the names of the attributes
+ */
+ public abstract Iterator getAllAttributes();
+
+ /** Returns the value of the attribute with the specified name.
+ *
+ * @param name a Name object with the name of the attribute
+ * @return a String giving the value of the specified attribute
+ */
+ public abstract String getAttributeValue(Name name);
+
+ /** Returns an Iterator over all the immediate child Nodes of this element.
+ *
+ * This includes javax.xml.soap.Text objects as well as SOAPElement objects.
+ * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement,
+ * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node.
+ * As a result the calling application must treat any existing references to these child nodes that have been obtained
+ * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator.
+ * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details.
+ *
+ * @return an iterator with the content of this SOAPElement object
+ */
+ public abstract Iterator getChildElements();
+
+ /** Returns an Iterator over all the immediate child Nodes of this element with the specified name.
+ *
+ * All of these children will be SOAPElement nodes.
+ * Calling this method may cause child Element, SOAPElement and org.w3c.dom.Text nodes to be replaced by SOAPElement,
+ * SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text nodes as appropriate for the type of this parent node.
+ * As a result the calling application must treat any existing references to these child nodes that have been obtained
+ * through DOM APIs as invalid and either discard them or refresh them with the values returned by this Iterator.
+ * This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details.
+ *
+ * @param name a Name object with the name of the child elements to be returned
+ * @return an Iterator object over all the elements in this SOAPElement object with the specified name
+ */
+ public abstract Iterator getChildElements(Name name);
+
+ /** Returns the name of this SOAPElement object.
+ *
+ * @return a Name object with the name of this SOAPElement object
+ */
+ public abstract Name getElementName();
+
+ /** Returns the encoding style for this SOAPElement object.
+ *
+ * @return a String giving the encoding style
+ */
+ public abstract String getEncodingStyle();
+
+ /** Returns an Iterator over the namespace prefix Strings declared by this element.
+ *
+ * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes in this SOAPElement object
+ */
+ public abstract Iterator getNamespacePrefixes();
+
+ /** Returns the URI of the namespace that has the given prefix.
+ *
+ * @param prefix a String giving the prefix of the namespace for which to search
+ * @return a String with the uri of the namespace that has the given prefix
+ */
+ public abstract String getNamespaceURI(String prefix);
+
+ /** Returns an Iterator over the namespace prefix Strings visible to this element.
+ *
+ * The prefixes returned by this iterator can be passed to the method getNamespaceURI to retrieve the URI of each namespace.
+ *
+ * @return an iterator over the namespace prefixes are within scope of this SOAPElement object
+ */
+ public abstract Iterator getVisibleNamespacePrefixes();
+
+ /** Removes the attribute with the specified name.
+ *
+ * @param name the Name object with the name of the attribute to be removed
+ * @return true if the attribute was removed successfully; false if it was not
+ */
+ public abstract boolean removeAttribute(Name name);
+
+ /** Detaches all children of this SOAPElement.
+ *
+ * This method is useful for rolling back the construction of partially completed SOAPHeaders and SOAPBodys in
+ * preparation for sending a fault when an error condition is detected.
+ * It is also useful for recycling portions of a document within a SOAP message.
+ */
+ public abstract void removeContents();
+
+ /** Removes the namespace declaration corresponding to the given prefix.
+ *
+ * @param prefix a String giving the prefix for which to search
+ * @return true if the namespace declaration was removed successfully; false if it was not
+ */
+ public abstract boolean removeNamespaceDeclaration(String prefix);
+
+ /** Sets the encoding style for this SOAPElement object to one specified.
+ *
+ * @param encodingStyle a String giving the encoding style
+ * @throws SOAPException if there was a problem in the encoding style being set.
+ */
+ public abstract void setEncodingStyle(String encodingStyle) throws SOAPException;
+
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElement.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElementFactory.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElementFactory.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElementFactory.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,86 @@
+/*
+* 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 javax.xml.soap;
+
+/** SOAPElementFactory is a factory for XML fragments that will eventually end
+ * up in the SOAP part. These fragments can be inserted as children of the
+ * SOAPHeader or SOAPBody or SOAPEnvelope.
+ *
+ * Elements created using this factory do not have the properties of an element
+ * that lives inside a SOAP header document. These elements are copied into the
+ * XML document tree when they are inserted.
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class SOAPElementFactory
+{
+ private SOAPFactory soapFactory;
+
+ /**
+ *
+ * @return
+ * @throws SOAPException
+ */
+ public static SOAPElementFactory newInstance() throws SOAPException
+ {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ return new SOAPElementFactory(factory);
+ }
+ /**
+ * @deprecated Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
+ * @return
+ * @throws SOAPException
+ */
+ public SOAPElement create(String localName) throws SOAPException
+ {
+ return soapFactory.createElement(localName);
+ }
+ /**
+ * @deprecated Use javax.xml.soap.SOAPFactory.createElement(String localName, String prefix, String uri) instead
+ * @param localName
+ * @param prefix
+ * @param uri
+ * @return
+ * @throws SOAPException
+ */
+ public SOAPElement create(String localName, String prefix, String uri)
+ throws SOAPException
+ {
+ return soapFactory.createElement(localName, prefix, uri);
+ }
+ /**
+ * @deprecated Use javax.xml.soap.SOAPFactory.createElement(javax.xml.soap.Name)
+ * @param name
+ * @return
+ * @throws SOAPException
+ */
+ public SOAPElement create(Name name) throws SOAPException
+ {
+ return soapFactory.createElement(name);
+ }
+
+ private SOAPElementFactory(SOAPFactory soapFactory)
+ {
+ this.soapFactory = soapFactory;
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPElementFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPEnvelope.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPEnvelope.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPEnvelope.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,61 @@
+/*
+* 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 javax.xml.soap;
+
+/** The container for the SOAPHeader and SOAPBody portions of a SOAPPart object. By default, a SOAPMessage object is created with a SOAPPart object that has a SOAPEnvelope object. The SOAPEnvelope object by default has an empty SOAPBody object and an empty SOAPHeader object. The SOAPBody object is required, and the SOAPHeader object, though optional, is used in the majority of cases. If the SOAPHeader object is not needed, it can be deleted, which is shown later.
+A client can access the SOAPHeader and SOAPBody objects by calling the methods SOAPEnvelope.getHeader and SOAPEnvelope.getBody. The following lines of code use these two methods after starting with the SOAPMessage object message to get the SOAPPart object sp, which is then used to get the SOAPEnvelope object se.
+ SOAPPart sp = message.getSOAPPart();
+ SOAPEnvelope se = sp.getEnvelope();
+ SOAPHeader sh = se.getHeader();
+ SOAPBody sb = se.getBody();
+
+It is possible to change the body or header of a SOAPEnvelope object by retrieving the current one, deleting it, and then adding a new body or header. The javax.xml.soap.Node method deleteNode deletes the XML element (node) on which it is called. For example, the following line of code deletes the SOAPBody object that is retrieved by the method getBody.
+ se.getBody().detachNode();
+
+To create a SOAPHeader object to replace the one that was removed, a client uses the method SOAPEnvelope.addHeader, which creates a new header and adds it to the SOAPEnvelope object. Similarly, the method addBody creates a new SOAPBody object and adds it to the SOAPEnvelope object. The following code fragment retrieves the current header, removes it, and adds a new one. Then it retrieves the current body, removes it, and adds a new one.
+ SOAPPart sp = message.getSOAPPart();
+ SOAPEnvelope se = sp.getEnvelope();
+ se.getHeader().detachNode();
+ SOAPHeader sh = se.addHeader();
+ se.getBody().detachNode();
+ SOAPBody sb = se.addBody();
+
+It is an error to add a SOAPBody or SOAPHeader object if one already exists.
+The SOAPEnvelope interface provides three methods for creating Name objects. One method creates Name objects with a local name, a namespace prefix, and a namesapce URI. The second method creates Name objects with a local name and a namespace prefix, and the third creates Name objects with just a local name. The following line of code, in which se is a SOAPEnvelope object, creates a new Name object with all three.
+ Name name = se.createName("GetLastTradePrice", "WOMBAT",
+ "http://www.wombat.org/trader");
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPEnvelope
+ extends SOAPElement
+{
+ public abstract SOAPBody addBody() throws SOAPException;
+ public abstract SOAPHeader addHeader() throws SOAPException;
+ public abstract Name createName(String localName) throws SOAPException;
+ public abstract Name createName(String localName, String prefix, String uri)
+ throws SOAPException;
+ public abstract SOAPBody getBody() throws SOAPException;
+ public abstract SOAPHeader getHeader() throws SOAPException;
+
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPEnvelope.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPException.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPException.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPException.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,61 @@
+/*
+* 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 javax.xml.soap;
+
+import org.jboss.util.id.SerialVersion;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class SOAPException
+ extends Exception
+{
+ /** @since 4.0.2 */
+ static final long serialVersionUID;
+ static
+ {
+ if (SerialVersion.version == SerialVersion.LEGACY)
+ serialVersionUID = -4385552115225336830L;
+ else
+ serialVersionUID = 5083961510786058130L;
+ }
+
+ public SOAPException()
+ {
+ }
+
+ public SOAPException(String message)
+ {
+ super(message);
+ }
+
+ public SOAPException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public SOAPException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPException.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFactory.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFactory.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,171 @@
+/*
+* 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 javax.xml.soap;
+
+// $Id$
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.jboss.logging.Logger;
+
+/** SOAPFactory is a factory for creating various objects that exist in the SOAP XML tree.
+ *
+ * SOAPFactory can be used to create XML fragments that will eventually end up in the SOAP part.
+ * These fragments can be inserted as children of the SOAPHeaderElement or SOAPBodyElement or
+ * SOAPEnvelope or other SOAPElement objects.
+ *
+ * SOAPFactory also has methods to create javax.xml.soap.Detail objects as well as java.xml.soap.Name objects.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class SOAPFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPFactory.class);
+
+ private static final String DEFAULT_SOAP_FACTORY = "org.jboss.ws.soap.SOAPFactoryImpl";
+ private static final String[] alternativeFactories = new String[]{
+ "org.jboss.axis.soap.SOAPFactoryImpl"
+ };
+
+ /** Creates a new instance of SOAPFactory.
+ *
+ * @return a new instance of a SOAPFactory
+ * @throws SOAPException if there was an error creating the default SOAPFactory
+ */
+ public static SOAPFactory newInstance() throws SOAPException
+ {
+ PrivilegedAction action = new PropertyAccessAction(SOAPFactory.class.getName(), DEFAULT_SOAP_FACTORY);
+ String factoryName = (String)AccessController.doPrivileged(action);
+
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (SOAPFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Throw the exception if the user asked for a specific factory
+ if (factoryName.equals(DEFAULT_SOAP_FACTORY) == false)
+ throw e;
+
+ for (int i = 0; i < alternativeFactories.length; i++)
+ {
+ factoryName = alternativeFactories[i];
+ try
+ {
+ Class factoryClass = loader.loadClass(factoryName);
+ return (SOAPFactory)factoryClass.newInstance();
+ }
+ catch (ClassNotFoundException e1)
+ {
+ log.debug("Cannot load factory: " + factoryName);
+ }
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ throw new SOAPException("Failed to create SOAPFactory: " + factoryName, t);
+ }
+
+ throw new SOAPException("Cannot find SOAPFactory implementation");
+ }
+
+ /** Creates a new Detail object which serves as a container for DetailEntry objects.
+ *
+ * This factory method creates Detail objects for use in situations where it is not practical to use the SOAPFault abstraction.
+ *
+ * @return a Detail object
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Detail createDetail() throws SOAPException;
+
+ /** Create a SOAPElement object initialized with the given local name.
+ *
+ * @param localName a String giving the local name for the new element
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement createElement(String localName) throws SOAPException;
+
+ /** Create a new SOAPElement object with the given local name, prefix and uri.
+ *
+ * @param localName a String giving the local name for the new element
+ * @param prefix the prefix for this SOAPElement
+ * @param uri a String giving the URI of the namespace to which the new element belongs
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement createElement(String localName, String prefix, String uri) throws SOAPException;
+
+ /** Create a SOAPElement object initialized with the given Name object.
+ *
+ * @param name a Name object with the XML name for the new element
+ * @return the new SOAPElement object that was created
+ * @throws SOAPException if there is an error in creating the SOAPElement object
+ */
+ public abstract SOAPElement createElement(Name name) throws SOAPException;
+
+ /** Creates a new Name object initialized with the given local name.
+ *
+ * This factory method creates Name objects for use in situations where it is not practical to use the
+ * SOAPEnvelope abstraction.
+ * @return
+ * @throws SOAPException
+ */
+ public abstract Name createName(String localName) throws SOAPException;
+
+ /** Creates a new Name object initialized with the given local name, namespace prefix, and namespace URI.
+ *
+ * This factory method creates Name objects for use in situations where it is not practical to use the SOAPEnvelope abstraction.
+ *
+ * @param localName a String giving the local name
+ * @param prefix a String giving the prefix of the namespace
+ * @param uri a String giving the URI of the namespace
+ * @return a Name object initialized with the given local name, namespace prefix, and namespace URI
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract Name createName(String localName, String prefix, String uri) throws SOAPException;
+
+ private static class PropertyAccessAction implements PrivilegedAction
+ {
+ private String name;
+ private String defaultValue;
+
+ PropertyAccessAction(String name, String defaultValue)
+ {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFactory.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFault.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFault.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFault.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,163 @@
+/*
+* 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 javax.xml.soap;
+
+import java.util.Locale;
+
+/** An element in the SOAPBody object that contains error and/or status
+ * information. This information may relate to errors in the SOAPMessage
+ * object or to problems that are not related to the content in the message
+ * itself. Problems not related to the message itself are generally errors in
+ * processing, such as the inability to communicate with an upstream server.
+ *
+ * The SOAPFault interface provides methods for retrieving the information
+ * contained in a SOAPFault object and for setting the fault code, the fault
+ * actor, and a string describing the fault. A fault code is one of the codes
+ * defined in the SOAP 1.1 specification that describe the fault. An actor is
+ * an intermediate recipient to whom a message was routed. The message path may
+ * include one or more actors, or, if no actors are specified, the message goes
+ * only to the default actor, which is the final intended recipient.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPFault extends SOAPBodyElement
+{
+ /**
+ * Creates an optional Detail object and sets it as the Detail object for this SOAPFault object.
+ *
+ * It is illegal to add a detail when the fault already contains a detail.
+ * Therefore, this method should be called only after the existing detail has been removed.
+ * @return the new Detail object
+ * @throws SOAPException if this SOAPFault object already contains a valid Detail object
+ */
+ public Detail addDetail() throws SOAPException;
+
+ /**
+ * Returns the optional detail element for this SOAPFault object.
+ *
+ * A Detail object carries application-specific error information related to SOAPBodyElement objects.
+ *
+ * @return a Detail object with application-specific error information
+ */
+ public Detail getDetail();
+
+ /**
+ * Gets the fault actor for this SOAPFault object.
+ * @return a String giving the actor in the message path that caused this SOAPFault object
+ */
+ public String getFaultActor();
+
+ /**
+ * Gets the fault code for this SOAPFault object.
+ * @return a String with the fault code
+ */
+ public String getFaultCode();
+
+ /**
+ * Gets the mandatory SOAP 1.1 fault code for this SOAPFault object as a SAAJ Name object.
+ * The SOAP 1.1 specification requires the value of the "faultcode" element to be of type QName.
+ * This method returns the content of the element as a QName in the form of a SAAJ Name object.
+ * This method should be used instead of the getFaultCode method since it allows applications to
+ * easily access the namespace name without additional parsing.
+ *
+ * In the future, a QName object version of this method may also be added.
+ *
+ * @return a Name representing the faultcode
+ */
+ public Name getFaultCodeAsName();
+
+ /**
+ * Gets the fault string for this SOAPFault object.
+ * @return a String giving an explanation of the fault
+ */
+ public String getFaultString();
+
+ /**
+ * Gets the locale of the fault string for this SOAPFault object.
+ * @return a Locale object indicating the native language of the fault string or null if no locale was specified
+ */
+ public Locale getFaultStringLocale();
+
+ /**
+ * Sets this SOAPFault object with the given fault actor.
+ *
+ * The fault actor is the recipient in the message path who caused the fault to happen.
+ *
+ * @param faultActor a String identifying the actor that caused this SOAPFault object
+ * @throws SOAPException if there was an error in adding the faultActor to the underlying XML tree.
+ */
+ public void setFaultActor(String faultActor) throws SOAPException;
+
+ /**
+ * Sets this SOAPFault object with the give fault code.
+ *
+ * Fault codes, which given information about the fault, are defined in the SOAP 1.1 specification.
+ * This element is mandatory in SOAP 1.1. Because the fault code is required to be a QName
+ * it is preferable to use the setFaultCode(Name) form of this method.
+ *
+ * @param faultCode a String giving the fault code to be set.
+ * It must be of the form "prefix:localName" where the prefix has been defined in a namespace declaration.
+ * @throws SOAPException if there was an error in adding the faultCode to the underlying XML tree.
+ */
+ public void setFaultCode(String faultCode) throws SOAPException;
+
+ /**
+ * Sets this SOAPFault object with the given fault code.
+ *
+ * Fault codes, which give information about the fault, are defined in the SOAP 1.1 specification.
+ * A fault code is mandatory and must be of type QName. This method provides a convenient way to set a fault code.
+ * For example,
+ *
+ * SOAPEnvelope se = ...;
+ * //Create a qualified name in the SOAP namespace with a localName
+ * // of "Client". Note that prefix parameter is optional and is null
+ * // here which causes the implementation to use an appropriate prefix.
+ * Name qname = se.createName("Client", null, SOAPConstants.URI_NS_SOAP_ENVELOPE);
+ * SOAPFault fault = ...;
+ * fault.setFaultCode(qname);
+ *
+ * It is preferable to use this method over setFaultCode(String).
+ *
+ * @param faultCodeQName a Name object giving the fault code to be set. It must be namespace qualified.
+ * @throws SOAPException if there was an error in adding the faultcode element to the underlying XML tree.
+ */
+ public void setFaultCode(Name faultCodeQName) throws SOAPException;
+
+ /**
+ * Sets the fault string for this SOAPFault object to the given string.
+ *
+ * @param faultString a String giving an explanation of the fault
+ * @throws SOAPException if there was an error in adding the faultString to the underlying XML tree.
+ */
+ public void setFaultString(String faultString) throws SOAPException;
+
+
+ /**
+ * Sets the fault string for this SOAPFault object to the given string and localized to the given locale.
+ *
+ * @param faultString a String giving an explanation of the fault
+ * @param locale a Locale object indicating the native language of the faultString
+ * @throws SOAPException
+ */
+ public void setFaultString(String faultString, Locale locale) throws SOAPException;
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFault.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFaultElement.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFaultElement.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFaultElement.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,36 @@
+/*
+* 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 javax.xml.soap;
+
+/** A representation of the contents in a SOAPFault object. The Detail
+ * interface is a SOAPFaultElement.
+ *
+ * Content is added to a SOAPFaultElement using the SOAPElement method
+ * addTextNode.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPFaultElement
+ extends SOAPElement
+{
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPFaultElement.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeader.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeader.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeader.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,116 @@
+/*
+* 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 javax.xml.soap;
+
+import java.util.Iterator;
+
+/**
+ * A representation of the SOAP header element. A SOAP header element consists
+ * of XML data that affects the way the application-specific content is
+ * processed by the message provider. For example, transaction semantics,
+ * authentication information, and so on, can be specified as the content of a
+ * SOAPHeader object.
+ *
+ * A SOAPEnvelope object contains an empty SOAPHeader object by default. If the
+ * SOAPHeader object, which is optional, is not needed, it can be retrieved and
+ * deleted with the following line of code. The variable se is a SOAPEnvelope
+ * object.
+ *
+ * se.getHeader().detachNode();
+ *
+ * A SOAPHeader object is created with the SOAPEnvelope method addHeader.
+ * This method, which creates a new header and adds it to the envelope, may be
+ * called only after the existing header has been removed.
+ *
+ * se.getHeader().detachNode();
+ * SOAPHeader sh = se.addHeader();
+ *
+ * A SOAPHeader object can have only SOAPHeaderElement objects as its
+ * immediate children. The method addHeaderElement creates a new HeaderElement
+ * object and adds it to the SOAPHeader object. In the following line of code,
+ * the argument to the method addHeaderElement is a Name object that is the
+ * name for the new HeaderElement object.
+ *
+ * SOAPHeaderElement shElement = sh.addHeaderElement(name);
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPHeader extends SOAPElement
+{
+ /**
+ * Creates a new SOAPHeaderElement object initialized with the specified name and adds it to this SOAPHeader object.
+ *
+ * @param name a Name object with the name of the new SOAPHeaderElement object
+ * @return the new SOAPHeaderElement object that was inserted into this SOAPHeader object
+ * @throws SOAPException if a SOAP error occurs
+ */
+ public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException;
+
+ /**
+ * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object.
+ *
+ * @return an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader
+ */
+ public Iterator examineAllHeaderElements();
+
+ /**
+ * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor.
+ * An actor is a global attribute that indicates the intermediate parties that should process a message before it
+ * reaches its ultimate receiver. An actor receives the message and processes it before sending it on to the next actor.
+ * The default actor is the ultimate intended recipient for the message, so if no actor attribute is included in a
+ * SOAPHeader object, it is sent to the ultimate receiver along with the message body.
+ *
+ * @param actor a String giving the URI of the actor for which to search
+ * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand
+ */
+ public Iterator examineHeaderElements(String actor);
+
+ /**
+ * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified
+ * actor and that have a MustUnderstand attribute whose value is equivalent to true.
+ *
+ * @param actor a String giving the URI of the actor for which to search
+ * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand
+ */
+ public Iterator examineMustUnderstandHeaderElements(String actor);
+
+ /**
+ * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object and detaches
+ * them from this SOAPHeader object.
+ *
+ * @return an Iterator object over all the SOAPHeaderElement objects contained by this SOAPHeader
+ */
+ public Iterator extractAllHeaderElements();
+
+ /**
+ * Returns an Iterator over all the SOAPHeaderElement objects in this SOAPHeader object that have the specified actor
+ * and detaches them from this SOAPHeader object.
+ *
+ * This method allows an actor to process the parts of the SOAPHeader object that apply to it and to remove them
+ * before passing the message on to the next actor.
+ *
+ * @param actor a String giving the URI of the actor for which to search
+ * @return an Iterator object over all the SOAPHeaderElement objects that contain the specified actor and are marked as MustUnderstand
+ */
+ public Iterator extractHeaderElements(String actor);
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeader.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeaderElement.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeaderElement.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,64 @@
+/*
+* 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 javax.xml.soap;
+
+/** An object representing the contents in the SOAP header part of the SOAP
+ * envelope. The immediate children of a SOAPHeader object can be represented
+ * only as SOAPHeaderElement objects.
+ *
+ * A SOAPHeaderElement object can have other SOAPElement objects as its children.
+
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface SOAPHeaderElement
+ extends SOAPElement
+{
+ /** Returns the uri of the actor associated with this SOAPHeaderElement object.
+ *
+ * @return a String giving the URI of the actor
+ */
+ public String getActor();
+
+ /** Returns whether the mustUnderstand attribute for this SOAPHeaderElement object is turned on.
+ *
+ * @return true if the mustUnderstand attribute of this SOAPHeaderElement object is turned on; false otherwise
+ */
+ public boolean getMustUnderstand();
+
+ /** Sets the actor associated with this SOAPHeaderElement object to the specified actor.
+ * The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT
+ *
+ * @param actorURI a String giving the URI of the actor to set
+ */
+ public void setActor(String actorURI);
+
+ /** Sets the mustUnderstand attribute for this SOAPHeaderElement object to be on or off.
+ *
+ * If the mustUnderstand attribute is on, the actor who receives the SOAPHeaderElement must process it correctly.
+ * This ensures, for example, that if the SOAPHeaderElement object modifies the message,
+ * that the message is being modified correctly.
+ *
+ * @param mustUnderstand true to set the mustUnderstand attribute on; false to turn if off
+ */
+ public void setMustUnderstand(boolean mustUnderstand);
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPHeaderElement.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPMessage.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPMessage.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPMessage.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,292 @@
+/*
+* 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 javax.xml.soap;
+
+import javax.activation.DataHandler;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/** The root class for all SOAP messages. As transmitted on the "wire", a SOAP message is an XML document or a
+ * MIME message whose first body part is an XML/SOAP document.
+ *
+ * A SOAPMessage object consists of a SOAP part and optionally one or more attachment parts.
+ * The SOAP part for a SOAPMessage object is a SOAPPart object, which contains information used for message routing and
+ * identification, and which can contain application-specific content. All data in the SOAP Part of a message must be in XML format.
+ *
+ * A new SOAPMessage object contains the following by default:
+ *
+ * A SOAPPart object
+ * A SOAPEnvelope object
+ * A SOAPBody object
+ * A SOAPHeader object
+ *
+ * The SOAP part of a message can be retrieved by calling the method SOAPMessage.getSOAPPart().
+ * The SOAPEnvelope object is retrieved from the SOAPPart object, and the SOAPEnvelope object is used to retrieve the
+ * SOAPBody and SOAPHeader objects.
+ *
+ * SOAPPart sp = message.getSOAPPart();
+ * SOAPEnvelope se = sp.getEnvelope();
+ * SOAPBody sb = se.getBody();
+ * SOAPHeader sh = se.getHeader();
+ *
+ * In addition to the mandatory SOAPPart object, a SOAPMessage object may contain zero or more AttachmentPart objects,
+ * each of which contains application-specific data. The SOAPMessage interface provides methods for creating AttachmentPart
+ * objects and also for adding them to a SOAPMessage object. A party that has received a SOAPMessage object can examine
+ * its contents by retrieving individual attachment parts.
+ *
+ * Unlike the rest of a SOAP message, an attachment is not required to be in XML format and can therefore be anything from
+ * simple text to an image file. Consequently, any message content that is not in XML format must be in an AttachmentPart object.
+ *
+ * A MessageFactory object may create SOAPMessage objects with behavior that is specialized to a particular
+ * implementation or application of SAAJ. For instance, a MessageFactory object may produce SOAPMessage objects that
+ * conform to a particular Profile such as ebXML. In this case a MessageFactory object might produce SOAPMessage
+ * objects that are initialized with ebXML headers.
+ *
+ * In order to ensure backward source compatibility, methods that are added to this class after version 1.1 of the SAAJ
+ * specification are all concrete instead of abstract and they all have default implementations.
+ * Unless otherwise noted in the JavaDocs for those methods the default implementations simply throw an
+ * UnsupportedOperationException and the SAAJ implementation code must override them with methods that provide
+ * the specified behavior. Legacy client code does not have this restriction, however, so long as there is no claim
+ * made that it conforms to some later version of the specification than it was originally written for.
+ * A legacy class that extends the SOAPMessage class can be compiled and/or run against succeeding versions of
+ * the SAAJ API without modification. If such a class was correctly implemented then it will continue to behave
+ * correctly relative the the version of the specification against which it was written.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class SOAPMessage
+{
+ private HashMap properties = new HashMap();
+
+ /** Specifies the character type encoding for the SOAP Message. Valid values include "utf-8" and "utf-16". The default is "utf-8". */
+ public static final String CHARACTER_SET_ENCODING = "javax.xml.soap.character-set-encoding";
+ /** Specifies whether the SOAP Message will contain an XML declaration when it is sent. The default is "false". */
+ public static final String WRITE_XML_DECLARATION = "javax.xml.soap.write-xml-declaration";
+
+ /**
+ * Adds the given AttachmentPart object to this SOAPMessage object.
+ * An AttachmentPart object must be created before it can be added to a message.
+ * @param attachmentpart an AttachmentPart object that is to become part of this SOAPMessage object
+ */
+ public abstract void addAttachmentPart(AttachmentPart attachmentpart);
+
+ /**
+ * Creates a new empty AttachmentPart object. Note that the method addAttachmentPart must be called with this new
+ * AttachmentPart object as the parameter in order for it to become an attachment to this SOAPMessage object.
+ * @return a new AttachmentPart object that can be populated and added to this SOAPMessage object
+ */
+ public abstract AttachmentPart createAttachmentPart();
+
+ /**
+ * Creates an AttachmentPart object and populates it using the given DataHandler object.
+ * @param datahandler the javax.activation.DataHandler object that will generate the content for this SOAPMessage object
+ * @return a new AttachmentPart object that contains data generated by the given DataHandler object
+ */
+ public AttachmentPart createAttachmentPart(DataHandler datahandler)
+ {
+ AttachmentPart part = createAttachmentPart();
+ part.setDataHandler(datahandler);
+ return part;
+ }
+
+ /**
+ * Creates an AttachmentPart object and populates it with the specified data of the specified content type.
+ * @param content an Object containing the content for this SOAPMessage object
+ * @param contentType a String object giving the type of content; examples are "text/xml", "text/plain", and "image/jpeg"
+ * @return a new AttachmentPart object that contains the given data
+ */
+ public AttachmentPart createAttachmentPart(Object content, String contentType)
+ {
+ AttachmentPart part = createAttachmentPart();
+ part.setContent(content, contentType);
+ return part;
+ }
+
+ /**
+ * Retrieves value of the specified property.
+ * @param property the name of the property to retrieve
+ * @return the value associated with the named property or null if no such property exists.
+ * @throws SOAPException if the property name is not recognized.
+ */
+ public Object getProperty(String property)
+ throws SOAPException
+ {
+ return properties.get(property);
+ }
+
+ /**
+ * Associates the specified value with the specified property. If there was already a value associated with this
+ * property, the old value is replaced.
+ *
+ * The valid property names include WRITE_XML_DECLARATION and CHARACTER_SET_ENCODING.
+ * All of these standard SAAJ properties are prefixed by "javax.xml.soap".
+ * Vendors may also add implementation specific properties.
+ * These properties must be prefixed with package names that are unique to the vendor.
+ *
+ * Setting the property WRITE_XML_DECLARATION to "true" will cause an XML Declaration to be written out at the start
+ * of the SOAP message. The default value of "false" suppresses this declaration.
+ *
+ * The property CHARACTER_SET_ENCODING defaults to the value "utf-8" which causes the SOAP message to be
+ * encoded using UTF-8. Setting CHARACTER_SET_ENCODING to "utf-16" causes the SOAP message to be encoded using UTF-16.
+ *
+ * Some implementations may allow encodings in addition to UTF-8 and UTF-16. Refer to your vendor's documentation for details.
+ *
+ * @param property the property with which the specified value is to be associated.
+ * @param value the value to be associated with the specified property
+ * @throws SOAPException if the property name is not recognized
+ */
+ public void setProperty(String property, Object value) throws SOAPException
+ {
+ properties.put(property, value);
+ }
+
+ /**
+ * Gets the SOAP Body contained in this SOAPMessage object.
+ * @return the SOAPBody object contained by this SOAPMessage object
+ * @throws SOAPException if the SOAP Body does not exist or cannot be retrieved
+ */
+ public SOAPBody getSOAPBody() throws SOAPException
+ {
+ SOAPPart soapPart = getSOAPPart();
+ if (soapPart != null)
+ {
+ SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+ if (soapEnvelope != null)
+ {
+ SOAPBody soapBody = soapEnvelope.getBody();
+ return soapBody;
+ }
+ }
+ throw new SOAPException("Cannot obtain SOAPBody from SOAPMessage");
+ }
+
+ /**
+ * Gets the SOAP Header contained in this SOAPMessage object.
+ * @return the SOAPHeader object contained by this SOAPMessage object
+ * @throws SOAPException if the SOAP Header does not exist or cannot be retrieved
+ */
+ public SOAPHeader getSOAPHeader() throws SOAPException
+ {
+ SOAPPart soapPart = getSOAPPart();
+ if (soapPart != null)
+ {
+ SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
+ if (soapEnvelope != null)
+ {
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ return soapHeader;
+ }
+ }
+ throw new SOAPException("Cannot obtain SOAPHeader from SOAPMessage");
+ }
+
+ /**
+ * Retrieves a description of this SOAPMessage object's content.
+ * @return a String describing the content of this message or null if no description has been set
+ */
+ public abstract String getContentDescription();
+
+ /**
+ * Sets the description of this SOAPMessage object's content with the given description.
+ * @param description a String describing the content of this message
+ */
+ public abstract void setContentDescription(String description);
+
+ /**
+ * Returns all the transport-specific MIME headers for this SOAPMessage object in a transport-independent fashion.
+ * @return a MimeHeaders object containing the MimeHeader objects
+ */
+ public abstract MimeHeaders getMimeHeaders();
+
+ /**
+ * Gets the SOAP part of this SOAPMessage object.
+ *
+ * SOAPMessage object contains one or more attachments, the SOAP Part must be the first MIME body part in the message.
+ *
+ * @return the SOAPPart object for this SOAPMessage object
+ */
+ public abstract SOAPPart getSOAPPart();
+
+ /**
+ * Removes all AttachmentPart objects that have been added to this SOAPMessage object.
+ *
+ * This method does not touch the SOAP part.
+ */
+ public abstract void removeAllAttachments();
+
+ /**
+ * Gets a count of the number of attachments in this message. This count does not include the SOAP part.
+ * @return the number of AttachmentPart objects that are part of this SOAPMessage object
+ */
+ public abstract int countAttachments();
+
+ /**
+ * Retrieves all the AttachmentPart objects that are part of this SOAPMessage object.
+ * @return an iterator over all the attachments in this message
+ */
+ public abstract Iterator getAttachments();
+
+ /**
+ * Retrieves all the AttachmentPart objects that have header entries that match the specified headers.
+ * Note that a returned attachment could have headers in addition to those specified.
+ * @param mimeheaders a MimeHeaders object containing the MIME headers for which to search
+ * @return an iterator over all attachments that have a header that matches one of the given headers
+ */
+ public abstract Iterator getAttachments(MimeHeaders mimeheaders);
+
+ /**
+ * Updates this SOAPMessage object with all the changes that have been made to it.
+ * This method is called automatically when writeTo(OutputStream) is called.
+ * However, if changes are made to a message that was received or to one that has already been sent, the method
+ * saveChanges needs to be called explicitly in order to save the changes.
+ * The method saveChanges also generates any changes that can be read back (for example,
+ * a MessageId in profiles that support a message id). All MIME headers in a message that is created for sending
+ * purposes are guaranteed to have valid values only after saveChanges has been called.
+ *
+ * In addition, this method marks the point at which the data from all constituent AttachmentPart objects are pulled into the message.
+ *
+ * @throws SOAPException if there was a problem saving changes to this message.
+ */
+ public abstract void saveChanges() throws SOAPException;
+
+ /**
+ * Indicates whether this SOAPMessage object needs to have the method saveChanges called on it.
+ * @return true if saveChanges needs to be called; false otherwise.
+ */
+ public abstract boolean saveRequired();
+
+ /**
+ * Writes this SOAPMessage object to the given output stream. The externalization format is as defined by the
+ * SOAP 1.1 with Attachments specification.
+ *
+ * If there are no attachments, just an XML stream is written out. For those messages that have attachments,
+ * writeTo writes a MIME-encoded byte stream.
+ *
+ * @param outputstream the OutputStream object to which this SOAPMessage object will be written
+ * @throws SOAPException if there was a problem in externalizing this SOAP message
+ * @throws IOException if an I/O error occurs
+ */
+ public abstract void writeTo(OutputStream outputstream) throws SOAPException, IOException;
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPMessage.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPPart.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/SOAPPart.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/SOAPPart.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -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 javax.xml.soap;
+
+import java.util.Iterator;
+
+import javax.xml.transform.Source;
+
+import org.w3c.dom.Document;
+
+/**
+ * The container for the SOAP-specific portion of a SOAPMessage object.
+ *
+ * All messages are required to have a SOAP part, so when a SOAPMessage object is created,
+ * it will automatically have a SOAPPart object.
+ *
+ * A SOAPPart object is a MIME part and has the MIME headers Content-Id, Content-Location, and Content-Type.
+ * Because the value of Content-Type must be "text/xml", a SOAPPart object automatically has a MIME header of
+ * Content-Type with its value set to "text/xml".
+ *
+ * The value must be "text/xml" because content in the SOAP part of a message must be in XML format.
+ * Content that is not of type "text/xml" must be in an AttachmentPart object rather than in the SOAPPart object.
+ *
+ * When a message is sent, its SOAP part must have the MIME header Content-Type set to "text/xml".
+ * Or, from the other perspective, the SOAP part of any message that is received must have the MIME header
+ * Content-Type with a value of "text/xml".
+ *
+ * A client can access the SOAPPart object of a SOAPMessage object by calling the method SOAPMessage.getSOAPPart.
+ * The following line of code, in which message is a SOAPMessage object, retrieves the SOAP part of a message.
+ *
+ * SOAPPart soapPart = message.getSOAPPart();
+ *
+ * A SOAPPart object contains a SOAPEnvelope object, which in turn contains a SOAPBody object and a SOAPHeader object.
+ * The SOAPPart method getEnvelope can be used to retrieve the SOAPEnvelope object.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public abstract class SOAPPart implements Document
+{
+ public SOAPPart()
+ {
+ }
+
+ public abstract SOAPEnvelope getEnvelope() throws SOAPException;
+
+ public String getContentId()
+ {
+ String id = null;
+ String[] header = getMimeHeader("Content-Id");
+ if (header != null && header.length > 0)
+ {
+ id = header[0];
+ }
+ return id;
+ }
+
+ public void setContentId(String contentId)
+ {
+ setMimeHeader("Content-Id", contentId);
+ }
+
+ public String getContentLocation()
+ {
+ String location = null;
+ String[] header = getMimeHeader("Content-Location");
+ if (header != null && header.length > 0)
+ {
+ location = header[0];
+ }
+ return location;
+ }
+
+ public void setContentLocation(String contentLocation)
+ {
+ setMimeHeader("Content-Location", contentLocation);
+ }
+
+ public abstract void removeMimeHeader(String s);
+
+ public abstract void removeAllMimeHeaders();
+
+ public abstract String[] getMimeHeader(String s);
+
+ public abstract void setMimeHeader(String s, String s1);
+
+ public abstract void addMimeHeader(String s, String s1);
+
+ public abstract Iterator getAllMimeHeaders();
+
+ public abstract Iterator getMatchingMimeHeaders(String as[]);
+
+ public abstract Iterator getNonMatchingMimeHeaders(String as[]);
+
+ /** Sets the content of the SOAPEnvelope object with the data from the given Source object.
+ * This Source must contain a valid SOAP document.
+ * @param source the {@link javax.xml.transform.Source} object with the data to be set
+ * @throws SOAPException if the implementation cannot convert the specified Source object
+ */
+ public abstract void setContent(Source source) throws SOAPException;
+
+ /** Returns the content of the SOAPEnvelope as a JAXP <CODE>Source</CODE> object.
+ * @return the content as a <CODE> javax.xml.transform.Source</CODE> object
+ * @throws javax.xml.soap.SOAPException if the implementation cannot convert the specified <CODE>Source</CODE> object
+ * @see #setContent(javax.xml.transform.Source) setContent(javax.xml.transform.Source)
+ */
+ public abstract Source getContent() throws SOAPException;
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/SOAPPart.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/javax/xml/soap/Text.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/soap/Text.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/soap/Text.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,38 @@
+/*
+* 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 javax.xml.soap;
+
+/** A representation of a node whose value is text. A Text object may represent
+ * text that is content or text that is a comment.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public interface Text extends javax.xml.soap.Node, org.w3c.dom.Text
+{
+
+ /** Retrieves whether this Text object represents a comment.
+ *
+ * @return true if this Text object is a comment; false otherwise
+ */
+ public boolean isComment();
+}
Property changes on: trunk-tdiesler/src/main/java/javax/xml/soap/Text.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk-tdiesler/src/main/java/javax/xml/ws/handler/HandlerResolver.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/ws/handler/HandlerResolver.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/ws/handler/HandlerResolver.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -38,5 +38,5 @@
*/
public interface HandlerResolver
{
- List<Handler> getHandlerChain(PortInfo portinfo);
+ List<Handler> getHandlerChain(PortInfo portInfo);
}
\ No newline at end of file
Modified: trunk-tdiesler/src/main/java/javax/xml/ws/spi/ServiceDelegate.java
===================================================================
--- trunk-tdiesler/src/main/java/javax/xml/ws/spi/ServiceDelegate.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/javax/xml/ws/spi/ServiceDelegate.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -52,7 +52,12 @@
public abstract <T> T getPort(Class<T> sei);
- public abstract void addPort(QName qname, String s, String s1);
+ /**
+ * Creates a new port for the service.
+ * Ports created in this way contain no WSDL port type information
+ * and can only be used for creating Dispatchinstances.
+ */
+ public abstract void addPort(QName qname, String bindingId, String endpointAddress);
public abstract <T> Dispatch<T> createDispatch(QName qname, Class<T> type, Service.Mode mode);
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingClientHandler.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingClientHandler.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingClientHandler.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -76,16 +76,16 @@
*/
public boolean handleMessage(MessageContext msgContext)
{
- String outbound = (String)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+ Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound.equals("false") ? handleRequest(msgContext) : handleResponse(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- public boolean handleRequest(MessageContext msgContext)
+ public boolean handleOutbound(MessageContext msgContext)
{
- log.debug("handleRequest");
+ log.debug("handleOutbound");
SOAPAddressingProperties addrProps = (SOAPAddressingProperties)msgContext.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND);
if (addrProps != null)
@@ -115,9 +115,9 @@
// TODO: supply default header
}
- public boolean handleResponse(MessageContext msgContext)
+ public boolean handleInbound(MessageContext msgContext)
{
- log.debug("handleResponse");
+ log.debug("handleInbound");
try
{
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -82,12 +82,12 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- private boolean handleRequest(MessageContext msgContext)
+ private boolean handleInbound(MessageContext msgContext)
{
- log.debug("handleRequest");
+ log.debug("handleInbound");
SOAPAddressingProperties addrProps = (SOAPAddressingProperties)ADDR_BUILDER.newAddressingProperties();
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
@@ -100,9 +100,9 @@
return true;
}
- private boolean handleResponse(MessageContext msgContext)
+ private boolean handleOutbound(MessageContext msgContext)
{
- log.debug("handleResponse");
+ log.debug("handleOutbound");
handleResponseOrFault(msgContext, false);
return true;
}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProvider.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProvider.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,55 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.binding;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.metadata.OperationMetaData;
-
-/** An implementation of this interface transforms the Java call parameters to a SOAPMessage and vice versa.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public interface BindingProvider
-{
- static String JAXRPC_SOAP11_BINDING = "org.jboss.ws.binding.jaxrpc.soap11";
- static String JAXWS_MESSAGE_BINDING = "org.jboss.ws.binding.jaxws.message";
- static String JAXWS_PAYLOAD_BINDING = "org.jboss.ws.binding.jaxws.payload";
-
- /** On the client side, generate the SOAPMessage from IN parameters. */
- SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
-
- /** On the server side, extract the IN parameters from the SOAPMessage and populate an Invocation object */
- EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException;
-
- /** On the server side, generate the SOAPMessage from OUT parameters in the Invocation object. */
- SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
-
- /** On the client side, extract the OUT parameters from the SOAPMessage and return them to the client. */
- void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/BindingProviderRegistry.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.binding;
-
-// $Id$
-
-import java.util.HashMap;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP11;
-import org.jboss.ws.binding.soap.JAXWSBindingProviderMessage;
-import org.jboss.ws.binding.soap.JAXWSBindingProviderPayload;
-
-/** A registry of binding providers.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public class BindingProviderRegistry
-{
- private static Class defaultProvider = JAXRPCBindingProviderSOAP11.class;
- private static HashMap providers = new HashMap();
-
- static
- {
- providers.put(BindingProvider.JAXRPC_SOAP11_BINDING, defaultProvider);
- providers.put(BindingProvider.JAXWS_MESSAGE_BINDING, JAXWSBindingProviderMessage.class);
- providers.put(BindingProvider.JAXWS_PAYLOAD_BINDING, JAXWSBindingProviderPayload.class);
- }
-
- /** Get a binding provider for a given URI
- */
- public static BindingProvider getProvider(String bindingURI)
- {
- if (bindingURI == null)
- return getDefaultProvider();
-
- try
- {
- Class provClass = (Class)providers.get(bindingURI);
- BindingProvider prov = (BindingProvider)provClass.newInstance();
- return prov;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-
- /** Get the default binding provider */
- public static BindingProvider getDefaultProvider()
- {
- try
- {
- BindingProvider prov = (BindingProvider)defaultProvider.newInstance();
- return prov;
- }
- catch (RuntimeException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new WSException(e);
- }
- }
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProvider.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,815 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.AttachmentPart;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPBody;
-import javax.xml.soap.SOAPBodyElement;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPMessage;
-
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMUtils;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.jaxrpc.ParameterWrapping;
-import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-import org.jboss.ws.soap.NameImpl;
-import org.jboss.ws.soap.SOAPBodyElementDoc;
-import org.jboss.ws.soap.SOAPBodyElementRpc;
-import org.jboss.ws.soap.SOAPContentElement;
-import org.jboss.ws.soap.SOAPElementImpl;
-import org.jboss.ws.soap.SOAPFaultImpl;
-import org.jboss.ws.soap.SOAPHeaderElementImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-import org.jboss.ws.soap.attachment.AttachmentPartImpl;
-import org.jboss.ws.soap.attachment.CIDGenerator;
-import org.jboss.ws.utils.JavaUtils;
-import org.jboss.ws.utils.MimeUtils;
-import org.jboss.xb.binding.NamespaceRegistry;
-import org.w3c.dom.Element;
-
-/** An abstract BindingProvider for SOAP that is independent of the SOAP version.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 16-Oct-2004
- */
-public abstract class JAXRPCBindingProvider implements BindingProvider
-{
- // provide logging
- private static final Logger log = Logger.getLogger(JAXRPCBindingProvider.class);
-
- /** Create the SOAPMessage */
- protected abstract SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException;
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- log.debug("bindRequestMessage: " + opMetaData.getQName());
-
- try
- {
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(reqMessage);
-
- SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
- SOAPBody soapBody = soapEnvelope.getBody();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- QName opQName = opMetaData.getQName();
- Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
-
- log.debug("Create RPC body element: " + opName);
- SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
-
- soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
-
- for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getRequestParamValue(xmlName);
-
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = reqMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
- reqMessage.addAttachmentPart(part);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement;
- SOAPContentElement contentElement = addParameterToMessage(paramMetaData, value, soapElement);
-
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getRequestParamValue(xmlName);
-
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = reqMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
- reqMessage.addAttachmentPart(part);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBody;
- addParameterToMessage(paramMetaData, value, soapElement);
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
-
- // Add unbound headers
- if (unboundHeaders != null)
- {
- Iterator it = unboundHeaders.values().iterator();
- while (it.hasNext())
- {
- UnboundHeader unboundHeader = (UnboundHeader)it.next();
- if (unboundHeader.getMode() != ParameterMode.OUT)
- {
- QName xmlName = unboundHeader.getXmlName();
- Object value = unboundHeader.getHeaderValue();
-
- xmlName = namespaceRegistry.registerQName(xmlName);
- Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
-
- SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName);
- contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
- contentElement.setObjectValue(value);
-
- log.debug("Add unboundHeader element: " + soapName);
- soapHeader.addChildElement(contentElement);
- }
- }
- }
-
- return reqMessage;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
- {
- log.debug("unbindRequestMessage: " + opMetaData.getQName());
-
- try
- {
- // Read the SOAPEnvelope from the reqMessage
- SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
-
- // Construct the endpoint invocation object
- EndpointInvocation epInv = new EndpointInvocation(opMetaData);
-
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- if (opMetaData.isMessageEndpoint() == false)
- {
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
- Name elName = soapBodyElement.getElementName();
-
- QName elQName = new QName(elName.getURI(), elName.getLocalName(), elName.getPrefix());
- elQName = namespaceRegistry.registerQName(elQName);
-
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.getMode() == ParameterMode.OUT)
- {
- epInv.setRequestParamValue(xmlName, null);
- }
- else
- {
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- if (paramMetaData.isInHeader() == false)
- {
- Object value = getParameterFromMessage(paramMetaData, soapBodyElement, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- }
- }
- }
-
- // Document style
- else
- {
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- if (paramMetaData.isInHeader())
- {
- if (paramMetaData.getMode() == ParameterMode.IN)
- {
- Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData, soapHeader, true);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- else
- {
- Object value = getParameterFromMessage(paramMetaData, soapBody, false);
- epInv.setRequestParamValue(xmlName, value);
- }
- }
- }
- }
- }
-
- // Generic message endpoint
- else
- {
- for (ParameterMetaData paramMetaData : opMetaData.getParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = soapBody.getChildElements().next();
- epInv.setRequestParamValue(xmlName, value);
- }
- }
-
- return epInv;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** On the server side, generate the payload from OUT parameters. */
- public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
- {
- log.debug("bindResponseMessage: " + opMetaData.getQName());
-
- try
- {
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- // Associate current message with message context
- SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
- msgContext.setMessage(resMessage);
-
- // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
- // Specifically, the HTTP response entity-body must be empty.
- if (opMetaData.isOneWayOperation())
- {
- resMessage.getSOAPPart().setContent(null);
- return resMessage;
- }
-
- SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
-
- // Get the namespace registry
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- QName opQName = opMetaData.getResponseName();
-
- Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
- SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
-
- soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
-
- // Add the return to the message
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- Object value = epInv.getReturnValue();
- if (retMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
- resMessage.addAttachmentPart(part);
- epInv.setReturnValue(part);
- }
- else
- {
- SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBodyElement);
- epInv.setReturnValue(soapElement);
- soapElement.setObjectValue(value);
- }
- }
-
- // Add the out parameters to the message
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- Object value = epInv.getResponseParamValue(xmlName);
- if (paramMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
- resMessage.addAttachmentPart(part);
- }
- else
- {
- if (paramMetaData.isInHeader())
- {
- addParameterToMessage(paramMetaData, value, soapHeader);
- }
- else
- {
- addParameterToMessage(paramMetaData, value, soapBodyElement);
- }
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- Object value = epInv.getReturnValue();
- if (opMetaData.isDocumentWrapped())
- value = ParameterWrapping.wrapResponseParameter(opMetaData, value);
-
- if (retMetaData.isSwA())
- {
- CIDGenerator cidGenerator = resMessage.getCidGenerator();
- AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
- resMessage.addAttachmentPart(part);
- epInv.setReturnValue(part);
- }
- else
- {
- SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBody);
- epInv.setReturnValue(soapElement);
- }
- }
-
- // Add the out header parameters to the message
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isInHeader())
- {
- Object value = epInv.getResponseParamValue(xmlName);
- addParameterToMessage(paramMetaData, value, soapHeader);
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
-
- return resMessage;
- }
- catch (Exception e)
- {
- handleException(e);
- return null;
- }
- }
-
- /** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
- throws BindingException
- {
- log.debug("unbindResponseMessage: " + opMetaData.getQName());
-
- try
- {
- // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
- // Specifically, the HTTP response entity-body must be empty.
- if (opMetaData.isOneWayOperation() == true)
- {
- return;
- }
-
- // WS-Addressing might redirect the response, which results in an empty envelope
- SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope == null)
- {
- return;
- }
-
- // Get the SOAP message context that is associated with the current thread
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- if (msgContext == null)
- throw new WSException("MessageContext not available");
-
- SOAPHeader soapHeader = soapEnvelope.getHeader();
- SOAPBody soapBody = soapEnvelope.getBody();
- Iterator bodyChildren = soapBody.getChildElements();
-
- SOAPBodyElement soapBodyElement = null;
- if (bodyChildren.hasNext() != false)
- soapBodyElement = (SOAPBodyElement)bodyChildren.next();
-
- // Translate the SOAPFault to an exception and throw it
- if (soapBodyElement instanceof SOAPFaultImpl)
- {
- SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement;
- SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault);
- throw faultEx;
- }
-
- // Extract unbound OUT headers
- if (unboundHeaders != null)
- {
- Map<QName, UnboundHeader> outHeaders = new HashMap<QName, UnboundHeader>();
- Iterator itHeaderElements = soapHeader.getChildElements();
- while (itHeaderElements.hasNext())
- {
- SOAPContentElement soapHeaderElement = (SOAPHeaderElementImpl)itHeaderElements.next();
- Name elName = soapHeaderElement.getElementName();
- QName xmlName = new QName(elName.getURI(), elName.getLocalName());
-
- UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
- if (unboundHeader != null)
- {
- soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
-
- // Do the unmarshalling
- Object value = soapHeaderElement.getObjectValue();
- unboundHeader.setHeaderValue(value);
- outHeaders.put(xmlName, unboundHeader);
- }
- }
- unboundHeaders.clear();
- unboundHeaders.putAll(outHeaders);
- }
-
- Style style = opMetaData.getStyle();
- if (style == Style.RPC)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
- if (retMetaData != null)
- {
- if (retMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(retMetaData, resMessage);
- epInv.setReturnValue(value);
- }
- else
- {
- Object value = getParameterFromMessage(retMetaData, soapBodyElement, false);
- epInv.setReturnValue(value);
- }
- }
-
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(paramMetaData, resMessage);
- epInv.setResponseParamValue(xmlName, value);
- }
- else
- {
- SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader : (SOAPElement)soapBodyElement;
- Object value = getParameterFromMessage(paramMetaData, soapElement, false);
- epInv.setResponseParamValue(xmlName, value);
- }
- }
- }
- else if (style == Style.DOCUMENT)
- {
- ParameterMetaData retMetaData = opMetaData.getReturnParameter();
-
- // WS-Eventing has no message part for UnsubscribeResponseMsg
- if (retMetaData != null)
- {
- if (retMetaData.isSwA())
- {
- Object value = getAttachmentFromMessage(retMetaData, resMessage);
- epInv.setReturnValue(value);
- }
- else
- {
- Object value = getParameterFromMessage(retMetaData, soapBody, false);
- epInv.setReturnValue(value);
- }
-
- for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
- {
- QName xmlName = paramMetaData.getXmlName();
- if (paramMetaData.isInHeader())
- {
- Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
- epInv.setResponseParamValue(xmlName, value);
- }
- }
- }
- }
- else
- {
- throw new WSException("Unsupported message style: " + style);
- }
- }
- catch (Exception e)
- {
- handleException(e);
- }
- }
-
- private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
- {
- String partName = paramMetaData.getXmlName().getLocalPart();
- Set mimeTypes = paramMetaData.getMimeTypes();
-
- AttachmentPart part = new AttachmentPartImpl();
- if (value instanceof DataHandler)
- {
- DataHandler handler = (DataHandler)value;
- String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
-
- if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
- throw new BindingException("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes);
-
- part.setDataHandler((DataHandler)value);
- }
- else
- {
- String mimeType = null;
- if (mimeTypes != null && mimeTypes.size() > 0)
- {
- mimeType = (String)mimeTypes.iterator().next();
- }
- else
- {
- mimeType = MimeUtils.resolveMimeType(value);
- }
-
- if (mimeType == null)
- throw new BindingException("Could not determine mime type for attachment parameter: " + partName);
-
- part.setContent(value, mimeType);
- }
-
- if (paramMetaData.isSwA())
- {
- String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>';
- part.setContentId(swaCID);
- }
- if (paramMetaData.isXOP())
- {
- String xopCID = '<' + cidGenerator.generateFromName(partName) + '>';
- part.setContentId(xopCID);
- }
-
- return part;
- }
-
- private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage message) throws SOAPException, BindingException
- {
- QName xmlName = paramMetaData.getXmlName();
-
- AttachmentPart part = ((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
- if (part == null)
- throw new BindingException("Could not locate attachment for parameter: " + paramMetaData.getXmlName());
-
- return part;
- }
-
- /** Marshall the given parameter and add it to the SOAPMessage */
- private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData, Object value, SOAPElement soapElement) throws SOAPException, BindingException
- {
- QName xmlName = paramMetaData.getXmlName();
- Class javaType = paramMetaData.getJavaType();
-
- if (value != null && paramMetaData.isXOP() == false)
- {
- Class valueType = value.getClass();
- if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
- throw new BindingException("javaType " + javaType.getName() + " is not assignable from: " + valueType.getName());
- }
-
- // Make sure we have a prefix on qualified names
- if (xmlName.getNamespaceURI().length() > 0)
- {
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
- xmlName = namespaceRegistry.registerQName(xmlName);
- }
-
- Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
- if (paramMetaData.isSOAPArrayParam())
- soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- SOAPContentElement contentElement;
- if (soapElement instanceof SOAPHeader)
- {
- contentElement = new SOAPHeaderElementImpl(soapName);
- soapElement.addChildElement(contentElement);
- }
- else
- {
- Style style = paramMetaData.getOperationMetaData().getStyle();
- if (style == Style.DOCUMENT)
- {
- contentElement = new SOAPBodyElementDoc(soapName);
- soapElement.addChildElement(contentElement);
- }
- else
- {
- contentElement = new SOAPContentElement(soapName);
- soapElement.addChildElement(contentElement);
- }
- }
-
- contentElement.setParamMetaData(paramMetaData);
-
- if (paramMetaData.isSOAPArrayParam())
- contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- // The object value needs to be set after xmime:contentType
- if (paramMetaData.isXOP() )
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)
- MessageContextAssociation.peekMessageContext().getMessage();
- soapMessage.setXOPMessage(true);
- }
-
- contentElement.setObjectValue(value);
-
- return contentElement;
- }
-
- /** Unmarshall a message element and add it to the parameter list
- * @param optional TODO*/
- private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException
- {
- Name xmlName = new NameImpl(paramMetaData.getXmlName());
- Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
-
- SOAPContentElement soapContentElement = null;
- Iterator childElements = soapElement.getChildElements();
- while (childElements.hasNext())
- {
- SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
-
- // If this message was manipulated by a handler the child may not be a content element
- if (!(childElement instanceof SOAPContentElement))
- childElement = (SOAPContentElement)soapElement.replaceChild(new SOAPContentElement(childElement), childElement);
-
- // The parameters are expected to be lazy
- SOAPContentElement aux = (SOAPContentElement)childElement;
- Name elName = aux.getElementName();
-
- if (xmlName.equals(elName))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
- }
-
- if (soapArrayName.equals(elName))
- {
- QName compXMLName = paramMetaData.getXmlName();
- Element compElement = DOMUtils.getFirstChildElement(aux);
- if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- break;
- }
- }
- }
-
- // If matching by name fails, try to match by xmlType
- // This maybe necessary when wsa:Action dispatches to the operation
- if (soapContentElement == null)
- {
- childElements = soapElement.getChildElements();
- OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
- if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
- {
- SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
-
- // The parameters are expected to be lazy
- SOAPContentElement aux = (SOAPContentElement)childElement;
- Name elName = aux.getElementName();
- QName elType = null;
-
- XSElementDeclaration xsdElement = typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(), elName.getURI());
- if (xsdElement != null && xsdElement.getTypeDefinition() != null)
- {
- XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
- elType = new QName(xsdType.getNamespace(), xsdType.getName());
- }
-
- if (paramMetaData.getXmlType().equals(elType))
- {
- soapContentElement = aux;
- soapContentElement.setParamMetaData(paramMetaData);
- }
- }
- }
-
- if (soapContentElement == null && optional == false)
- throw new JAXRPCException("Cannot find child element: " + xmlName);
-
- if(paramMetaData.isXOP())
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)
- MessageContextAssociation.peekMessageContext().getMessage();
- soapMessage.setXOPMessage(true);
- }
- return soapContentElement;
- }
-
- private void handleException(Exception ex) throws BindingException
- {
- if (ex instanceof RuntimeException)
- throw (RuntimeException)ex;
-
- if (ex instanceof BindingException)
- throw (BindingException)ex;
-
- throw new BindingException(ex);
- }
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP11.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,67 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MimeHeaders;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/** A BindingProvider that implements the SOAP-1.1 specifics.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 09-Nov-2004
- */
-public class JAXRPCBindingProviderSOAP11 extends JAXRPCBindingProvider
-{
- /** Create the SOAP-1.1 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- return factory.createMessage();
- }
-
- /** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
- {
- SOAPMessage reqMessage = super.bindRequestMessage(opMetaData, epInv, unboundHeaders);
-
- // Set the SOAPAction
- MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
- String soapAction = opMetaData.getSOAPAction();
- mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
-
- return reqMessage;
- }
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXRPCBindingProviderSOAP12.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,47 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.binding.soap;
-
-// $Id$
-
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageFactoryImpl;
-
-/** A BindingProvider that implements the SOAP-1.2 specifics.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 09-Nov-2004
- */
-public class JAXRPCBindingProviderSOAP12 extends JAXRPCBindingProvider
-{
- /** Create the SOAP-1.2 message */
- protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
- {
- MessageFactoryImpl factory = new MessageFactoryImpl();
- factory.setEnvelopeURI(Constants.NS_SOAP12_ENV);
- return factory.createMessage();
- }
-}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderMessage.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -32,20 +32,20 @@
import org.jboss.util.NotImplementedException;
import org.jboss.ws.WSException;
import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.BindingProvider;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.jaxws.core.BindingImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.soap.MessageContextAssociation;
-/** A BindingProvider for unprocessed SOAP Messages
+/** A binding for unprocessed SOAP Messages
*
* @author Thomas.Diesler at jboss.org
* @since 27-Jun-2006
*/
-public class JAXWSBindingProviderMessage implements BindingProvider
+public class JAXWSBindingProviderMessage extends BindingImpl
{
// provide logging
private static final Logger log = Logger.getLogger(JAXWSBindingProviderMessage.class);
@@ -57,7 +57,7 @@
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
{
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -84,7 +84,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -108,7 +108,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/binding/soap/JAXWSBindingProviderPayload.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -34,10 +34,10 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.BindingProvider;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxws.core.BindingImpl;
import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ParameterMetaData;
@@ -51,19 +51,19 @@
* @author Thomas.Diesler at jboss.org
* @since 27-Jun-2006
*/
-public class JAXWSBindingProviderPayload implements BindingProvider
+public class JAXWSBindingProviderPayload extends BindingImpl
{
// provide logging
private static final Logger log = Logger.getLogger(JAXWSBindingProviderPayload.class);
/** On the client side, generate the payload from IN parameters. */
- public SOAPMessage bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
{
throw new NotImplementedException();
}
/** On the server side, extract the IN parameters from the payload and populate an Invocation object */
- public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, SOAPMessage reqMessage) throws BindingException
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
{
log.debug("unbindRequestMessage: " + opMetaData.getQName());
@@ -78,10 +78,11 @@
ParameterMetaData paramMetaData = opMetaData.getParameters().get(0);
QName xmlName = paramMetaData.getXmlName();
-
+
+ SOAPMessage reqMessage = (SOAPMessage)payload;
SOAPBodyImpl soapBody = (SOAPBodyImpl)reqMessage.getSOAPBody();
- Source payload = soapBody.getPayload();
- epInv.setRequestParamValue(xmlName, payload);
+ Source source = soapBody.getPayload();
+ epInv.setRequestParamValue(xmlName, source);
return epInv;
}
@@ -93,7 +94,7 @@
}
/** On the server side, generate the payload from OUT parameters. */
- public SOAPMessage bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
{
log.debug("bindResponseMessage: " + opMetaData.getQName());
@@ -112,7 +113,7 @@
Source payload = (Source)epInv.getReturnValue();
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMessage.getSOAPBody();
soapBody.setPayload(payload);
-
+
return resMessage;
}
catch (Exception e)
@@ -123,7 +124,7 @@
}
/** On the client side, extract the OUT parameters from the payload and return them to the client. */
- public void unbindResponseMessage(OperationMetaData opMetaData, SOAPMessage resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
throws BindingException
{
throw new NotImplementedException();
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/common/CommonClient.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/common/CommonClient.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -35,6 +35,7 @@
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
@@ -42,13 +43,12 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.addressing.AddressingConstantsImpl;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.jaxrpc.ParameterWrapping;
import org.jboss.ws.jaxrpc.Style;
-import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.ClientEndpointMetaData;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
@@ -79,6 +79,9 @@
protected QName operationName;
// Output parameters
protected EndpointInvocation epInv;
+
+ // The binding provider
+ private BindingProvider bindingProvider;
/** Create a call that needs to be configured manually
*/
@@ -200,6 +203,10 @@
protected abstract boolean callResponseHandlerChain(QName portName);
+ protected abstract void setInboundContextProperties();
+
+ protected abstract void setOutboundContextProperties();
+
/** Call invokation goes as follows:
*
* 1) synchronize the operation name with the operation meta data
@@ -230,16 +237,18 @@
try
{
- // Get the binding provider for the given bindingURI
- BindingProvider bindingProvider = BindingProviderRegistry.getDefaultProvider();
+ // Get the binding from the provider
+ BindingImpl binding = (BindingImpl)getBindingProvider().getBinding();
// Create the invocation and sync the input parameters
epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(inputParams);
// Bind the request message
- SOAPMessage reqMessage = bindingProvider.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, unboundHeaders);
+ setOutboundContextProperties();
+
// Call the request handlers
QName portName = epMetaData.getQName();
@@ -294,6 +303,8 @@
msgContext.setMessage(resMessage);
}
+ setInboundContextProperties();
+
// Get the return object
Object retObj = null;
if (oneway == false)
@@ -303,7 +314,7 @@
// unbind the return values
SOAPMessage resMessage = msgContext.getMessage();
- bindingProvider.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, unboundHeaders);
retObj = syncOutputParams(inputParams, epInv);
}
@@ -330,6 +341,15 @@
}
}
+ public BindingProvider getBindingProvider()
+ {
+ if (bindingProvider == null)
+ {
+ bindingProvider = new BindingProviderImpl(getEndpointMetaData());
+ }
+ return bindingProvider;
+ }
+
protected abstract Map<String, Object> getRequestContext();
protected abstract Map<String, Object> getResponseContext();
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -333,7 +333,7 @@
}
if (endpointFound == false)
- throw new WSException("Cannot find service endpoint '" + portName + "' in wsdl document");
+ throw new WSException("Cannot find port in wsdl: " + portName);
}
private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -78,16 +78,19 @@
if (targetNS.length() == 0)
targetNS = wsdlUtils.getTypeNamespace(wsClass);
- String portTypeName = anWebServiceProvider.portName();
- if (portTypeName.length() == 0)
- portTypeName = wsdlUtils.getJustClassName(wsClass.getName());
+ String portName = anWebServiceProvider.portName();
+ if (portName.length() == 0)
+ {
+ portName = wsdlUtils.getJustClassName(wsClass.getName());
+ portName += "Port";
+ }
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
wsMetaData.addService(serviceMetaData);
// Setup the ServerEndpointMetaData
- QName portName = new QName(targetNS, portTypeName + "Port");
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portName, Type.JAXWS);
+ QName portQName = new QName(targetNS, portName);
+ ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, Type.JAXWS);
sepMetaData.setLinkName(linkName);
sepMetaData.setStyle(Style.DOCUMENT);
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -128,16 +128,19 @@
if (targetNS.length() == 0)
targetNS = wsdlUtils.getTypeNamespace(wsClass);
- String portTypeName = anWebService.name();
- if (portTypeName.length() == 0)
- portTypeName = wsdlUtils.getJustClassName(wsClass.getName());
+ String portName = anWebService.name();
+ if (portName.length() == 0)
+ {
+ portName = wsdlUtils.getJustClassName(wsClass.getName());
+ portName += "Port";
+ }
ServiceMetaData serviceMetaData = new ServiceMetaData(wsMetaData, new QName(targetNS, serviceName));
wsMetaData.addService(serviceMetaData);
// Setup the ServerEndpointMetaData
- QName portName = new QName(targetNS, portTypeName + "Port");
- ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portName, Type.JAXWS);
+ QName portQName = new QName(targetNS, portName);
+ ServerEndpointMetaData sepMetaData = new ServerEndpointMetaData(serviceMetaData, portQName, Type.JAXWS);
sepMetaData.setLinkName(linkName);
sepMetaData.setServiceEndpointImplName(sepClass.getName());
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/integration/jboss/ServiceEndpointInterceptor.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -29,10 +29,10 @@
import org.jboss.invocation.Invocation;
import org.jboss.invocation.InvocationKey;
import org.jboss.logging.Logger;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
@@ -92,8 +92,9 @@
epInv.setReturnValue(resObj);
// Bind the response message
- BindingProvider bindingProvider = BindingProviderRegistry.getDefaultProvider();
- SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
+ BindingProviderImpl bindingProvider = new BindingProviderImpl(opMetaData.getEndpointMetaData());
+ BindingImpl binding = (BindingImpl)bindingProvider.getBinding();
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
msgContext.setMessage(resMessage);
}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -531,6 +531,16 @@
else return null;
}
+ @Override
+ protected void setInboundContextProperties()
+ {
+ }
+
+ @Override
+ protected void setOutboundContextProperties()
+ {
+ }
+
private Object invokeInternal(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway) throws RemoteException
{
if (opName.equals(operationName) == false)
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,201 +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.jaxrpc;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.HandlerChain;
-import javax.xml.rpc.handler.HandlerInfo;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
-import org.jboss.ws.jaxrpc.handler.ServerHandlerChain;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.server.HandlerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/** Delegates to JAXRPC handlers
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Jan-2005
- */
-public class HandlerDelegateJAXRPC implements HandlerDelegate
-{
- // provide logging
- private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class);
-
- // This endpoints handler chain
- private ServerHandlerChain preHandlerChain;
- // This endpoints handler chain
- private ServerHandlerChain jaxrpcHandlerChain;
- // This endpoints handler chain
- private ServerHandlerChain postHandlerChain;
-
- public HandlerDelegateJAXRPC()
- {
- }
-
- public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
-
- // Initialize the handler chain
- if (sepMetaData.isHandlersInitialized() == false)
- {
- initHandlerChain(seInfo, HandlerType.PRE);
- initHandlerChain(seInfo, HandlerType.ENDPOINT);
- initHandlerChain(seInfo, HandlerType.POST);
- sepMetaData.setHandlersInitialized(true);
- }
-
- boolean status = true;
- String[] roles = null;
-
- HandlerChain handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxrpcHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- if (handlerChain != null)
- {
- roles = handlerChain.getRoles();
- status = handlerChain.handleRequest(msgContext);
- }
-
- // BP-1.0 R1027
- if (type == HandlerType.POST)
- HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-
- return status;
- }
-
- public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-
- HandlerChain handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxrpcHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
- }
-
- public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
- {
- SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
-
- HandlerChain handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxrpcHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
- }
-
- /**
- * Init the handler chain
- */
- private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- Set<String> handlerRoles = new HashSet<String>();
- List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
-
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
- {
- handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
-
- Class hClass;
- String handlerClass = handlerMetaData.getHandlerClass();
- try
- {
- // Load the handler class using the deployments top level CL
- ClassLoader classLoader = sepMetaData.getClassLoader();
- hClass = classLoader.loadClass(handlerClass);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSException("Cannot load handler class: " + handlerClass);
- }
-
- HashMap<String, Object> hConfig = new HashMap<String, Object>();
- UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
- for (int j = 0; j < params.length; j++)
- {
- UnifiedInitParamMetaData param = params[j];
- hConfig.put(param.getParamName(), param.getParamValue());
- }
- QName[] hHeaders = handlerMetaData.getSoapHeaders();
- HandlerInfo info = new HandlerInfo(hClass, hConfig, hHeaders);
-
- log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
- hInfos.add(info);
- }
-
- initHandlerChain(seInfo, hInfos, handlerRoles, type);
- }
-
- private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
- {
- log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
-
- ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
- if (type == HandlerType.PRE)
- preHandlerChain = handlerChain;
- else if (type == HandlerType.ENDPOINT)
- jaxrpcHandlerChain = handlerChain;
- else if (type == HandlerType.POST)
- postHandlerChain = handlerChain;
-
- if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
- {
- // what is the config for a handler chain?
- handlerChain.init(null);
- }
- }
-
-}
Copied: trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java (from rev 705, trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java)
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/HandlerDelegateJAXRPC.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,198 @@
+/*
+ * 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.jaxrpc.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerChain;
+import javax.xml.rpc.handler.HandlerInfo;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.server.HandlerDelegate;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/** Delegates to JAXRPC handlers
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public class HandlerDelegateJAXRPC implements HandlerDelegate
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(HandlerDelegateJAXRPC.class);
+
+ // This endpoints handler chain
+ private ServerHandlerChain preHandlerChain;
+ // This endpoints handler chain
+ private ServerHandlerChain jaxrpcHandlerChain;
+ // This endpoints handler chain
+ private ServerHandlerChain postHandlerChain;
+
+ public HandlerDelegateJAXRPC()
+ {
+ }
+
+ public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+
+ // Initialize the handler chain
+ if (sepMetaData.isHandlersInitialized() == false)
+ {
+ initHandlerChain(seInfo, HandlerType.PRE);
+ initHandlerChain(seInfo, HandlerType.ENDPOINT);
+ initHandlerChain(seInfo, HandlerType.POST);
+ sepMetaData.setHandlersInitialized(true);
+ }
+
+ boolean status = true;
+ String[] roles = null;
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ if (handlerChain != null)
+ {
+ roles = handlerChain.getRoles();
+ status = handlerChain.handleRequest(msgContext);
+ }
+
+ // BP-1.0 R1027
+ if (type == HandlerType.POST)
+ HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
+
+ return status;
+ }
+
+ public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ return (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);
+ }
+
+ public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+ {
+ SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();
+
+ HandlerChain handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxrpcHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
+ }
+
+ /**
+ * Init the handler chain
+ */
+ private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ Set<String> handlerRoles = new HashSet<String>();
+ List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
+
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+ for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+ {
+ handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
+
+ Class hClass;
+ String handlerClass = handlerMetaData.getHandlerClass();
+ try
+ {
+ // Load the handler class using the deployments top level CL
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ hClass = classLoader.loadClass(handlerClass);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new WSException("Cannot load handler class: " + handlerClass);
+ }
+
+ HashMap<String, Object> hConfig = new HashMap<String, Object>();
+ UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
+ for (int j = 0; j < params.length; j++)
+ {
+ UnifiedInitParamMetaData param = params[j];
+ hConfig.put(param.getParamName(), param.getParamValue());
+ }
+ QName[] hHeaders = handlerMetaData.getSoapHeaders();
+ HandlerInfo info = new HandlerInfo(hClass, hConfig, hHeaders);
+
+ log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
+ hInfos.add(info);
+ }
+
+ initHandlerChain(seInfo, hInfos, handlerRoles, type);
+ }
+
+ private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
+ {
+ log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
+
+ ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
+ if (type == HandlerType.PRE)
+ preHandlerChain = handlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ jaxrpcHandlerChain = handlerChain;
+ else if (type == HandlerType.POST)
+ postHandlerChain = handlerChain;
+
+ if (handlerChain.getState() == ServerHandlerChain.STATE_CREATED)
+ {
+ // what is the config for a handler chain?
+ handlerChain.init(null);
+ }
+ }
+
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxrpc/handler/HandlerDelegateJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,240 +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.jaxws;
-
-// $Id$
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.management.MBeanException;
-import javax.xml.rpc.soap.SOAPFaultException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.jaxws.handler.HandlerChainBaseImpl;
-import org.jboss.ws.jaxws.handler.HandlerInfo;
-import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.jaxws.handler.ServerHandlerChain;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedInitParamMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.ws.server.HandlerDelegate;
-import org.jboss.ws.server.ServiceEndpointInfo;
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/** Delegates to JAXWS handlers
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-Jan-2005
- */
-public class HandlerDelegateJAXWS implements HandlerDelegate
-{
- // provide logging
- private static Logger log = Logger.getLogger(HandlerDelegateJAXWS.class);
-
- // This endpoints handler chain
- private ServerHandlerChain preHandlerChain;
- // This endpoints handler chain
- private ServerHandlerChain jaxwsHandlerChain;
- // This endpoints handler chain
- private ServerHandlerChain postHandlerChain;
-
- public HandlerDelegateJAXWS()
- {
- }
-
- /** handle invokation exceptions */
- public void handleInvocationException(Throwable th) throws SOAPFaultException
- {
- if (th instanceof RuntimeException)
- throw (RuntimeException)th;
-
- if (th instanceof InvocationTargetException)
- {
- InvocationTargetException targetException = (InvocationTargetException)th;
- Throwable targetEx = targetException.getTargetException();
- if (targetEx instanceof SOAPFaultException)
- {
- throw (SOAPFaultException)targetEx;
- }
- else
- {
- String faultString = targetEx.toString();
- SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
- soapFaultEx.initCause(targetEx);
- throw soapFaultEx;
- }
- }
-
- if (th instanceof MBeanException)
- {
- Exception targetEx = ((MBeanException)th).getTargetException();
- if (targetEx instanceof SOAPFaultException)
- {
- throw (SOAPFaultException)targetEx;
- }
- else
- {
- String faultString = targetEx.toString();
- SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
- soapFaultEx.initCause(targetEx);
- throw soapFaultEx;
- }
- }
-
- String faultString = th.toString();
- SOAPFaultException soapFaultEx = new SOAPFaultException(Constants.SOAP11_FAULT_CODE_CLIENT, faultString, null, null);
- soapFaultEx.initCause(th);
- throw soapFaultEx;
- }
-
- public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
-
- // Initialize the handler chain
- if (sepMetaData.isHandlersInitialized() == false)
- {
- initHandlerChain(seInfo, HandlerType.PRE);
- initHandlerChain(seInfo, HandlerType.ENDPOINT);
- initHandlerChain(seInfo, HandlerType.POST);
- sepMetaData.setHandlersInitialized(true);
- }
-
- boolean status = true;
- String[] roles = null;
-
- HandlerChainBaseImpl handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxwsHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- if (handlerChain != null)
- {
- roles = handlerChain.getRoles();
- status = handlerChain.handleMessage(msgContext);
- }
-
- // BP-1.0 R1027
- if (type == HandlerType.POST)
- HandlerChainBaseImpl.checkMustUnderstand(msgContext, roles);
-
- return status;
- }
-
- public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-
- HandlerChainBaseImpl handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxwsHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- return (handlerChain != null ? handlerChain.handleMessage(msgContext) : true);
- }
-
- public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
- {
- SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
-
- HandlerChainBaseImpl handlerChain = null;
- if (type == HandlerType.PRE)
- handlerChain = preHandlerChain;
- else if (type == HandlerType.ENDPOINT)
- handlerChain = jaxwsHandlerChain;
- else if (type == HandlerType.POST)
- handlerChain = postHandlerChain;
-
- return (handlerChain != null ? handlerChain.handleFault(msgContext) : true);
- }
-
- /**
- * Init the handler chain
- */
- private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
- {
- Set<String> handlerRoles = new HashSet<String>();
- List<HandlerInfo> hInfos = new ArrayList<HandlerInfo>();
-
- ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
- for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
- {
- handlerRoles.addAll(Arrays.asList(handlerMetaData.getSoapRoles()));
-
- Class hClass;
- String handlerClass = handlerMetaData.getHandlerClass();
- try
- {
- // Load the handler class using the deployments top level CL
- ClassLoader classLoader = sepMetaData.getClassLoader();
- hClass = classLoader.loadClass(handlerClass);
- }
- catch (ClassNotFoundException e)
- {
- throw new WSException("Cannot load handler class: " + handlerClass);
- }
-
- HashMap<String, Object> hConfig = new HashMap<String, Object>();
- UnifiedInitParamMetaData[] params = handlerMetaData.getInitParams();
- for (int j = 0; j < params.length; j++)
- {
- UnifiedInitParamMetaData param = params[j];
- hConfig.put(param.getParamName(), param.getParamValue());
- }
- HandlerInfo info = new HandlerInfo(hClass);
-
- log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + info);
- hInfos.add(info);
- }
-
- initHandlerChain(seInfo, hInfos, handlerRoles, type);
- }
-
- private void initHandlerChain(ServiceEndpointInfo seInfo, List<HandlerInfo> hInfos, Set<String> handlerRoles, HandlerType type)
- {
- log.debug("Init handler chain with [" + hInfos.size() + "] handlers");
-
- ServerHandlerChain handlerChain = new ServerHandlerChain(hInfos, handlerRoles, type);
- if (type == HandlerType.PRE)
- preHandlerChain = handlerChain;
- else if (type == HandlerType.ENDPOINT)
- jaxwsHandlerChain = handlerChain;
- else if (type == HandlerType.POST)
- postHandlerChain = handlerChain;
- }
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,23 +0,0 @@
-package org.jboss.ws.jaxws.client;
-
-import java.util.List;
-
-import javax.xml.ws.Binding;
-import javax.xml.ws.handler.Handler;
-
-import org.jboss.util.NotImplementedException;
-
-public class BindingImpl implements Binding
-{
-
- public List<Handler> getHandlerChain()
- {
- throw new NotImplementedException();
- }
-
- public void setHandlerChain(List<Handler> list)
- {
- throw new NotImplementedException();
- }
-
-}
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,60 +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.jaxws.client;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.ws.Binding;
-import javax.xml.ws.BindingProvider;
-
-
-/**
- * The BindingProvider interface provides access to the protocol binding and associated context objects
- * for request and response message processing.
- *
- * @author Thomas.Diesler at jboss.com
- * @since 04-Jul-2006
- */
-public class BindingProviderImpl implements BindingProvider
-{
- private Binding binding = new BindingImpl();
- private Map<String, Object> requestContext = new HashMap<String, Object>();
- private Map<String, Object> responseContext = new HashMap<String, Object>();
-
- public Map<String, Object> getRequestContext()
- {
- return requestContext;
- }
-
- public Map<String, Object> getResponseContext()
- {
- return responseContext;
- }
-
- public Binding getBinding()
- {
- return binding;
- }
-}
Copied: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java (from rev 705, trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java)
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,191 @@
+/*
+ * 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.jaxws.client;
+
+// $Id$
+
+import java.rmi.RemoteException;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.common.CommonClient;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.handler.HandlerChainExecutor;
+import org.jboss.ws.jaxws.handler.HandlerWrapper;
+import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
+import org.jboss.ws.jaxws.handler.PortInfoImpl;
+import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * Provides support for the dynamic invocation of a service endpoint.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Jul-2006
+ */
+public class ClientImpl extends CommonClient implements BindingProvider
+{
+ public ClientImpl(EndpointMetaData epMetaData, HandlerResolver handlerResolver)
+ {
+ super(epMetaData);
+ setTargetEndpointAddress(epMetaData.getEndpointAddress());
+ initBindingHandlerChain(epMetaData, handlerResolver);
+ }
+
+ // Init the cilent handler chain in the binding
+ private void initBindingHandlerChain(EndpointMetaData epMetaData, HandlerResolver handlerResolver)
+ {
+ BindingImpl binding = (BindingImpl)getBindingProvider().getBinding();
+ for (UnifiedHandlerMetaData handlerMetaData : epMetaData.getHandlers(HandlerType.PRE))
+ {
+ Class hClass;
+ String handlerClass = handlerMetaData.getHandlerClass();
+ try
+ {
+ // Load the handler class using the deployments top level CL
+ ClassLoader classLoader = epMetaData.getClassLoader();
+ hClass = classLoader.loadClass(handlerClass);
+ Handler handler = (Handler)hClass.newInstance();
+ binding.addHandler(new HandlerWrapper(handler));
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot load handler class: " + handlerClass);
+ }
+ }
+ if (handlerResolver != null)
+ {
+ PortInfoImpl portInfo = new PortInfoImpl(epMetaData);
+ for (Handler handler : handlerResolver.getHandlerChain(portInfo))
+ {
+ binding.addHandler(new HandlerWrapper(handler));
+ }
+ }
+ for (UnifiedHandlerMetaData handlerMetaData : epMetaData.getHandlers(HandlerType.POST))
+ {
+ Class hClass;
+ String handlerClass = handlerMetaData.getHandlerClass();
+ try
+ {
+ // Load the handler class using the deployments top level CL
+ ClassLoader classLoader = epMetaData.getClassLoader();
+ hClass = classLoader.loadClass(handlerClass);
+ Handler handler = (Handler)hClass.newInstance();
+ binding.addHandler(new HandlerWrapper(handler));
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot load handler class: " + handlerClass);
+ }
+ }
+ }
+
+ @Override
+ protected boolean callRequestHandlerChain(QName portName)
+ {
+ List<Handler> handlerChain = getBindingProvider().getBinding().getHandlerChain();
+ HandlerChainExecutor executor = new HandlerChainExecutor(handlerChain);
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ return executor.handleRequest(msgContext);
+ }
+
+ @Override
+ protected boolean callResponseHandlerChain(QName portName)
+ {
+ List<Handler> handlerChain = getBindingProvider().getBinding().getHandlerChain();
+ HandlerChainExecutor executor = new HandlerChainExecutor(handlerChain);
+ MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
+ return executor.handleResponse(msgContext);
+ }
+
+ @Override
+ protected void setInboundContextProperties()
+ {
+ // Mark the message context as outbound
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(false));
+ }
+
+ @Override
+ protected void setOutboundContextProperties()
+ {
+ // Mark the message context as outbound
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
+ }
+
+ public Object invoke(QName opName, Object[] args) throws RemoteException
+ {
+ // Associate a message context with the current thread
+ SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
+ MessageContextAssociation.pushMessageContext(msgContext);
+
+ try
+ {
+ Object retObj = invoke(opName, args, null, false);
+ return retObj;
+ }
+ finally
+ {
+ MessageContextAssociation.popMessageContext();
+ }
+ }
+
+ @Override
+ public void setTargetEndpointAddress(String endpointAddress)
+ {
+ getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
+ }
+
+ @Override
+ public String getTargetEndpointAddress()
+ {
+ return (String)getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+ }
+
+ public Map<String, Object> getRequestContext()
+ {
+ return getBindingProvider().getRequestContext();
+ }
+
+ public Map<String, Object> getResponseContext()
+ {
+ return getBindingProvider().getResponseContext();
+ }
+
+ public Binding getBinding()
+ {
+ return getBindingProvider().getBinding();
+ }
+}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -32,7 +32,6 @@
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
@@ -53,8 +52,8 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
import org.jboss.util.xml.DOMWriter;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
import org.jboss.ws.soap.SOAPBodyImpl;
import org.jboss.ws.soap.SOAPConnectionImpl;
@@ -70,24 +69,27 @@
// provide logging
private final Logger log = Logger.getLogger(DispatchImpl.class);
- private BindingProvider bindingProvider = new BindingProviderImpl();
+ private BindingProvider bindingProvider;
private EndpointMetaData epMetaData;
private JAXBContext jaxbContext;
private Class<T> type;
private Mode mode;
- public DispatchImpl(ServiceMetaData serviceMetaData, QName portName, Class<T> type, Mode mode)
+ public DispatchImpl(EndpointMetaData epMetaData, Class<T> type, Mode mode)
{
+ this.bindingProvider = new BindingProviderImpl(epMetaData.getBindingId());
+ this.epMetaData = epMetaData;
this.type = type;
this.mode = mode;
- initDispatch(serviceMetaData, portName);
+ initDispatch();
}
- public DispatchImpl(ServiceMetaData serviceMetaData, QName portName, JAXBContext jbc, Mode mode)
+ public DispatchImpl(EndpointMetaData epMetaData, JAXBContext jbc, Mode mode)
{
+ this.epMetaData = epMetaData;
this.jaxbContext = jbc;
this.mode = mode;
- initDispatch(serviceMetaData, portName);
+ initDispatch();
}
public Object invoke(Object obj)
@@ -145,17 +147,8 @@
return bindingProvider.getBinding();
}
- private void initDispatch(ServiceMetaData serviceMetaData, QName portName)
+ private void initDispatch()
{
- epMetaData = serviceMetaData.getEndpoint(portName);
- if (epMetaData == null && serviceMetaData.getEndpoints().size() == 1)
- {
- log.warn("Cannot find port meta data for: " + portName);
- epMetaData = serviceMetaData.getEndpoints().get(0);
- }
- if (epMetaData == null)
- throw new WebServiceException("Cannot find port meta data for: " + portName);
-
if (type == SOAPMessage.class && mode == Mode.MESSAGE)
{
// accepted
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/JAXWSClient.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,113 +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.jaxws.client;
-
-// $Id$
-
-import java.rmi.RemoteException;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Binding;
-import javax.xml.ws.BindingProvider;
-
-import org.jboss.ws.common.CommonClient;
-import org.jboss.ws.jaxws.handler.MessageContextJAXWS;
-import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
-
-/**
- * Provides support for the dynamic invocation of a service endpoint.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Jul-2006
- */
-public class JAXWSClient extends CommonClient implements BindingProvider
-{
- private BindingProvider bindingProvider = new BindingProviderImpl();
-
- public JAXWSClient(EndpointMetaData epMetaData)
- {
- super(epMetaData);
- setTargetEndpointAddress(epMetaData.getEndpointAddress());
- }
-
- @Override
- protected boolean callRequestHandlerChain(QName portName)
- {
- return true;
- }
-
- @Override
- protected boolean callResponseHandlerChain(QName portName)
- {
- return true;
- }
-
- public Object invoke(QName opName, Object[] args) throws RemoteException
- {
- // Associate a message context with the current thread
- SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
-
- // Mark the message context as outbound
- msgContext.setProperty(MessageContextJAXWS.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
-
- MessageContextAssociation.pushMessageContext(msgContext);
- try
- {
- Object retObj = invoke(opName, args, null, false);
- return retObj;
- }
- finally
- {
- MessageContextAssociation.popMessageContext();
- }
- }
-
- @Override
- public void setTargetEndpointAddress(String endpointAddress)
- {
- getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
- }
-
- @Override
- public String getTargetEndpointAddress()
- {
- return (String)getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
- }
-
- public Map<String, Object> getRequestContext()
- {
- return bindingProvider.getRequestContext();
- }
-
- public Map<String, Object> getResponseContext()
- {
- return bindingProvider.getResponseContext();
- }
-
- public Binding getBinding()
- {
- return bindingProvider.getBinding();
- }
-}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/PortProxy.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/PortProxy.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/PortProxy.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -51,7 +51,7 @@
private static final Logger log = Logger.getLogger(PortProxy.class);
// The underlying Call
- private JAXWSClient client;
+ private ClientImpl client;
// List<Method> of the Stub methods
private List stubMethods;
// List<Method> of the Object methods
@@ -69,7 +69,7 @@
standardProperties.add(BindingProvider.SOAPACTION_URI_PROPERTY);
}
- public PortProxy(JAXWSClient client)
+ public PortProxy(ClientImpl client)
{
this.client = client;
this.stubMethods = Arrays.asList(BindingProvider.class.getMethods());
@@ -84,14 +84,14 @@
String methodName = method.getName();
if (stubMethods.contains(method))
{
- Method stubMethod = JAXWSClient.class.getMethod(methodName, method.getParameterTypes());
+ Method stubMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
return stubMethod.invoke(client, args);
}
// An invocation on proxy's Object class
else if (objectMethods.contains(method))
{
- Method objMethod = JAXWSClient.class.getMethod(methodName, method.getParameterTypes());
+ Method objMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
return objMethod.invoke(client, args);
}
Copied: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java (from rev 705, trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java)
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingImpl.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,84 @@
+/*
+ * 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.jaxws.core;
+
+// $Id: $
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Binding;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+
+/**
+ * The Binding interface is the base interface for JAX-WS protocol bindings.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public abstract class BindingImpl implements Binding
+{
+ private static Logger log = Logger.getLogger(BindingImpl.class);
+
+ private List<Handler> handlerChain = new ArrayList<Handler>();
+
+ /** On the client side, generate the Object from IN parameters. */
+ public abstract Object 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 */
+ public abstract EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException;
+
+ /** On the server side, generate the Object from OUT parameters in the Invocation object. */
+ public abstract Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException;
+
+ /** On the client side, extract the OUT parameters from the Object and return them to the client. */
+ public abstract void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException;
+
+ public List<Handler> getHandlerChain()
+ {
+ return handlerChain;
+ }
+
+ public void addHandler(Handler handler)
+ {
+ log.debug("addHandler: " + handler);
+ handlerChain.add(handler);
+ }
+
+ public void setHandlerChain(List<Handler> handlerChain)
+ {
+ log.debug("setHandlerChain: " + handlerChain);
+ this.handlerChain = handlerChain;
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java (from rev 705, trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java)
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/client/BindingProviderImpl.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -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.jaxws.core;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.binding.soap.JAXWSBindingProviderMessage;
+import org.jboss.ws.binding.soap.JAXWSBindingProviderPayload;
+import org.jboss.ws.metadata.EndpointMetaData;
+
+/**
+ * The BindingProvider interface provides access to the protocol binding and associated context objects
+ * for request and response message processing.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class BindingProviderImpl implements BindingProvider
+{
+ private BindingImpl binding;
+ private Map<String, Object> requestContext = new HashMap<String, Object>();
+ private Map<String, Object> responseContext = new HashMap<String, Object>();
+
+ public BindingProviderImpl(EndpointMetaData epMetaData)
+ {
+ initBinding(epMetaData.getBindingId(), epMetaData.getServiceMode());
+ }
+
+ public BindingProviderImpl(String bindingId)
+ {
+ initBinding(bindingId, null);
+ }
+
+ private void initBinding(String bindingId, Mode serviceMode)
+ {
+ if (serviceMode == Mode.MESSAGE)
+ {
+ binding = new JAXWSBindingProviderMessage();
+ }
+ else if (serviceMode == Mode.PAYLOAD)
+ {
+ binding = new JAXWSBindingProviderPayload();
+ }
+ else if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ {
+ binding = new SOAPBindingImpl();
+ }
+ else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ {
+ throw new NotImplementedException();
+ }
+ else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+ {
+ binding = new HTTPBindingImpl();
+ }
+ else
+ {
+ throw new WebServiceException("Unsupported binding: " + bindingId);
+ }
+ }
+
+ public Map<String, Object> getRequestContext()
+ {
+ return requestContext;
+ }
+
+ public Map<String, Object> getResponseContext()
+ {
+ return responseContext;
+ }
+
+ public Binding getBinding()
+ {
+ return binding;
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,69 @@
+/*
+ * 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.jaxws.core;
+
+// $Id: $
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.http.HTTPBinding;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.metadata.OperationMetaData;
+
+/**
+ * The HTTPBinding interface is an abstraction for the XML/HTTP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class HTTPBindingImpl extends BindingImpl implements HTTPBinding
+{
+
+ @Override
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object reqMessage) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object resMessage, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ throw new NotImplementedException();
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/HTTPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,867 @@
+/*
+ * 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.jaxws.core;
+
+// $Id: $
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.xerces.xs.XSElementDeclaration;
+import org.apache.xerces.xs.XSTypeDefinition;
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMUtils;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.binding.BindingException;
+import org.jboss.ws.binding.EndpointInvocation;
+import org.jboss.ws.binding.UnboundHeader;
+import org.jboss.ws.common.SOAPMessageContextBase;
+import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
+import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.soap.MessageFactoryImpl;
+import org.jboss.ws.soap.NameImpl;
+import org.jboss.ws.soap.SOAPBodyElementDoc;
+import org.jboss.ws.soap.SOAPBodyElementRpc;
+import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.soap.SOAPElementImpl;
+import org.jboss.ws.soap.SOAPFactoryImpl;
+import org.jboss.ws.soap.SOAPFaultImpl;
+import org.jboss.ws.soap.SOAPHeaderElementImpl;
+import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.soap.attachment.AttachmentPartImpl;
+import org.jboss.ws.soap.attachment.CIDGenerator;
+import org.jboss.ws.utils.JavaUtils;
+import org.jboss.ws.utils.MimeUtils;
+import org.jboss.xb.binding.NamespaceRegistry;
+import org.w3c.dom.Element;
+
+/**
+ * The SOAPBinding interface is an abstraction for the SOAP binding.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 04-Jul-2006
+ */
+public class SOAPBindingImpl extends BindingImpl implements SOAPBinding
+{
+ private static Logger log = Logger.getLogger(SOAPBindingImpl.class);
+
+ private boolean mtomEnabled;
+ private Set<URI> roles = new HashSet<URI>();
+
+ public MessageFactory getMessageFactory()
+ {
+ return new MessageFactoryImpl();
+ }
+
+ public Set<URI> getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(Set<URI> roles)
+ {
+ this.roles = roles;
+ }
+
+ public SOAPFactory getSOAPFactory()
+ {
+ return new SOAPFactoryImpl();
+ }
+
+ public boolean isMTOMEnabled()
+ {
+ return mtomEnabled;
+ }
+
+ public void setMTOMEnabled(boolean flag)
+ {
+ this.mtomEnabled = flag;
+ }
+
+ /** Create the SOAP-1.1 message */
+ private SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
+ {
+ MessageFactoryImpl factory = new MessageFactoryImpl();
+ factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
+ return factory.createMessage();
+ }
+
+ /** On the client side, generate the payload from IN parameters. */
+ public Object bindRequestMessage(OperationMetaData opMetaData, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders) throws BindingException
+ {
+ log.debug("bindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setMessage(reqMessage);
+
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getQName();
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+
+ log.debug("Create RPC body element: " + opName);
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBodyElement;
+ SOAPContentElement contentElement = addParameterToMessage(paramMetaData, value, soapElement);
+
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getInputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getRequestParamValue(xmlName);
+
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = reqMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(paramMetaData, value, cidGenerator);
+ reqMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? (SOAPElement)soapHeader : soapBody;
+ addParameterToMessage(paramMetaData, value, soapElement);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ // Add unbound headers
+ if (unboundHeaders != null)
+ {
+ Iterator it = unboundHeaders.values().iterator();
+ while (it.hasNext())
+ {
+ UnboundHeader unboundHeader = (UnboundHeader)it.next();
+ if (unboundHeader.getMode() != ParameterMode.OUT)
+ {
+ QName xmlName = unboundHeader.getXmlName();
+ Object value = unboundHeader.getHeaderValue();
+
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
+
+ SOAPContentElement contentElement = new SOAPHeaderElementImpl(soapName);
+ contentElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+ contentElement.setObjectValue(value);
+
+ log.debug("Add unboundHeader element: " + soapName);
+ soapHeader.addChildElement(contentElement);
+ }
+ }
+ }
+
+ // Set the SOAPAction
+ MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+ String soapAction = opMetaData.getSOAPAction();
+ mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+
+ return reqMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
+ public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
+ {
+ log.debug("unbindRequestMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // Read the SOAPEnvelope from the reqMessage
+ SOAPMessage reqMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Construct the endpoint invocation object
+ EndpointInvocation epInv = new EndpointInvocation(opMetaData);
+
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ if (opMetaData.isMessageEndpoint() == false)
+ {
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
+ Name elName = soapBodyElement.getElementName();
+
+ QName elQName = new QName(elName.getURI(), elName.getLocalName(), elName.getPrefix());
+ elQName = namespaceRegistry.registerQName(elQName);
+
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.getMode() == ParameterMode.OUT)
+ {
+ epInv.setRequestParamValue(xmlName, null);
+ }
+ else
+ {
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader() == false)
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBodyElement, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Document style
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, reqMessage);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ if (paramMetaData.getMode() == ParameterMode.IN)
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, true);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ else
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapBody, false);
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ }
+
+ // Generic message endpoint
+ else
+ {
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = soapBody.getChildElements().next();
+ epInv.setRequestParamValue(xmlName, value);
+ }
+ }
+
+ return epInv;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the server side, generate the payload from OUT parameters. */
+ public Object bindResponseMessage(OperationMetaData opMetaData, EndpointInvocation epInv) throws BindingException
+ {
+ log.debug("bindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ // Associate current message with message context
+ SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
+ msgContext.setMessage(resMessage);
+
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWayOperation())
+ {
+ resMessage.getSOAPPart().setContent(null);
+ return resMessage;
+ }
+
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Get the namespace registry
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ QName opQName = opMetaData.getResponseName();
+
+ Name opName = new NameImpl(namespaceRegistry.registerQName(opQName));
+ SOAPBodyElement soapBodyElement = new SOAPBodyElementRpc(opName);
+
+ soapBodyElement = (SOAPBodyElement)soapBody.addChildElement(soapBodyElement);
+
+ // Add the return to the message
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBodyElement);
+ epInv.setReturnValue(soapElement);
+ soapElement.setObjectValue(value);
+ }
+ }
+
+ // Add the out parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Object value = epInv.getResponseParamValue(xmlName);
+ if (paramMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ }
+ else
+ {
+ if (paramMetaData.isInHeader())
+ {
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ else
+ {
+ addParameterToMessage(paramMetaData, value, soapBodyElement);
+ }
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ Object value = epInv.getReturnValue();
+ if (opMetaData.isDocumentWrapped())
+ value = ParameterWrapping.wrapResponseParameter(opMetaData, value);
+
+ if (retMetaData.isSwA())
+ {
+ CIDGenerator cidGenerator = resMessage.getCidGenerator();
+ AttachmentPart part = createAttachmentPart(retMetaData, value, cidGenerator);
+ resMessage.addAttachmentPart(part);
+ epInv.setReturnValue(part);
+ }
+ else
+ {
+ SOAPContentElement soapElement = addParameterToMessage(retMetaData, value, soapBody);
+ epInv.setReturnValue(soapElement);
+ }
+ }
+
+ // Add the out header parameters to the message
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = epInv.getResponseParamValue(xmlName);
+ addParameterToMessage(paramMetaData, value, soapHeader);
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+
+ return resMessage;
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ return null;
+ }
+ }
+
+ /** On the client side, extract the OUT parameters from the payload and return them to the client. */
+ public void unbindResponseMessage(OperationMetaData opMetaData, Object payload, EndpointInvocation epInv, Map<QName, UnboundHeader> unboundHeaders)
+ throws BindingException
+ {
+ log.debug("unbindResponseMessage: " + opMetaData.getQName());
+
+ try
+ {
+ // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
+ // Specifically, the HTTP response entity-body must be empty.
+ if (opMetaData.isOneWayOperation() == true)
+ {
+ return;
+ }
+
+ // WS-Addressing might redirect the response, which results in an empty envelope
+ SOAPMessage resMessage = (SOAPMessage)payload;
+ SOAPEnvelope soapEnvelope = resMessage.getSOAPPart().getEnvelope();
+ if (soapEnvelope == null)
+ {
+ return;
+ }
+
+ // Get the SOAP message context that is associated with the current thread
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext == null)
+ throw new WSException("MessageContext not available");
+
+ SOAPHeader soapHeader = soapEnvelope.getHeader();
+ SOAPBody soapBody = soapEnvelope.getBody();
+ Iterator bodyChildren = soapBody.getChildElements();
+
+ SOAPBodyElement soapBodyElement = null;
+ if (bodyChildren.hasNext() != false)
+ soapBodyElement = (SOAPBodyElement)bodyChildren.next();
+
+ // Translate the SOAPFault to an exception and throw it
+ if (soapBodyElement instanceof SOAPFaultImpl)
+ {
+ SOAPFaultImpl soapFault = (SOAPFaultImpl)soapBodyElement;
+ SOAPFaultException faultEx = SOAPFaultExceptionHelper.getSOAPFaultException(soapFault);
+ throw faultEx;
+ }
+
+ // Extract unbound OUT headers
+ if (unboundHeaders != null)
+ {
+ Map<QName, UnboundHeader> outHeaders = new HashMap<QName, UnboundHeader>();
+ Iterator itHeaderElements = soapHeader.getChildElements();
+ while (itHeaderElements.hasNext())
+ {
+ SOAPContentElement soapHeaderElement = (SOAPHeaderElementImpl)itHeaderElements.next();
+ Name elName = soapHeaderElement.getElementName();
+ QName xmlName = new QName(elName.getURI(), elName.getLocalName());
+
+ UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
+ if (unboundHeader != null)
+ {
+ soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
+
+ // Do the unmarshalling
+ Object value = soapHeaderElement.getObjectValue();
+ unboundHeader.setHeaderValue(value);
+ outHeaders.put(xmlName, unboundHeader);
+ }
+ }
+ unboundHeaders.clear();
+ unboundHeaders.putAll(outHeaders);
+ }
+
+ Style style = opMetaData.getStyle();
+ if (style == Style.RPC)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBodyElement, false);
+ epInv.setReturnValue(value);
+ }
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(paramMetaData, resMessage);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ else
+ {
+ SOAPElement soapElement = paramMetaData.isInHeader() ? soapHeader : (SOAPElement)soapBodyElement;
+ Object value = getParameterFromMessage(paramMetaData, soapElement, false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ else if (style == Style.DOCUMENT)
+ {
+ ParameterMetaData retMetaData = opMetaData.getReturnParameter();
+
+ // WS-Eventing has no message part for UnsubscribeResponseMsg
+ if (retMetaData != null)
+ {
+ if (retMetaData.isSwA())
+ {
+ Object value = getAttachmentFromMessage(retMetaData, resMessage);
+ epInv.setReturnValue(value);
+ }
+ else
+ {
+ Object value = getParameterFromMessage(retMetaData, soapBody, false);
+ epInv.setReturnValue(value);
+ }
+
+ for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ if (paramMetaData.isInHeader())
+ {
+ Object value = getParameterFromMessage(paramMetaData, soapHeader, false);
+ epInv.setResponseParamValue(xmlName, value);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new WSException("Unsupported message style: " + style);
+ }
+ }
+ catch (Exception e)
+ {
+ handleException(e);
+ }
+ }
+
+ private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
+ {
+ String partName = paramMetaData.getXmlName().getLocalPart();
+ Set mimeTypes = paramMetaData.getMimeTypes();
+
+ AttachmentPart part = new AttachmentPartImpl();
+ if (value instanceof DataHandler)
+ {
+ DataHandler handler = (DataHandler)value;
+ String mimeType = MimeUtils.getBaseMimeType(handler.getContentType());
+
+ if (mimeTypes != null && !MimeUtils.isMemberOf(mimeType, mimeTypes))
+ throw new BindingException("Mime type " + mimeType + " not allowed for parameter " + partName + " allowed types are " + mimeTypes);
+
+ part.setDataHandler((DataHandler)value);
+ }
+ else
+ {
+ String mimeType = null;
+ if (mimeTypes != null && mimeTypes.size() > 0)
+ {
+ mimeType = (String)mimeTypes.iterator().next();
+ }
+ else
+ {
+ mimeType = MimeUtils.resolveMimeType(value);
+ }
+
+ if (mimeType == null)
+ throw new BindingException("Could not determine mime type for attachment parameter: " + partName);
+
+ part.setContent(value, mimeType);
+ }
+
+ if (paramMetaData.isSwA())
+ {
+ String swaCID = '<' + partName + "=" + cidGenerator.generateFromCount() + '>';
+ part.setContentId(swaCID);
+ }
+ if (paramMetaData.isXOP())
+ {
+ String xopCID = '<' + cidGenerator.generateFromName(partName) + '>';
+ part.setContentId(xopCID);
+ }
+
+ return part;
+ }
+
+ private Object getAttachmentFromMessage(ParameterMetaData paramMetaData, SOAPMessage message) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+
+ AttachmentPart part = ((SOAPMessageImpl)message).getAttachmentByPartName(xmlName.getLocalPart());
+ if (part == null)
+ throw new BindingException("Could not locate attachment for parameter: " + paramMetaData.getXmlName());
+
+ return part;
+ }
+
+ /** Marshall the given parameter and add it to the SOAPMessage */
+ private SOAPContentElement addParameterToMessage(ParameterMetaData paramMetaData, Object value, SOAPElement soapElement) throws SOAPException, BindingException
+ {
+ QName xmlName = paramMetaData.getXmlName();
+ Class javaType = paramMetaData.getJavaType();
+
+ if (value != null && paramMetaData.isXOP() == false)
+ {
+ Class valueType = value.getClass();
+ if (JavaUtils.isAssignableFrom(javaType, valueType) == false)
+ throw new BindingException("javaType " + javaType.getName() + " is not assignable from: " + valueType.getName());
+ }
+
+ // Make sure we have a prefix on qualified names
+ if (xmlName.getNamespaceURI().length() > 0)
+ {
+ SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
+ NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
+ xmlName = namespaceRegistry.registerQName(xmlName);
+ }
+
+ Name soapName = new NameImpl(xmlName.getLocalPart(), xmlName.getPrefix(), xmlName.getNamespaceURI());
+ if (paramMetaData.isSOAPArrayParam())
+ soapName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement contentElement;
+ if (soapElement instanceof SOAPHeader)
+ {
+ contentElement = new SOAPHeaderElementImpl(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ Style style = paramMetaData.getOperationMetaData().getStyle();
+ if (style == Style.DOCUMENT)
+ {
+ contentElement = new SOAPBodyElementDoc(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ else
+ {
+ contentElement = new SOAPContentElement(soapName);
+ soapElement.addChildElement(contentElement);
+ }
+ }
+
+ contentElement.setParamMetaData(paramMetaData);
+
+ if (paramMetaData.isSOAPArrayParam())
+ contentElement.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ // The object value needs to be set after xmime:contentType
+ if (paramMetaData.isXOP() )
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)
+ MessageContextAssociation.peekMessageContext().getMessage();
+ soapMessage.setXOPMessage(true);
+ }
+
+ contentElement.setObjectValue(value);
+
+ return contentElement;
+ }
+
+ /** Unmarshall a message element and add it to the parameter list
+ * @param optional TODO*/
+ private Object getParameterFromMessage(ParameterMetaData paramMetaData, SOAPElement soapElement, boolean optional) throws BindingException
+ {
+ Name xmlName = new NameImpl(paramMetaData.getXmlName());
+ Name soapArrayName = new NameImpl("Array", Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+
+ SOAPContentElement soapContentElement = null;
+ Iterator childElements = soapElement.getChildElements();
+ while (childElements.hasNext())
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // If this message was manipulated by a handler the child may not be a content element
+ if (!(childElement instanceof SOAPContentElement))
+ childElement = (SOAPContentElement)soapElement.replaceChild(new SOAPContentElement(childElement), childElement);
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+
+ if (xmlName.equals(elName))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+
+ if (soapArrayName.equals(elName))
+ {
+ QName compXMLName = paramMetaData.getXmlName();
+ Element compElement = DOMUtils.getFirstChildElement(aux);
+ if (compElement.getNodeName().equals(compXMLName.getLocalPart()))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ break;
+ }
+ }
+ }
+
+ // If matching by name fails, try to match by xmlType
+ // This maybe necessary when wsa:Action dispatches to the operation
+ if (soapContentElement == null)
+ {
+ childElements = soapElement.getChildElements();
+ OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+ if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
+ {
+ SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
+
+ // The parameters are expected to be lazy
+ SOAPContentElement aux = (SOAPContentElement)childElement;
+ Name elName = aux.getElementName();
+ QName elType = null;
+
+ XSElementDeclaration xsdElement = typesMetaData.getSchemaModel().getElementDeclaration(elName.getLocalName(), elName.getURI());
+ if (xsdElement != null && xsdElement.getTypeDefinition() != null)
+ {
+ XSTypeDefinition xsdType = xsdElement.getTypeDefinition();
+ elType = new QName(xsdType.getNamespace(), xsdType.getName());
+ }
+
+ if (paramMetaData.getXmlType().equals(elType))
+ {
+ soapContentElement = aux;
+ soapContentElement.setParamMetaData(paramMetaData);
+ }
+ }
+ }
+
+ if (soapContentElement == null && optional == false)
+ throw new JAXRPCException("Cannot find child element: " + xmlName);
+
+ if(paramMetaData.isXOP())
+ {
+ SOAPMessageImpl soapMessage = (SOAPMessageImpl)
+ MessageContextAssociation.peekMessageContext().getMessage();
+ soapMessage.setXOPMessage(true);
+ }
+ return soapContentElement;
+ }
+
+ private void handleException(Exception ex) throws BindingException
+ {
+ if (ex instanceof RuntimeException)
+ throw (RuntimeException)ex;
+
+ if (ex instanceof BindingException)
+ throw (BindingException)ex;
+
+ throw new BindingException(ex);
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainBaseImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainBaseImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainBaseImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,466 +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.jaxws.handler;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.soap.SOAPFaultException;
-import javax.xml.soap.Name;
-import javax.xml.soap.SOAPEnvelope;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPPart;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.Handler;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.util.xml.DOMWriter;
-import org.jboss.ws.Constants;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ParameterMetaData;
-import org.jboss.ws.soap.SOAPEnvelopeImpl;
-import org.jboss.ws.soap.SOAPMessageImpl;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- * <p/>
- * Abstracts the policy and mechanism for the invocation of the registered handlers.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public abstract class HandlerChainBaseImpl
-{
- private static Logger log = Logger.getLogger(HandlerChainBaseImpl.class);
-
- public static final int STATE_DOES_NOT_EXIST = 0;
- public static final int STATE_CREATED = 1;
- public static final int STATE_READY = 2;
- public static final int STATE_DESTROYED = 3;
-
- // The List<Entry> objects
- protected List<HandlerEntry> handlers = new ArrayList<HandlerEntry>();
- // The roles associated with the handler chain
- protected Set<String> roles = new HashSet<String>();
- // The index of the first handler that returned false during processing
- protected int falseIndex = -1;
- // The state of this handler chain
- protected int state;
-
- /**
- * Constructs a handler chain with the given handlers infos
- */
- public HandlerChainBaseImpl(List<HandlerInfo> infos, Set roles)
- {
- log.debug("Create a handler chain for roles: " + roles);
- addHandlersToChain(infos, roles);
- }
-
- /**
- * Initialize the a handler chain with the given handlers infos
- *
- * @throws javax.xml.rpc.JAXRPCException If any error during initialization
- */
- private void addHandlersToChain(List<HandlerInfo> infos, Set roleSet)
- {
- try
- {
- if (infos != null)
- {
- for (int i = 0; i < infos.size(); i++)
- {
- HandlerInfo info = (HandlerInfo)infos.get(i);
- HandlerWrapper handler = new HandlerWrapper((Handler)info.getHandlerClass().newInstance());
- handlers.add(new HandlerEntry(handler, info));
- }
- }
- if (roleSet != null)
- {
- roles.addAll(roleSet);
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WebServiceException("Cannot initialize handler chain", ex);
- }
-
- // set state to created
- state = STATE_CREATED;
- }
-
- /**
- * Get the state of this handler chain
- */
- public int getState()
- {
- return state;
- }
-
- /**
- * Indicates the end of lifecycle for a HandlerChain.
- *
- * @throws javax.xml.rpc.JAXRPCException If any error during destroy
- */
- public void close()
- {
- log.debug("destroy");
- for (int i = 0; i < handlers.size(); i++)
- {
- HandlerEntry entry = (HandlerEntry)handlers.get(i);
- entry.handler.close(null);
- }
- handlers.clear();
-
- // set state to destroyed
- state = STATE_DESTROYED;
- }
-
- /**
- * Gets SOAP actor roles registered for this HandlerChain at this SOAP node. The returned array includes the
- * special SOAP actor next.
- *
- * @return SOAP Actor roles as URIs
- */
- public String[] getRoles()
- {
- String[] arr = new String[roles.size()];
- roles.toArray(arr);
- return arr;
- }
-
- /**
- * Sets SOAP Actor roles for this HandlerChain. This specifies the set of roles in which this HandlerChain is to act
- * for the SOAP message processing at this SOAP node. These roles assumed by a HandlerChain must be invariant during
- * the processing of an individual SOAP message through the HandlerChain.
- * <p/>
- * A HandlerChain always acts in the role of the special SOAP actor next. Refer to the SOAP specification for the
- * URI name for this special SOAP actor. There is no need to set this special role using this method.
- *
- * @param soapActorNames URIs for SOAP actor name
- */
- public void setRoles(String[] soapActorNames)
- {
- List<String> newRoles = Arrays.asList(soapActorNames);
- log.debug("setRoles: " + newRoles);
-
- roles.clear();
- roles.addAll(newRoles);
- }
-
- public boolean handleMessage(MessageContext msgContext)
- {
- Boolean outbound = (Boolean)msgContext.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- if (outbound == null)
- throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
-
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
- }
-
- private boolean handleRequest(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleRequest");
-
- int handlerIndex = 0;
- Handler currHandler = null;
- try
- {
- for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
- {
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
- {
- SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
-
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle request: " + currHandler);
- doNext = currHandler.handleMessage(msgContext);
-
- if (log.isTraceEnabled())
- {
- SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
- }
- }
- catch (RuntimeException e)
- {
- log.error("RuntimeException in request handler", e);
- doNext = false;
- throw e;
- }
- finally
- {
- // we start at this index in the response chain
- if (doNext == false)
- falseIndex = (handlerIndex - 1);
-
- log.debug("Exit: handleRequest with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- private boolean handleResponse(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleResponse");
-
- int handlerIndex = handlers.size() - 1;
- if (falseIndex != -1)
- handlerIndex = falseIndex;
-
- Handler currHandler = null;
- try
- {
- for (; doNext && handlerIndex >= 0; handlerIndex--)
- {
- String lastMessageTrace = null;
- if (log.isTraceEnabled())
- {
- SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
-
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle response: " + currHandler);
- doNext = currHandler.handleMessage(msgContext);
-
- if (log.isTraceEnabled())
- {
- SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
- SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
- lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
- }
- }
- }
- catch (RuntimeException rte)
- {
- log.error("RuntimeException in response handler", rte);
- doNext = false;
- throw rte;
- }
- finally
- {
- // we start at this index in the fault chain
- if (doNext == false)
- falseIndex = (handlerIndex - 1);
-
- log.debug("Exit: handleResponse with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- /**
- * Initiates the SOAP fault processing for this handler chain.
- * <p/>
- * In this implementation, the fault handler chain starts processing from the same Handler
- * instance (that returned false) and goes backward in the execution sequence.
- *
- * @return Returns true if all handlers in chain have been processed.
- * Returns false if a handler in the chain returned false from its handleFault method.
- * @throws javax.xml.rpc.JAXRPCException if any processing error happens
- */
- public boolean handleFault(MessageContext msgContext)
- {
- boolean doNext = true;
-
- if (handlers.size() > 0)
- {
- log.debug("Enter: handleFault");
-
- try
- {
- int handlerIndex = handlers.size() - 1;
- if (falseIndex != -1)
- handlerIndex = falseIndex;
-
- Handler currHandler = null;
- for (; doNext && handlerIndex >= 0; handlerIndex--)
- {
- currHandler = ((HandlerEntry)handlers.get(handlerIndex)).getHandler();
- log.debug("Handle fault: " + currHandler);
- doNext = currHandler.handleFault(msgContext);
- }
- }
- finally
- {
- log.debug("Exit: handleFault with status: " + doNext);
- }
- }
-
- return doNext;
- }
-
- /**
- * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
- */
- protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
- {
- try
- {
- SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
- String envString = DOMWriter.printNode(soapEnv, true);
- if (envString.equals(lastMessageTrace) == false)
- {
- log.debug(envString);
- lastMessageTrace = envString;
- }
- return lastMessageTrace;
- }
- catch (SOAPException e)
- {
- log.error("Cannot get SOAPEnvelope", e);
- return null;
- }
- }
-
- /**
- * Get the handler at the requested position
- */
- protected Handler getHandlerAt(int pos)
- {
- if (pos < 0 || handlers.size() <= pos)
- throw new IllegalArgumentException("No handler at position: " + pos);
-
- HandlerEntry entry = (HandlerEntry)handlers.get(pos);
- return entry.handler;
- }
-
- /**
- * R1027 A RECEIVER MUST generate a "soap:MustUnderstand" fault when a
- * message contains a mandatory header block (i.e., one that has a
- * soap:mustUnderstand attribute with the value "1") targeted at the
- * receiver (via soap:actor) that the receiver does not understand.
- */
- public static void checkMustUnderstand(SOAPMessageContextJAXWS msgContext, String[] roles)
- {
- SOAPHeaderElement mustUnderstandHeaderElement = null;
- List roleList = (roles != null ? Arrays.asList(roles) : new ArrayList());
- try
- {
- SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getMessage();
-
- // A SOAPHeaderElement is possibly bound to the endpoint operation
- // in order to check that we need a the opMetaData
- OperationMetaData opMetaData = msgContext.getOperationMetaData();
- if (opMetaData == null)
- {
- // The security handler must have decrypted the incomming message
- // before the dispatch target operation can be known
- EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
- opMetaData = soapMessage.getOperationMetaData(epMetaData);
- }
-
- SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
- if (soapEnvelope != null && soapEnvelope.getHeader() != null)
- {
- Iterator it = soapEnvelope.getHeader().examineAllHeaderElements();
- while (it.hasNext() && mustUnderstandHeaderElement == null)
- {
- SOAPHeaderElement soapHeaderElement = (SOAPHeaderElement)it.next();
- Name name = soapHeaderElement.getElementName();
- QName xmlName = new QName(name.getURI(), name.getLocalName());
-
- ParameterMetaData paramMetaData = (opMetaData != null ? opMetaData.getParameter(xmlName) : null);
- boolean isBoundHeader = (paramMetaData != null && paramMetaData.isInHeader());
-
- if (soapHeaderElement.getMustUnderstand() && isBoundHeader == false)
- {
- String actor = soapHeaderElement.getActor();
- boolean noActor = (actor == null || actor.length() == 0);
- boolean nextActor = Constants.URI_SOAP11_NEXT_ACTOR.equals(actor);
- if (noActor || nextActor || roleList.contains(actor))
- {
- mustUnderstandHeaderElement = soapHeaderElement;
- }
- }
- }
- }
- }
- catch (SOAPException ex)
- {
- log.error("Cannot check mustUnderstand for headers", ex);
- }
-
- if (mustUnderstandHeaderElement != null)
- {
- QName faultCode = Constants.SOAP11_FAULT_CODE_MUST_UNDERSTAND;
- String faultString = "Unprocessed 'mustUnderstand' header element: " + mustUnderstandHeaderElement.getElementName();
- throw new SOAPFaultException(faultCode, faultString, null, null);
- }
- }
-
- /**
- * An entry in the handler list
- */
- private class HandlerEntry
- {
- private HandlerWrapper handler;
- private HandlerInfo info;
-
- public HandlerEntry(HandlerWrapper handler, HandlerInfo info)
- {
- this.handler = handler;
- this.info = info;
- }
-
- public Handler getHandler()
- {
- return handler;
- }
-
- public HandlerInfo getInfo()
- {
- return info;
- }
- }
-}
Added: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,262 @@
+/*
+ * 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.jaxws.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPPart;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.xml.DOMWriter;
+import org.jboss.ws.soap.SOAPEnvelopeImpl;
+
+/**
+ * Executes a list of JAXWS handlers.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 06-May-2004
+ */
+public class HandlerChainExecutor
+{
+ private static Logger log = Logger.getLogger(HandlerChainExecutor.class);
+
+ // The List<Entry> objects
+ protected List<HandlerWrapper> handlers = new ArrayList<HandlerWrapper>();
+ // The index of the first handler that returned false during processing
+ protected int falseIndex = -1;
+
+ /**
+ * Constructs a handler chain with the given handlers
+ */
+ public HandlerChainExecutor(List<Handler> handlerList)
+ {
+ log.debug("Create a handler executor: " + handlerList);
+ for (Handler handler : handlerList)
+ {
+ HandlerWrapper wrapper = new HandlerWrapper(handler);
+ handlers.add(wrapper);
+ }
+ }
+
+ /**
+ * Indicates the end of lifecycle for a HandlerChain.
+ */
+ public void close()
+ {
+ log.debug("close");
+ for (Handler handler : handlers)
+ {
+ handler.close(null);
+ }
+ }
+
+ public boolean handleRequest(MessageContext msgContext)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleOutbound");
+
+ int handlerIndex = 0;
+ Handler currHandler = null;
+ try
+ {
+ for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
+ {
+ String lastMessageTrace = null;
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+
+ currHandler = handlers.get(handlerIndex);
+ log.debug("Handle outbound: " + currHandler);
+ doNext = currHandler.handleMessage(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+ }
+ }
+ catch (RuntimeException e)
+ {
+ log.error("RuntimeException in outbound handler", e);
+ doNext = false;
+ throw e;
+ }
+ finally
+ {
+ // we start at this index in the response chain
+ if (doNext == false)
+ falseIndex = (handlerIndex - 1);
+
+ log.debug("Exit: handleOutbound with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ public boolean handleResponse(MessageContext msgContext)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleInbound");
+
+ int handlerIndex = handlers.size() - 1;
+ if (falseIndex != -1)
+ handlerIndex = falseIndex;
+
+ Handler currHandler = null;
+ try
+ {
+ for (; doNext && handlerIndex >= 0; handlerIndex--)
+ {
+ String lastMessageTrace = null;
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+
+ currHandler = handlers.get(handlerIndex);
+ log.debug("Handle inbound: " + currHandler);
+ doNext = currHandler.handleMessage(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ log.error("RuntimeException in inbound handler", rte);
+ doNext = false;
+ throw rte;
+ }
+ finally
+ {
+ // we start at this index in the fault chain
+ if (doNext == false)
+ falseIndex = (handlerIndex - 1);
+
+ log.debug("Exit: handleInbound with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ public boolean handleFault(MessageContext msgContext)
+ {
+ boolean doNext = true;
+
+ if (handlers.size() > 0)
+ {
+ log.debug("Enter: handleFault");
+
+ int handlerIndex = 0;
+ Handler currHandler = null;
+ try
+ {
+ for (; doNext && handlerIndex < handlers.size(); handlerIndex++)
+ {
+ String lastMessageTrace = null;
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+
+ currHandler = handlers.get(handlerIndex);
+ log.debug("Handle fault: " + currHandler);
+ doNext = currHandler.handleFault(msgContext);
+
+ if (log.isTraceEnabled())
+ {
+ SOAPMessageContextJAXWS msgCtx = (SOAPMessageContextJAXWS)msgContext;
+ SOAPPart soapPart = msgCtx.getMessage().getSOAPPart();
+ lastMessageTrace = traceSOAPPart(soapPart, lastMessageTrace);
+ }
+ }
+ }
+ catch (RuntimeException e)
+ {
+ log.error("RuntimeException in fault handler", e);
+ doNext = false;
+ throw e;
+ }
+ finally
+ {
+ // we start at this index in the response chain
+ if (doNext == false)
+ falseIndex = (handlerIndex - 1);
+
+ log.debug("Exit: handleFault with status: " + doNext);
+ }
+ }
+
+ return doNext;
+ }
+
+ /**
+ * Trace the SOAPPart, do nothing if the String representation is equal to the last one.
+ */
+ protected String traceSOAPPart(SOAPPart soapPart, String lastMessageTrace)
+ {
+ try
+ {
+ SOAPEnvelopeImpl soapEnv = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+ String envString = DOMWriter.printNode(soapEnv, true);
+ if (envString.equals(lastMessageTrace) == false)
+ {
+ log.debug(envString);
+ lastMessageTrace = envString;
+ }
+ return lastMessageTrace;
+ }
+ catch (SOAPException e)
+ {
+ log.error("Cannot get SOAPEnvelope", e);
+ return null;
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java (from rev 705, trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java)
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/HandlerDelegateJAXWS.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,152 @@
+/*
+ * 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.jaxws.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.Binding;
+import javax.xml.ws.handler.Handler;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
+import org.jboss.ws.server.HandlerDelegate;
+import org.jboss.ws.server.ServiceEndpointInfo;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/** Delegates to JAXWS handlers
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-Jan-2005
+ */
+public class HandlerDelegateJAXWS implements HandlerDelegate
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(HandlerDelegateJAXWS.class);
+
+ private List<Handler> preHandlerChain;
+ private List<Handler> jaxwsHandlerChain;
+ private List<Handler> postHandlerChain;
+
+ public HandlerDelegateJAXWS(Binding binding)
+ {
+ preHandlerChain = new ArrayList<Handler>();
+ jaxwsHandlerChain = binding.getHandlerChain();
+ postHandlerChain = new ArrayList<Handler>();
+ }
+
+ public boolean callRequestHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+
+ // Initialize the handler chain
+ if (sepMetaData.isHandlersInitialized() == false)
+ {
+ initHandlerChain(seInfo, HandlerType.PRE);
+ initHandlerChain(seInfo, HandlerType.ENDPOINT);
+ initHandlerChain(seInfo, HandlerType.POST);
+ sepMetaData.setHandlersInitialized(true);
+ }
+
+ List<Handler> handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxwsHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ boolean status = new HandlerChainExecutor(handlerChain).handleRequest(msgContext);
+ return status;
+ }
+
+ public boolean callResponseHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+
+ List<Handler> handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxwsHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ boolean status = new HandlerChainExecutor(handlerChain).handleResponse(msgContext);
+ return status;
+ }
+
+ public boolean callFaultHandlerChain(ServiceEndpointInfo seInfo, HandlerType type, Exception ex)
+ {
+ SOAPMessageContextJAXWS msgContext = (SOAPMessageContextJAXWS)MessageContextAssociation.peekMessageContext();
+
+ List<Handler> handlerChain = null;
+ if (type == HandlerType.PRE)
+ handlerChain = preHandlerChain;
+ else if (type == HandlerType.ENDPOINT)
+ handlerChain = jaxwsHandlerChain;
+ else if (type == HandlerType.POST)
+ handlerChain = postHandlerChain;
+
+ boolean status = new HandlerChainExecutor(handlerChain).handleFault(msgContext);
+ return status;
+ }
+
+ /**
+ * Init the handler chain
+ */
+ private void initHandlerChain(ServiceEndpointInfo seInfo, HandlerType type)
+ {
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+ for (UnifiedHandlerMetaData handlerMetaData : sepMetaData.getHandlers(type))
+ {
+ Class hClass;
+ String className = handlerMetaData.getHandlerClass();
+ try
+ {
+ // Load the handler class using the deployments top level CL
+ ClassLoader classLoader = sepMetaData.getClassLoader();
+ hClass = classLoader.loadClass(className);
+ Handler handler = (Handler)hClass.newInstance();
+
+ if (type == HandlerType.PRE)
+ preHandlerChain.add(new HandlerWrapper(handler));
+ else if (type == HandlerType.ENDPOINT)
+ jaxwsHandlerChain.add(new HandlerWrapper(handler));
+ else if (type == HandlerType.POST)
+ postHandlerChain.add(new HandlerWrapper(handler));
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot load handler class: " + className);
+ }
+
+ log.debug("Adding server side handler to service '" + sepMetaData.getQName() + "': " + className);
+ }
+ }
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerDelegateJAXWS.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerInfo.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerInfo.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerInfo.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,73 +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.jaxws.handler;
-
-// $Id: $
-
-
-/** This represents information about a handler in the HandlerChain. A
- * HandlerInfo instance is passed in the Handler.init method to initialize a
- * Handler instance.
- *
- * @author Thomas.Diesler at jboss.org
- */
-public class HandlerInfo
-{
- private Class handlerClass;
-
- /** Constructor for HandlerInfo
- *
- * @param handlerClass Java Class for the Handler
- * @param config Handler Configuration as a java.util.Map
- * @param headers QNames for the header blocks processed by this Handler.
- * QName is the qualified name of the outermost element of a header block
- */
- public HandlerInfo(Class handlerClass)
- {
- this.handlerClass = handlerClass;
- }
-
- /** Gets the Handler class
- *
- * @return Returns null if no Handler class has been set; otherwise the set handler class
- */
- public Class getHandlerClass()
- {
- return handlerClass;
- }
-
- /** Sets the Handler class
- *
- * @param handlerClass Class for the Handler
- */
- public void setHandlerClass(Class handlerClass)
- {
- this.handlerClass = handlerClass;
- }
-
- /** Returns a string representation of the object.
- */
- public String toString()
- {
- return "[class=" + handlerClass.getName() + "]";
- }
-}
Added: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,54 @@
+/*
+ * 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.jaxws.handler;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.handler.PortInfo;
+
+/**
+ * HandlerResolver is an interface implemented by an application to get control over
+ * the handler chain set on proxy/dispatch objects at the time of their creation.
+ *
+ * A HandlerResolver may be set on a Service using the setHandlerResolver method.
+ *
+ * When the runtime invokes a HandlerResolver, it will pass it a PortInfo object
+ * containing information about the port that the proxy/dispatch object will be accessing.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-Aug-2006
+ */
+public class HandlerResolverImpl implements HandlerResolver
+{
+ private List<Handler> handlerChain = new ArrayList<Handler>();
+
+ public List<Handler> getHandlerChain(PortInfo portinfo)
+ {
+ return handlerChain;
+ }
+
+}
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerResolverImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerWrapper.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerWrapper.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/HandlerWrapper.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -153,6 +153,6 @@
*/
public String toString()
{
- return "[state=" + getStateAsString() + ",handler=" + delegate + "]";
+ return "[state=" + getStateAsString() + ",handler=" + delegate.getClass().getName() + "]";
}
}
Added: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/PortInfoImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/PortInfoImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/PortInfoImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,70 @@
+/*
+ * 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.jaxws.handler;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.PortInfo;
+
+import org.jboss.ws.metadata.EndpointMetaData;
+
+/**
+ * The PortInfo interface is used by a HandlerResolver to query information about the
+ * port it is being asked to create a handler chain for.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 03-May-2006
+ */
+public class PortInfoImpl implements PortInfo
+{
+ private QName serviceName;
+ private QName portName;
+ private String bindingID;
+
+ public PortInfoImpl(EndpointMetaData epMetaData)
+ {
+ this.serviceName = epMetaData.getServiceMetaData().getQName();
+ this.portName = epMetaData.getQName();
+ this.bindingID = epMetaData.getBindingId();
+ }
+
+ public PortInfoImpl(QName serviceName, QName portName, String bindingID)
+ {
+ this.serviceName = serviceName;
+ this.portName = portName;
+ this.bindingID = bindingID;
+ }
+
+ public String getBindingID()
+ {
+ return bindingID;
+ }
+
+ public QName getPortName()
+ {
+ return portName;
+ }
+
+ public QName getServiceName()
+ {
+ return serviceName;
+ }
+}
\ No newline at end of file
Property changes on: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/PortInfoImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/ServerHandlerChain.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/ServerHandlerChain.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/handler/ServerHandlerChain.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,56 +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.jaxws.handler;
-
-// $Id$
-
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * Represents a list of handlers. All elements in the
- * HandlerChain are of the type javax.xml.rpc.handler.Handler.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 06-May-2004
- */
-public class ServerHandlerChain extends HandlerChainBaseImpl
-{
- // The required type of the handler
- private HandlerType type;
-
- public ServerHandlerChain(List<HandlerInfo> infos, Set roles, HandlerType type)
- {
- super(infos, roles);
- this.type = type;
- }
-
- public boolean handleMessage(MessageContext msgContext)
- {
- boolean doNext = super.handleMessage(msgContext);
- return doNext;
- }
-}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/EndpointImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -33,11 +33,13 @@
import javax.xml.transform.Source;
import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.jaxws.client.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.server.HttpContext;
import org.jboss.ws.server.HttpServer;
@@ -53,7 +55,7 @@
private final Logger log = Logger.getLogger(EndpointImpl.class);
private Object implementor;
- private Binding binding = new BindingImpl();
+ private BindingProvider bindingProvider;
private Map<String, Object> properties = new HashMap<String, Object>();
private HttpContext serverContext;
private boolean isPublished;
@@ -62,12 +64,16 @@
public EndpointImpl(String bindingId, Object implementor)
{
this.implementor = implementor;
+ this.bindingProvider = new BindingProviderImpl(bindingId);
+
+ if (implementor == null)
+ throw new WebServiceException("Implementor cannot be null");
}
@Override
public Binding getBinding()
{
- return binding;
+ return bindingProvider.getBinding();
}
@Override
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -28,6 +28,7 @@
import java.net.URLClassLoader;
import java.rmi.Remote;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.Executor;
@@ -41,13 +42,17 @@
import javax.xml.ws.spi.ServiceDelegate;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.Constants;
import org.jboss.ws.deployment.JAXWSClientMetaDataBuilder;
import org.jboss.ws.jaxrpc.MetaDataSynchronization;
+import org.jboss.ws.jaxws.client.ClientImpl;
import org.jboss.ws.jaxws.client.DispatchImpl;
-import org.jboss.ws.jaxws.client.JAXWSClient;
import org.jboss.ws.jaxws.client.PortProxy;
+import org.jboss.ws.jaxws.handler.HandlerResolverImpl;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
/**
* Service delegates are used internally by Service objects to allow pluggability of JAX-WS implementations.
@@ -62,6 +67,10 @@
{
// The service meta data that is associated with this JAXWS Service
private ServiceMetaData serviceMetaData;
+ // The ports known by this service
+ private HashMap<QName, Port> ports = new HashMap<QName,Port>();
+ // The handler resolver
+ private HandlerResolver handlerResolver = new HandlerResolverImpl();
public ServiceDelegateImpl(URL wsdlURL, QName serviceName)
{
@@ -75,6 +84,15 @@
builder.setClassLoader(ctxClassLoader);
serviceMetaData = builder.buildMetaData(serviceName, wsdlURL);
+
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ {
+ QName portName = epMetaData.getQName();
+ String bindingId = epMetaData.getBindingId();
+ String epAddress = epMetaData.getEndpointAddress();
+ Port port = new Port (portName, bindingId, epAddress);
+ ports.put(portName, port);
+ }
}
/**
@@ -118,25 +136,51 @@
}
@Override
- public void addPort(QName qname, String s, String s1)
+ /**
+ * Creates a new port for the service.
+ * Ports created in this way contain no WSDL port type information
+ * and can only be used for creating Dispatchinstances.
+ */
+
+ public void addPort(QName portName, String bindingId, String epAddress)
{
- throw new NotImplementedException();
+ Port port = new Port (portName, bindingId, epAddress);
+ ports.put(portName, port);
}
@Override
- public <T> Dispatch<T> createDispatch(QName qname, Class<T> type, Mode mode)
+ public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode)
{
- DispatchImpl dispatch = new DispatchImpl(serviceMetaData, qname, type, mode);
+ EndpointMetaData epMetaData = getEndpointMetaData(portName);
+ DispatchImpl dispatch = new DispatchImpl(epMetaData, type, mode);
return dispatch;
}
@Override
- public Dispatch<Object> createDispatch(QName qname, JAXBContext jbc, Mode mode)
+ public Dispatch<Object> createDispatch(QName portName, JAXBContext jbc, Mode mode)
{
- DispatchImpl dispatch = new DispatchImpl(serviceMetaData, qname, jbc, mode);
+ EndpointMetaData epMetaData = getEndpointMetaData(portName);
+ DispatchImpl dispatch = new DispatchImpl(epMetaData, jbc, mode);
return dispatch;
}
+ private EndpointMetaData getEndpointMetaData(QName portName)
+ {
+ Port port = ports.get(portName);
+ if (port == null)
+ throw new WebServiceException("Cannot find port: " + portName);
+
+ // Create an anonymous endpoint
+ EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName);
+ if (epMetaData == null)
+ {
+ epMetaData = new ClientEndpointMetaData(serviceMetaData, new QName(Constants.NS_JBOSSWS_URI, "AnonymousEndpoint"), Type.JAXWS);
+ epMetaData.setEndpointAddress(port.getEndpointAddress());
+ epMetaData.setBindingId(port.getBindingId());
+ }
+ return epMetaData;
+ }
+
/** Gets the name of this service. */
@Override
public QName getServiceName()
@@ -149,9 +193,9 @@
public Iterator<QName> getPorts()
{
ArrayList<QName> portNames = new ArrayList<QName>();
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ for (Port port : ports.values())
{
- portNames.add(epMetaData.getQName());
+ portNames.add(port.getQName());
}
return portNames.iterator();
}
@@ -165,13 +209,13 @@
@Override
public HandlerResolver getHandlerResolver()
{
- throw new NotImplementedException();
+ return handlerResolver;
}
@Override
- public void setHandlerResolver(HandlerResolver handlerresolver)
+ public void setHandlerResolver(HandlerResolver handlerResolver)
{
- throw new NotImplementedException();
+ this.handlerResolver = handlerResolver;
}
@Override
@@ -192,7 +236,7 @@
{
MetaDataSynchronization.synchronizeServiceEndpointInterface(epMetaData, seiClass);
- PortProxy handler = new PortProxy(new JAXWSClient(epMetaData));
+ PortProxy handler = new PortProxy(new ClientImpl(epMetaData, handlerResolver));
ClassLoader cl = epMetaData.getClassLoader();
T proxy = (T)Proxy.newProxyInstance(cl, new Class[] { seiClass, BindingProvider.class }, handler);
return proxy;
@@ -206,4 +250,33 @@
throw new WebServiceException("Cannot create proxy", ex);
}
}
+
+ private static class Port
+ {
+ private QName qname;
+ private String bindingId;
+ private String endpointAddress;
+
+ public Port(QName qname, String bindingId, String endpointAddress)
+ {
+ this.qname = qname;
+ this.bindingId = bindingId;
+ this.endpointAddress = endpointAddress;
+ }
+
+ public String getBindingId()
+ {
+ return bindingId;
+ }
+
+ public String getEndpointAddress()
+ {
+ return endpointAddress;
+ }
+
+ public QName getQName()
+ {
+ return qname;
+ }
+ }
}
\ No newline at end of file
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ClientEndpointMetaData.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -237,6 +237,7 @@
buffer.append("\n qname=" + getQName());
buffer.append("\n type=" + getType());
buffer.append("\n address=" + getEndpointAddress());
+ buffer.append("\n binding=" + getBindingId());
buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
buffer.append("\n configFile=" + getConfigFile());
buffer.append("\n configName=" + getConfigName());
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -32,6 +32,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
@@ -70,6 +71,8 @@
// The REQUIRED name
private QName qname;
+ // The REQUIRED binding id
+ private String bindingId;
// The REQUIRED config-name
private String configName;
// The REQUIRED config-file
@@ -97,7 +100,7 @@
// The list of service meta data
private List<OperationMetaData> operations = new ArrayList<OperationMetaData>();
// The optional handlers
- private List<UnifiedHandlerMetaData> jaxrpcHandlers = new ArrayList<UnifiedHandlerMetaData>();
+ private List<UnifiedHandlerMetaData> handlers = new ArrayList<UnifiedHandlerMetaData>();
// True if the handlers are initialized
private boolean handlersInitialized;
@@ -106,6 +109,9 @@
this.service = service;
this.qname = qname;
this.type = type;
+
+ // The default binding
+ this.bindingId = SOAPBinding.SOAP11HTTP_BINDING;
}
public ServiceMetaData getServiceMetaData()
@@ -148,6 +154,16 @@
this.endpointAddress = endpointAddress;
}
+ public String getBindingId()
+ {
+ return bindingId;
+ }
+
+ public void setBindingId(String bindingId)
+ {
+ this.bindingId = bindingId;
+ }
+
public String getServiceEndpointInterfaceName()
{
return seiName;
@@ -368,12 +384,12 @@
public void addHandler(UnifiedHandlerMetaData handler)
{
- jaxrpcHandlers.add(handler);
+ handlers.add(handler);
}
public void clearHandlers()
{
- jaxrpcHandlers.clear();
+ handlers.clear();
handlersInitialized = false;
}
@@ -382,7 +398,7 @@
if (type == HandlerType.PRE || type == HandlerType.POST)
throw new IllegalArgumentException("Illegal handler type: " + type);
- return new ArrayList<UnifiedHandlerMetaData>(jaxrpcHandlers);
+ return new ArrayList<UnifiedHandlerMetaData>(handlers);
}
public boolean isHandlersInitialized()
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/metadata/ServerEndpointMetaData.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -331,6 +331,7 @@
buffer.append("\n type=" + getType());
buffer.append("\n id=" + getServiceEndpointID().getCanonicalName());
buffer.append("\n address=" + getEndpointAddress());
+ buffer.append("\n binding=" + getBindingId());
buffer.append("\n linkName=" + getLinkName());
buffer.append("\n implName=" + getServiceEndpointImplName());
buffer.append("\n seiName=" + getServiceEndpointInterfaceName());
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLEndpoint.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -25,6 +25,7 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
/**
@@ -38,6 +39,9 @@
{
private static final long serialVersionUID = 4991302339046047865L;
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLEndpoint.class);
+
// The parent service
private WSDLService wsdlService;
@@ -57,6 +61,7 @@
public WSDLEndpoint(WSDLService wsdlService)
{
+ log.debug("new WSDLEndpoint");
this.wsdlService = wsdlService;
}
@@ -117,6 +122,7 @@
public void setName(NCName name)
{
+ log.debug("setName: " + name);
this.name = name;
}
@@ -133,6 +139,7 @@
public void setQName(QName qname)
{
+ log.debug("setQName: " + qname);
this.qname = qname;
}
@@ -143,6 +150,7 @@
public void setBinding(QName binding)
{
+ log.debug("setBinding: " + binding);
this.binding = binding;
}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/metadata/wsdl/WSDLService.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -28,6 +28,8 @@
import javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
+
/**
* A Service component describes a set of endpoints (see 2.14 Endpoint [p.62] ) at which a particular
* deployed implementation of the service is provided. The endpoints thus are in effect alternate places at
@@ -40,6 +42,9 @@
{
private static final long serialVersionUID = 1274166611190648479L;
+ // provide logging
+ private static final Logger log = Logger.getLogger(WSDLService.class);
+
// The parent WSDL definitions element.
private WSDLDefinitions wsdlDefinitions;
@@ -55,10 +60,11 @@
private QName interfaceName;
/** One or more endpoint element information items */
- private ArrayList endpoints = new ArrayList();
+ private ArrayList<WSDLEndpoint> endpoints = new ArrayList<WSDLEndpoint>();
public WSDLService(WSDLDefinitions wsdlDefinitions)
{
+ log.debug("new WSDLService");
this.wsdlDefinitions = wsdlDefinitions;
}
@@ -74,6 +80,7 @@
public void setName(NCName name)
{
+ log.debug("setName: " + name);
this.name = name;
}
@@ -90,6 +97,7 @@
public void setQName(QName qname)
{
+ log.debug("setQName: " + qname);
this.qname = qname;
}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -35,22 +35,22 @@
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Service.Mode;
+import javax.xml.ws.Binding;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.MessageContext;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingProvider;
-import org.jboss.ws.binding.BindingProviderRegistry;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.common.SOAPMessageContextBase;
-import org.jboss.ws.jaxrpc.HandlerDelegateJAXRPC;
import org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper;
-import org.jboss.ws.jaxws.HandlerDelegateJAXWS;
+import org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
+import org.jboss.ws.jaxws.handler.HandlerDelegateJAXWS;
import org.jboss.ws.metadata.EndpointMetaData;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.EndpointMetaData.Type;
import org.jboss.ws.metadata.j2ee.UnifiedHandlerMetaData.HandlerType;
import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.soap.SOAPMessageImpl;
@@ -66,19 +66,23 @@
// provide logging
private static Logger log = Logger.getLogger(AbstractServiceEndpointInvoker.class);
+ protected BindingProvider bindingProvider;
protected HandlerDelegate handlerDelegate;
/** Initialize the service endpoint */
public void initServiceEndpoint(ServiceEndpointInfo seInfo)
{
- Type type = seInfo.getServerEndpointMetaData().getType();
- if (type == EndpointMetaData.Type.JAXRPC)
+ ServerEndpointMetaData sepMetaData = seInfo.getServerEndpointMetaData();
+ bindingProvider = new BindingProviderImpl(sepMetaData);
+
+ if (sepMetaData.getType() == EndpointMetaData.Type.JAXRPC)
{
handlerDelegate = new HandlerDelegateJAXRPC();
}
else
{
- handlerDelegate = new HandlerDelegateJAXWS();
+ Binding binding = bindingProvider.getBinding();
+ handlerDelegate = new HandlerDelegateJAXWS(binding);
}
}
@@ -113,99 +117,7 @@
/** Invoke the the service endpoint */
public SOAPMessage invoke(ServiceEndpointInfo seInfo, Object context) throws Exception
{
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- if (epMetaData.getType() == EndpointMetaData.Type.JAXRPC)
- {
- return invokeJAXRPC(seInfo, context);
- }
- else
- {
- return invokeJAXWS(seInfo, context);
- }
- }
-
- /** Invoke a JAXRPC service endpoint */
- private SOAPMessage invokeJAXRPC(ServiceEndpointInfo seInfo, Object context) throws Exception
- {
SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
- ServerEndpointMetaData epMetaData = seInfo.getServerEndpointMetaData();
- SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
-
- // Load the endpoint implementation bean
- Class seImpl = loadServiceEndpoint(seInfo);
-
- // Create an instance of the endpoint implementation bean
- Object seInstance = createServiceEndpoint(seInfo, context, seImpl);
-
- try
- {
- boolean oneway = false;
-
- // call the handler chain
- boolean handlersPass = callRequestHandlerChain(seInfo, HandlerType.PRE);
- handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.ENDPOINT);
- handlersPass = handlersPass && callRequestHandlerChain(seInfo, HandlerType.POST);
-
- if (handlersPass)
- {
- // Get the binding provider for the given bindingURI
- BindingProvider bindingProvider = BindingProviderRegistry.getDefaultProvider();
-
- // Get the operation meta data from the SOAP message
- OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
- msgContext.setOperationMetaData(opMetaData);
- oneway = opMetaData.isOneWayOperation();
-
- // Unbind the request message
- EndpointInvocation epInv = bindingProvider.unbindRequestMessage(opMetaData, reqMessage);
-
- // Invoke the service endpoint
- invokeServiceEndpoint(seInfo, seInstance, epInv);
-
- // Bind the response message
- SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
- msgContext.setMessage(resMessage);
- }
-
- // call the handler chain
- if (oneway == false)
- {
- handlersPass = callResponseHandlerChain(seInfo, HandlerType.POST);
- handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.ENDPOINT);
- handlersPass = handlersPass && callResponseHandlerChain(seInfo, HandlerType.PRE);
- }
-
- SOAPMessage resMessage = msgContext.getMessage();
- return resMessage;
- }
- catch (Exception ex)
- {
- try
- {
- SOAPMessage faultMessage = SOAPFaultExceptionHelper.exceptionToFaultMessage(ex);
- msgContext.setMessage(faultMessage);
-
- // call the handler chain
- boolean handlersPass = handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.POST, ex);
- handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.ENDPOINT, ex);
- handlersPass = handlersPass && handlerDelegate.callFaultHandlerChain(seInfo, HandlerType.PRE, ex);
- }
- catch (Exception subEx)
- {
- log.warn("Cannot process handlerChain.handleFault, ignoring: ", subEx);
- }
- throw ex;
- }
- finally
- {
- destroyServiceEndpoint(seInfo, seInstance);
- }
- }
-
- /** Invoke a JAXWS service endpoint */
- private SOAPMessage invokeJAXWS(ServiceEndpointInfo seInfo, Object context) throws Exception
- {
- SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
SOAPMessageImpl reqMessage = (SOAPMessageImpl)msgContext.getMessage();
@@ -226,20 +138,8 @@
if (handlersPass)
{
- // Get the binding provider for the given bindingURI
- BindingProvider bindingProvider;
- if (epMetaData.getServiceMode() == Mode.MESSAGE)
- {
- bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_MESSAGE_BINDING);
- }
- else if (epMetaData.getServiceMode() == Mode.PAYLOAD)
- {
- bindingProvider = BindingProviderRegistry.getProvider(BindingProvider.JAXWS_PAYLOAD_BINDING);
- }
- else
- {
- bindingProvider = BindingProviderRegistry.getDefaultProvider();
- }
+ // Get the binding from the provideer
+ BindingImpl binding = (BindingImpl)bindingProvider.getBinding();
// Get the operation meta data from the SOAP message
OperationMetaData opMetaData = getDispatchDestination(epMetaData, reqMessage);
@@ -247,16 +147,17 @@
oneway = opMetaData.isOneWayOperation();
// Unbind the request message
- EndpointInvocation epInv = bindingProvider.unbindRequestMessage(opMetaData, reqMessage);
+ EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
// Invoke the service endpoint
invokeServiceEndpoint(seInfo, seInstance, epInv);
// Set the outbound property
- msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
+ if (epMetaData.getType() == EndpointMetaData.Type.JAXWS)
+ msgContext.setProperty(MessageContext.MESSAGE_OUTBOUND_PROPERTY, new Boolean(true));
// Bind the response message
- SOAPMessage resMessage = bindingProvider.bindResponseMessage(opMetaData, epInv);
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
msgContext.setMessage(resMessage);
}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/tools/metadata/ToolsUnifiedMetaDataBuilder.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,24 +1,24 @@
/*
-* 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.tools.metadata;
import java.rmi.Remote;
@@ -56,12 +56,11 @@
private Style style;
private ParameterStyle parameterStyle;
- public ToolsUnifiedMetaDataBuilder(Class epClass, String targetNamespace,
- String typeNamespace, String serviceName, Style style, ParameterStyle parameterStyle,
+ public ToolsUnifiedMetaDataBuilder(Class epClass, String targetNamespace, String typeNamespace, String serviceName, Style style, ParameterStyle parameterStyle,
Map<String, List<OperationConfig>> operationMap)
{
this.seiClass = epClass;
- this.targetNamespace = targetNamespace;
+ this.targetNamespace = targetNamespace;
this.typeNamespace = typeNamespace != null ? typeNamespace : targetNamespace;
this.serviceName = serviceName;
this.style = style;
@@ -80,16 +79,17 @@
private void buildMetaData()
{
//Check if it extends Remote Interface
- if( !Remote.class.isAssignableFrom(seiClass))
+ if (!Remote.class.isAssignableFrom(seiClass))
throw new WSException("A service endpoint interface should extend Remote");
um = new UnifiedMetaData();
- String portTypeName = WSDLUtils.getInstance().getJustClassName(seiClass.getName());
+ String seiName = WSDLUtils.getInstance().getJustClassName(seiClass.getName());
if (serviceName == null)
- serviceName = portTypeName + "Service";
+ serviceName = seiName + "Service";
- um.addService(getServiceMetaData(um,targetNamespace, serviceName, portTypeName, seiClass));
+ String portName = seiName + "Port";
+ um.addService(getServiceMetaData(um, targetNamespace, serviceName, portName, seiClass));
generateOperationMetaData(seiClass);
}
@@ -98,19 +98,17 @@
{
ServiceMetaData sm = um.getServices().get(0);
ToolsEndpointMetaData em = (ToolsEndpointMetaData)sm.getEndpointByServiceEndpointInterface(seiClass.getName());
- if(em == null)
+ if (em == null)
throw new WSException("EndpointMetadata is null");
ReflectiveMetaDataBuilder rmb = new ReflectiveMetaDataBuilder(em);
rmb.setOperationMap(operationMap);
em = rmb.generate();
}
- private ServiceMetaData getServiceMetaData(UnifiedMetaData um, String targetNamespace,
- String serviceName, String portTypeName, Class seiClass)
+ private ServiceMetaData getServiceMetaData(UnifiedMetaData um, String targetNamespace, String serviceName, String portName, Class seiClass)
{
- ServiceMetaData sm = new ServiceMetaData(um, new QName(targetNamespace,serviceName));
- ToolsEndpointMetaData tm = new ToolsEndpointMetaData(sm,
- new QName(targetNamespace, portTypeName + "Port"));
+ ServiceMetaData sm = new ServiceMetaData(um, new QName(targetNamespace, serviceName));
+ ToolsEndpointMetaData tm = new ToolsEndpointMetaData(sm, new QName(targetNamespace, portName));
tm.typeNamespace = typeNamespace;
tm.setServiceEndpointInterfaceName(seiClass.getName());
tm.setStyle(style);
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerInbound.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerInbound.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerInbound.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -41,15 +41,15 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- private boolean handleRequest(MessageContext msgContext)
+ private boolean handleInbound(MessageContext msgContext)
{
return handleInboundSecurity(msgContext);
}
- private boolean handleResponse(MessageContext msgContext)
+ private boolean handleOutbound(MessageContext msgContext)
{
return handleOutboundSecurity(msgContext);
}
Modified: trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerOutbound.java
===================================================================
--- trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerOutbound.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/main/java/org/jboss/ws/wsse/jaxws/WSSecurityHandlerOutbound.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -40,15 +40,15 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- public boolean handleRequest(MessageContext msgContext)
+ public boolean handleInbound(MessageContext msgContext)
{
return handleOutboundSecurity(msgContext);
}
- public boolean handleResponse(MessageContext msgContext)
+ public boolean handleOutbound(MessageContext msgContext)
{
return handleInboundSecurity(msgContext);
}
Modified: trunk-tdiesler/src/test/ant/build-jars.xml
===================================================================
--- trunk-tdiesler/src/test/ant/build-jars.xml 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/ant/build-jars.xml 2006-08-08 20:06:38 UTC (rev 709)
@@ -768,7 +768,8 @@
<!-- jbossws-jsr181-handlerchain -->
<war warfile="${build.test.dir}/libs/jbossws-jsr181-handlerchain.war" webxml="${build.test.dir}/resources/jsr181/handlerchain/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
- <include name="org/jboss/test/ws/jsr181/handlerchain/MyWebService.class"/>
+ <include name="org/jboss/test/ws/jsr181/handlerchain/EndpointImpl.class"/>
+ <include name="org/jboss/test/ws/jsr181/handlerchain/Endpoint.class"/>
<include name="org/jboss/test/ws/jsr181/handlerchain/*Handler.class"/>
</classes>
<webinf dir="${build.test.dir}/resources/jsr181/handlerchain/WEB-INF">
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionDocEndpointImpl.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionDocEndpointImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionDocEndpointImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -36,11 +36,10 @@
* WS-Addressing service endpoint
*
* @author Thomas.Diesler at jboss.org
- *
* @since 24-Nov-2005
*/
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
- at WebService(name = "ActionEndpoint", targetNamespace = "http://org.jboss.ws/addressing/action", wsdlLocation = "WEB-INF/wsdl/ActionDocService.wsdl")
+ at WebService(serviceName = "ActionDocService", name="ActionEndpointPort", targetNamespace = "http://org.jboss.ws/addressing/action", wsdlLocation = "WEB-INF/wsdl/ActionDocService.wsdl")
@HandlerChain(file = "resource://WEB-INF/jaxws-handlers.xml")
public class ActionDocEndpointImpl implements ActionEndpoint
{
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionRpcEndpointImpl.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionRpcEndpointImpl.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/addressing/action/ActionRpcEndpointImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -34,11 +34,10 @@
* WS-Addressing service endpoint
*
* @author Thomas.Diesler at jboss.org
- *
* @since 24-Nov-2005
*/
@SOAPBinding(style = SOAPBinding.Style.RPC)
- at WebService(name = "ActionEndpoint", targetNamespace = "http://org.jboss.ws/addressing/action", wsdlLocation = "WEB-INF/wsdl/ActionRpcService.wsdl")
+ at WebService(serviceName = "ActionRpcService", name="ActionEndpointPort", targetNamespace = "http://org.jboss.ws/addressing/action", wsdlLocation = "WEB-INF/wsdl/ActionRpcService.wsdl")
@HandlerChain(file = "resource://WEB-INF/jaxws-handlers.xml")
public class ActionRpcEndpointImpl implements ActionEndpoint
{
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/binding/SOAPBindingTestCase.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -33,17 +33,18 @@
import javax.xml.rpc.soap.SOAPFaultException;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.util.xml.DOMUtils;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingProvider;
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
-import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP12;
import org.jboss.ws.common.SOAPMessageContextBase;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.soap.MessageContextAssociation;
@@ -58,7 +59,7 @@
public class SOAPBindingTestCase extends JBossWSTest
{
String reqEnvelope =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header/>" +
" <env:Body>" +
" <ns1:echoStringOne xmlns:ns1='http://org.jboss.ws/2004'>" +
@@ -68,7 +69,7 @@
"</env:Envelope>";
String reqEnvelopeWithBoundHeader =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header>" +
" <ns2:String_2 xmlns:ns2='http://somens'>IN header message</ns2:String_2>" +
" </env:Header>" +
@@ -80,7 +81,7 @@
"</env:Envelope>";
String reqEnvelopeWithUnboundHeader =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header>" +
" <ns2:String_2 xmlns:ns2='http://somens'>IN header message</ns2:String_2>" +
" </env:Header>" +
@@ -92,7 +93,7 @@
"</env:Envelope>";
String resEnvelope =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header/>" +
" <env:Body>" +
" <ns1:echoStringOneResponse xmlns:ns1='http://org.jboss.ws/2004'>" +
@@ -102,7 +103,7 @@
"</env:Envelope>";
String resEnvelopeWithBoundHeader =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header>" +
" <ns2:OutHeader xmlns:ns2='http://somens'>OUT header message</ns2:OutHeader>" +
" </env:Header>" +
@@ -114,7 +115,7 @@
"</env:Envelope>";
String resEnvelopeWithUnboundHeader =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header>" +
" <ns2:OutHeader xmlns:ns2='http://somens'>OUT header message</ns2:OutHeader>" +
" </env:Header>" +
@@ -126,7 +127,7 @@
"</env:Envelope>";
String resEnvelopeWithFault =
- "<env:Envelope xmlns:env='http://www.w3.org/2003/05/soap-envelope'>" +
+ "<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header/>" +
" <env:Body>" +
" <env:Fault>" +
@@ -166,12 +167,12 @@
*/
public void testBindRequestMessage() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!"});
- SOAPMessage reqMessage = bp.bindRequestMessage(opMetaData, epInv, null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, null);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
reqMessage.writeTo(outs);
@@ -184,7 +185,7 @@
*/
public void testBindRequestMessageWithBoundHeader() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
// Add bound header
QName xmlName = new QName("http://somens", "String_2");
@@ -195,7 +196,7 @@
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!", "IN header message"});
- SOAPMessage reqMessage = bp.bindRequestMessage(opMetaData, epInv, null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, null);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
reqMessage.writeTo(outs);
@@ -208,7 +209,7 @@
*/
public void testBindRequestMessageWithUnboundHeader() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
// Add unbound header
QName xmlName = new QName("http://somens", "String_2");
@@ -221,7 +222,7 @@
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!"});
- SOAPMessage reqMessage = bp.bindRequestMessage(opMetaData, epInv, headers);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, headers);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
reqMessage.writeTo(outs);
@@ -234,7 +235,7 @@
*/
public void testUnbindRequestMessage() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelope.getBytes());
@@ -244,7 +245,7 @@
SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setMessage(reqMessage);
- EndpointInvocation epInv = bp.unbindRequestMessage(opMetaData, reqMessage);
+ EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
assertNotNull(epInv);
Object[] args = epInv.getRequestPayload();
@@ -270,8 +271,8 @@
SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setMessage(reqMessage);
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
- EndpointInvocation epInv = bp.unbindRequestMessage(opMetaData, reqMessage);
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
+ EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
assertNotNull(epInv);
Object[] args = epInv.getRequestPayload();
@@ -292,8 +293,8 @@
SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
msgContext.setMessage(reqMessage);
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
- EndpointInvocation epInv = bp.unbindRequestMessage(opMetaData, reqMessage);
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
+ EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
assertNotNull(epInv);
Object[] args = epInv.getRequestPayload();
@@ -305,12 +306,12 @@
*/
public void testBindResponseMessage() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.setReturnValue("Hello World!");
- SOAPMessage resMessage = bp.bindResponseMessage(opMetaData, epInv);
+ SOAPMessage resMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
ByteArrayOutputStream outs = new ByteArrayOutputStream();
resMessage.writeTo(outs);
@@ -323,7 +324,7 @@
*/
public void testUnbindResponseMessage() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelope.getBytes());
@@ -334,7 +335,7 @@
msgContext.setMessage(resMessage);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- bp.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
assertEquals("Hello World!", epInv.getReturnValue());
}
@@ -342,7 +343,7 @@
*/
public void testUnbindResponseMessageWithBoundHeader() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());
@@ -360,7 +361,7 @@
opMetaData.addParameter(paramMetaData);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- bp.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
assertEquals("Hello World!", epInv.getReturnValue());
Object headerValue = epInv.getResponseParamValue(xmlName);
@@ -371,7 +372,7 @@
*/
public void testUnbindResponseMessageWithUnboundHeader() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
@@ -388,7 +389,7 @@
headers.put(xmlName, header);
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- bp.unbindResponseMessage(opMetaData, resMessage, epInv, headers);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, headers);
assertEquals("Hello World!", epInv.getReturnValue());
assertEquals("OUT header message", header.getHeaderValue());
@@ -398,7 +399,7 @@
*/
public void testUnbindFaultResponse() throws Exception
{
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithFault.getBytes());
@@ -411,7 +412,7 @@
try
{
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
- bp.unbindResponseMessage(opMetaData, resMessage, epInv, null);
+ binding.unbindResponseMessage(opMetaData, resMessage, epInv, null);
fail("SOAPFaultException expected");
}
catch (SOAPFaultException faultEx)
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/AuthorizationHandler.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/AuthorizationHandler.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/AuthorizationHandler.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -63,13 +63,13 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- private boolean handleRequest(MessageContext msgContext)
+ private boolean handleInbound(MessageContext msgContext)
{
- log.info("handleRequest");
+ log.info("handleInbound");
try
{
@@ -78,14 +78,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("AuthorizationHandlerRequest", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("AuthorizationHandlerInbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|AuthorizationHandlerRequest");
+ soapElement.setValue(value + "|AuthIn");
}
catch (SOAPException e)
{
@@ -95,9 +95,9 @@
return true;
}
- private boolean handleResponse(MessageContext msgContext)
+ private boolean handleOutbound(MessageContext msgContext)
{
- log.info("handleResponse");
+ log.info("handleOutbound");
try
{
@@ -106,14 +106,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("AuthorizationHandlerResponse", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("AuthorizationHandlerOutbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|AuthorizationHandlerResponse");
+ soapElement.setValue(value + "|AuthOut");
}
catch (SOAPException e)
{
Added: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/Endpoint.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/Endpoint.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/Endpoint.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,30 @@
+/*
+ * 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.test.ws.jsr181.handlerchain;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Endpoint extends Remote
+{
+ public String echo(String input) throws RemoteException;
+}
Property changes on: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/EndpointImpl.java (from rev 705, trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java)
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java 2006-08-08 09:27:46 UTC (rev 705)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/EndpointImpl.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -0,0 +1,51 @@
+/*
+ * 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.test.ws.jsr181.handlerchain;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Test the JSR-181 annotation: javax.jws.HandlerChain
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 08-Oct-2005
+ */
+ at WebService
+ at SOAPBinding(style = SOAPBinding.Style.RPC)
+ at HandlerChain(file = "resource://WEB-INF/jaxws-handlers.xml")
+public class EndpointImpl implements Endpoint
+{
+ // Provide logging
+ private static Logger log = Logger.getLogger(EndpointImpl.class);
+
+ @WebMethod
+ public String echo(String input)
+ {
+ log.info("echo: " + input);
+ return input + "|endpoint";
+ }
+}
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/JSR181HandlerChainTestCase.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/JSR181HandlerChainTestCase.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/JSR181HandlerChainTestCase.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -22,18 +22,18 @@
package org.jboss.test.ws.jsr181.handlerchain;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.rpc.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
import junit.framework.Test;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.jaxrpc.CallImpl;
-import org.jboss.ws.jaxrpc.ServiceFactoryImpl;
-import org.jboss.ws.metadata.OperationMetaData;
/**
* Test the JSR-181 annotation: javax.jws.HandlerChain
@@ -52,16 +52,20 @@
public void testHandlerChain() throws Exception
{
- QName serviceName = new QName(targetNS, "MyWebServiceService");
- QName portName = new QName(targetNS, "MyWebServicePort");
-
+ QName serviceName = new QName(targetNS, "EndpointImplService");
URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jbossws-jsr181-handlerchain/TestService?wsdl");
- ServiceFactoryImpl factory = new ServiceFactoryImpl();
- Service service = factory.createService(wsdlURL, serviceName);
- CallImpl call = (CallImpl)service.createCall(portName, "echo");
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class);
- Object retObj = call.invoke(new Object[]{"Kermit"});
- assertEquals("Kermit|LogHandlerRequest|AuthorizationHandlerRequest|RoutingHandlerRequest|endpoint|RoutingHandlerResponse|AuthorizationHandlerResponse|LogHandlerResponse", retObj);
+ BindingProvider bindingProvider = (BindingProvider)port;
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.add(new LogHandler());
+ handlerChain.add(new AuthorizationHandler());
+ handlerChain.add(new RoutingHandler());
+ bindingProvider.getBinding().setHandlerChain(handlerChain);
+
+ String retObj = port.echo("Kermit");
+ assertEquals("Kermit|LogOut|AuthOut|RoutOut|LogIn|AuthIn|RoutIn|endpoint|RoutOut|AuthOut|LogOut|RoutIn|AuthIn|LogIn", retObj);
}
}
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/LogHandler.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/LogHandler.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/LogHandler.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -63,12 +63,12 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- private boolean handleRequest(MessageContext msgContext)
+ private boolean handleInbound(MessageContext msgContext)
{
- log.info("handleRequest");
+ log.info("handleInbound");
try
{
@@ -77,14 +77,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("LogHandlerRequest", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("LogHandlerInbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|LogHandlerRequest");
+ soapElement.setValue(value + "|LogIn");
}
catch (SOAPException e)
{
@@ -94,9 +94,9 @@
return true;
}
- private boolean handleResponse(MessageContext msgContext)
+ private boolean handleOutbound(MessageContext msgContext)
{
- log.info("handleResponse");
+ log.info("handleOutbound");
try
{
@@ -105,14 +105,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("LogHandlerResponse", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("LogHandlerOutbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|LogHandlerResponse");
+ soapElement.setValue(value + "|LogOut");
}
catch (SOAPException e)
{
Deleted: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/MyWebService.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -1,51 +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.test.ws.jsr181.handlerchain;
-
-import javax.jws.HandlerChain;
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-
-import org.jboss.logging.Logger;
-
-/**
- * Test the JSR-181 annotation: javax.jws.HandlerChain
- *
- * @author Thomas.Diesler at jboss.org
- * @since 08-Oct-2005
- */
- at WebService
- at SOAPBinding(style = SOAPBinding.Style.RPC)
- at HandlerChain(file = "resource://WEB-INF/jaxws-handlers.xml")
-public class MyWebService
-{
- // Provide logging
- private static Logger log = Logger.getLogger(MyWebService.class);
-
- @WebMethod
- public String echo(String input)
- {
- log.info("echo: " + input);
- return input + "|endpoint";
- }
-}
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/RoutingHandler.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/RoutingHandler.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/handlerchain/RoutingHandler.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -63,13 +63,13 @@
if (outbound == null)
throw new IllegalStateException("Cannot obtain required property: " + MessageContext.MESSAGE_OUTBOUND_PROPERTY);
- return outbound ? handleResponse(msgContext) : handleRequest(msgContext);
+ return outbound ? handleOutbound(msgContext) : handleInbound(msgContext);
}
- private boolean handleRequest(MessageContext msgContext)
+ private boolean handleInbound(MessageContext msgContext)
{
- log.info("handleRequest");
+ log.info("handleInbound");
try
{
@@ -78,14 +78,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("RoutingHandlerRequest", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("RoutingHandlerInbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|RoutingHandlerRequest");
+ soapElement.setValue(value + "|RoutIn");
}
catch (SOAPException e)
{
@@ -95,9 +95,9 @@
return true;
}
- private boolean handleResponse(MessageContext msgContext)
+ private boolean handleOutbound(MessageContext msgContext)
{
- log.info("handleResponse");
+ log.info("handleOutbound");
try
{
@@ -106,14 +106,14 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
SOAPFactory soapFactory = SOAPFactory.newInstance();
- Name headerName = soapFactory.createName("RoutingHandlerResponse", "ns1", "http://somens");
+ Name headerName = soapFactory.createName("RoutingHandlerOutbound", "ns1", "http://somens");
SOAPHeaderElement she = soapHeader.addHeaderElement(headerName);
she.setValue("true");
SOAPBodyElement soapBodyElement = (SOAPBodyElement)soapBody.getChildElements().next();
SOAPElement soapElement = (SOAPElement)soapBodyElement.getChildElements().next();
String value = soapElement.getValue();
- soapElement.setValue(value + "|RoutingHandlerResponse");
+ soapElement.setValue(value + "|RoutOut");
}
catch (SOAPException e)
{
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean01.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean01.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean01.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -37,7 +37,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@PortComponent(contextRoot="/jsr181", urlPattern="/*")
public class EJB21Bean01 implements SessionBean
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean02.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean02.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB21Bean02.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -39,7 +39,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "META-INF/wsdl/TestService.wsdl")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "META-INF/wsdl/TestService.wsdl")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@PortComponent(contextRoot="/jsr181", urlPattern="/*")
public class EJB21Bean02 implements SessionBean
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean01.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean01.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean01.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -36,7 +36,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
@PortComponent(contextRoot="/jsr181", urlPattern="/*")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(EJB3RemoteInterface.class)
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean02.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean02.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EJB3Bean02.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -40,7 +40,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "META-INF/wsdl/TestService.wsdl")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "META-INF/wsdl/TestService.wsdl")
@PortComponent(contextRoot="/jsr181", urlPattern="/*")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(EJB3RemoteInterface.class)
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EndpointInterface03.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EndpointInterface03.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/EndpointInterface03.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -35,7 +35,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
@PortComponent(contextRoot="/jsr181", urlPattern="/*")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface EndpointInterface03 extends Remote
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean01.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean01.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean01.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -31,7 +31,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class JSEBean01
{
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean02.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean02.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/jsr181/webservice/JSEBean02.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -33,7 +33,7 @@
* @author Thomas.Diesler at jboss.org
* @since 29-Apr-2005
*/
- at WebService(name = "EndpointInterface", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "WEB-INF/wsdl/TestService.wsdl")
+ at WebService(name = "EndpointInterfacePort", targetNamespace = "http://www.openuri.org/2004/04/HelloWorld", serviceName = "TestService", wsdlLocation = "WEB-INF/wsdl/TestService.wsdl")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class JSEBean02
{
Modified: trunk-tdiesler/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java
===================================================================
--- trunk-tdiesler/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/java/org/jboss/test/ws/soap/attachment/GenericAttachmentTestCase.java 2006-08-08 20:06:38 UTC (rev 709)
@@ -38,14 +38,15 @@
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingProvider;
import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.soap.JAXRPCBindingProviderSOAP12;
import org.jboss.ws.jaxrpc.CallImpl;
import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.jaxws.core.BindingImpl;
+import org.jboss.ws.jaxws.core.BindingProviderImpl;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.soap.MessageContextAssociation;
import org.jboss.ws.soap.MessageFactoryImpl;
@@ -144,12 +145,12 @@
MessageContextAssociation.pushMessageContext(messageContext);
messageContext.setOperationMetaData(opMetaData);
- BindingProvider bp = new JAXRPCBindingProviderSOAP12();
+ BindingImpl binding = (BindingImpl)new BindingProviderImpl(SOAPBinding.SOAP11HTTP_BINDING).getBinding();
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
epInv.initInputParams(new Object[]{"Hello World!", "hi"});
- SOAPMessage reqMessage = bp.bindRequestMessage(opMetaData, epInv, null);
+ SOAPMessage reqMessage = (SOAPMessage)binding.bindRequestMessage(opMetaData, epInv, null);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
@@ -164,14 +165,14 @@
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
SOAPMessage msg2 = new MessageFactoryImpl().createMessage(headers, in);
- epInv = bp.unbindRequestMessage(opMetaData, msg2);
+ epInv = binding.unbindRequestMessage(opMetaData, msg2);
assertEquals(epInv.getRequestParamValue(new QName("String_1")).toString(), "Hello World!");
assertEquals(epInv.getRequestParamValue(new QName("foo")).toString(), "hi");
epInv.setReturnValue("test");
- SOAPMessage responseMessage = bp.bindResponseMessage(opMetaData, epInv);
+ SOAPMessage responseMessage = (SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
stream = new ByteArrayOutputStream();
responseMessage.writeTo(stream);
@@ -184,7 +185,7 @@
headers.addHeader(MimeConstants.CONTENT_TYPE, type);
SOAPMessage msg3 = new MessageFactoryImpl().createMessage(headers, in);
- bp.unbindResponseMessage(opMetaData, msg3, epInv, null);
+ binding.unbindResponseMessage(opMetaData, msg3, epInv, null);
assertEquals("test", epInv.getReturnValue());
}
Modified: trunk-tdiesler/src/test/resources/jsr181/handlerchain/WEB-INF/web.xml
===================================================================
--- trunk-tdiesler/src/test/resources/jsr181/handlerchain/WEB-INF/web.xml 2006-08-08 19:47:05 UTC (rev 708)
+++ trunk-tdiesler/src/test/resources/jsr181/handlerchain/WEB-INF/web.xml 2006-08-08 20:06:38 UTC (rev 709)
@@ -7,7 +7,7 @@
<servlet>
<servlet-name>TestService</servlet-name>
- <servlet-class>org.jboss.test.ws.jsr181.handlerchain.MyWebService</servlet-class>
+ <servlet-class>org.jboss.test.ws.jsr181.handlerchain.EndpointImpl</servlet-class>
</servlet>
<servlet-mapping>
More information about the jboss-svn-commits
mailing list