You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by ip...@apache.org on 2005/03/03 00:59:25 UTC
svn commit: r155977 - in incubator/apollo/trunk/src/java/org/apache/ws:
resource/faults/ resource/handler/ resource/handler/axis/
resource/properties/faults/ util/ util/helper/
Author: ips
Date: Wed Mar 2 15:59:21 2005
New Revision: 155977
URL: http://svn.apache.org/viewcvs?view=rev&rev=155977
Log:
refactoring of Faults infrastructure
Added:
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractFaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/Description.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewBaseFaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewErrorCode.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/NewInvalidResourcePropertyQNameFaultException.java
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/ErrorCode.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java
incubator/apollo/trunk/src/java/org/apache/ws/util/SaajUtils.java
incubator/apollo/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractFaultException.java?view=auto&rev=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractFaultException.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/AbstractFaultException.java Wed Mar 2 15:59:21 2005
@@ -0,0 +1,100 @@
+/*=============================================================================*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.faults;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.SaajUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.rpc.JAXRPCException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.DetailEntry;
+
+/**
+ * Abstract base class that should be extended by all faults thrown from within Apollo.
+ *
+ * @author Ian P. Springer
+ */
+public abstract class AbstractFaultException extends SOAPFaultException
+{
+
+ private Detail m_detail;
+
+ protected AbstractFaultException( QName faultCode, String faultString, String faultActor, Detail detail )
+ {
+ super( faultCode, faultString, faultActor, detail );
+ m_detail = detail;
+ }
+
+ protected AbstractFaultException( QName faultCode, String faultString, String faultActor )
+ {
+ this( faultCode, faultString, faultActor, createDetail() );
+ }
+
+ protected AbstractFaultException( QName faultCode, String faultString )
+ {
+ this( faultCode, faultString, null );
+ }
+
+ private static Detail createDetail()
+ {
+ try
+ {
+ return SOAPFactory.newInstance().createDetail();
+ }
+ catch ( SOAPException soape )
+ {
+ throw new JAXRPCException( soape );
+ }
+ }
+
+ public DetailEntry addDetailEntry( XmlObject xmlElem )
+ {
+ if ( ! XmlBeanUtils.isDocument( xmlElem ) )
+ {
+ throw new IllegalArgumentException( "The specified XmlObject must be a document type." );
+ }
+ return addDetailEntry( ((Document)xmlElem.newDomNode( )).getDocumentElement() );
+ }
+
+ public DetailEntry addDetailEntry( Element domElem )
+ {
+ if ( getDetail() == null )
+ {
+ throw new IllegalStateException( "Detail entry cannot be added because detail is null." );
+ }
+ try
+ {
+ return SaajUtils.addDetailEntry( getDetail(), domElem );
+ }
+ catch ( SOAPException soape )
+ {
+ throw new JAXRPCException( soape );
+ }
+ }
+
+ public Detail getDetail()
+ {
+ return m_detail;
+ }
+
+}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/BaseFaultException.java Wed Mar 2 15:59:21 2005
@@ -29,216 +29,219 @@
import java.util.Calendar;
/**
- * LOG-DONE
- * The WS-BaseFaults base fault type implemented as a Java exception.
+ * LOG-DONE The WS-BaseFaults base fault type implemented as a Java exception.
*
* @author Ian P. Springer
*/
public class BaseFaultException
- extends SOAPFaultException
+ extends SOAPFaultException
{
- public static final Messages MSG = MessagesImpl.getInstance();
- /**
- * DOCUMENT_ME
- */
- private static QName DEFAULT_NAME;
- /**
- * DOCUMENT_ME
- */
- private static final QName DEFAULT_FAULT_CODE = Soap1_1Constants.FAULT_CLIENT;
- private Calendar m_timestamp;
- private EndpointReferenceType m_originator;
- private ErrorCode m_errorCode;
- private QName m_name;
- private String[] m_description;
- private BaseFaultException[] m_faultCause;
- private NamespaceVersionHolder m_namespaces;
-
- /**
- * Constructs a new BaseFaultException with the default name (wsbf:BaseFault). The SOAP fault code will be set to
- * soap:Client and the SOAP fault string will be set to the fault name. Sets the timestamp field to the current time
- * and the SOAP actor and detail fields to null.
- * @param namespaces
- */
- public BaseFaultException(NamespaceVersionHolder namespaces)
- {
- this( namespaces, null, null, null );
- }
-
- /**
- * Constructs a new BaseFaultException with the specified name. The SOAP fault code will be set to soap:Client and
- * the SOAP fault string will be set to the fault name. Sets the timestamp field to the current time and the SOAP
- * actor and detail fields to null.
- *
- * @param namespaces
- * @param name XML element name to use when serializing this fault
- */
- public BaseFaultException(NamespaceVersionHolder namespaces, QName name)
- {
- this( namespaces, name, null, null );
- }
-
- /**
- * Constructs a new BaseFaultException with the specified name and SOAP fault code. The SOAP fault string will be set
- * to the fault name. Sets the timestamp field to the current time and the SOAP actor and detail fields to null.
- *
- * @param namespaces
- * @param name XML element name to use when serializing this fault
- * @param faultCode the SOAP fault code
- */
- public BaseFaultException(NamespaceVersionHolder namespaces, QName name,
- QName faultCode)
- {
- this( namespaces, name, faultCode, null );
- }
-
- /**
- * Constructs a new BaseFaultException with the specified name, SOAP fault code, and SOAP fault string. Sets the
- * timestamp field to the current time and the SOAP actor and detail fields to null.
- *
- * @param namespaces
- * @param name XML element name to use when serializing this fault
- * @param faultCode the SOAP fault code
- * @param faultString the SOAP fault string; if null, String.valueOf( name ) will be used as faultString
- */
- public BaseFaultException(NamespaceVersionHolder namespaces, QName name,
- QName faultCode,
- String faultString)
- {
- super( ( faultCode != null ) ? faultCode : DEFAULT_FAULT_CODE,
- ( faultString != null ) ? faultString : String.valueOf( name ), null, null );
- DEFAULT_NAME = new QName( namespaces.getBaseFaultsXsdNamespace(), "BaseFault",
- Faults1_2Constants.NSPREFIX_BASEFAULTS_SCHEMA );
- m_namespaces = namespaces;
- m_name = ( name != null ) ? name : DEFAULT_NAME;
- m_timestamp = Calendar.getInstance( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param description DOCUMENT_ME
- */
- public void setDescription( String[] description )
- {
- m_description = description;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public String[] getDescription( )
- {
- return m_description;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param errorCode DOCUMENT_ME
- */
- public void setErrorCode( ErrorCode errorCode )
- {
- m_errorCode = errorCode;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public ErrorCode getErrorCode( )
- {
- return m_errorCode;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param faultCause DOCUMENT_ME
- */
- public void setFaultCause( BaseFaultException[] faultCause )
- {
- m_faultCause = faultCause;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public BaseFaultException[] getFaultCause( )
- {
- return m_faultCause;
- }
-
- /**
- * @return
- */
- public QName getName( )
- {
- return m_name;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param originator DOCUMENT_ME
- */
- public void setOriginator( EndpointReferenceType originator )
- {
- m_originator = originator;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public EndpointReferenceType getOriginator( )
- {
- return m_originator;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param timestamp DOCUMENT_ME
- */
- public void setTimestamp( Calendar timestamp )
- {
- m_timestamp = timestamp;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Calendar getTimestamp( )
- {
- return m_timestamp;
- }
+ public static final Messages MSG = MessagesImpl.getInstance();
+ /**
+ * DOCUMENT_ME
+ */
+ private static QName DEFAULT_NAME;
+ /**
+ * DOCUMENT_ME
+ */
+ private static final QName DEFAULT_FAULT_CODE = Soap1_1Constants.FAULT_CLIENT;
+ private Calendar m_timestamp;
+ private EndpointReferenceType m_originator;
+ private ErrorCode m_errorCode;
+ private QName m_name;
+ private String[] m_description;
+ private BaseFaultException[] m_faultCause;
+ private NamespaceVersionHolder m_namespaces;
+
+ /**
+ * Constructs a new BaseFaultException with the default name (wsbf:BaseFault). The SOAP fault code will be set to
+ * soap:Client and the SOAP fault string will be set to the fault name. Sets the timestamp field to the current time
+ * and the SOAP actor and detail fields to null.
+ *
+ * @param namespaces
+ */
+ public BaseFaultException( NamespaceVersionHolder namespaces )
+ {
+ this( namespaces, null, null, null );
+ }
+
+ /**
+ * Constructs a new BaseFaultException with the specified name. The SOAP fault code will be set to soap:Client and
+ * the SOAP fault string will be set to the fault name. Sets the timestamp field to the current time and the SOAP
+ * actor and detail fields to null.
+ *
+ * @param namespaces
+ * @param name XML element name to use when serializing this fault
+ */
+ public BaseFaultException( NamespaceVersionHolder namespaces, QName name )
+ {
+ this( namespaces, name, null, null );
+ }
+
+ /**
+ * Constructs a new BaseFaultException with the specified name and SOAP fault code. The SOAP fault string will be
+ * set to the fault name. Sets the timestamp field to the current time and the SOAP actor and detail fields to
+ * null.
+ *
+ * @param namespaces
+ * @param name XML element name to use when serializing this fault
+ * @param faultCode the SOAP fault code
+ */
+ public BaseFaultException( NamespaceVersionHolder namespaces, QName name,
+ QName faultCode )
+ {
+ this( namespaces, name, faultCode, null );
+ }
+
+ /**
+ * Constructs a new BaseFaultException with the specified name, SOAP fault code, and SOAP fault string. Sets the
+ * timestamp field to the current time and the SOAP actor and detail fields to null.
+ *
+ * @param namespaces
+ * @param name XML element name to use when serializing this fault
+ * @param faultCode the SOAP fault code
+ * @param faultString the SOAP fault string; if null, String.valueOf( name ) will be used as faultString
+ */
+ public BaseFaultException( NamespaceVersionHolder namespaces, QName name,
+ QName faultCode,
+ String faultString )
+ {
+ super( ( faultCode != null ) ? faultCode : DEFAULT_FAULT_CODE,
+ ( faultString != null ) ? faultString : String.valueOf( name ), null, null );
+ DEFAULT_NAME = new QName( namespaces.getBaseFaultsXsdNamespace(), "BaseFault",
+ Faults1_2Constants.NSPREFIX_BASEFAULTS_SCHEMA );
+ m_namespaces = namespaces;
+ m_name = ( name != null ) ? name : DEFAULT_NAME;
+ m_timestamp = Calendar.getInstance();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param description DOCUMENT_ME
+ */
+ public void setDescription( String[] description )
+ {
+ m_description = description;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String[] getDescription()
+ {
+ return m_description;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param errorCode DOCUMENT_ME
+ */
+ public void setErrorCode( ErrorCode errorCode )
+ {
+ m_errorCode = errorCode;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ErrorCode getErrorCode()
+ {
+ return m_errorCode;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param faultCause DOCUMENT_ME
+ */
+ public void setFaultCause( BaseFaultException[] faultCause )
+ {
+ m_faultCause = faultCause;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public BaseFaultException[] getFaultCause()
+ {
+ return m_faultCause;
+ }
+
+ /**
+ * @return
+ */
+ public QName getName()
+ {
+ return m_name;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param originator DOCUMENT_ME
+ */
+ public void setOriginator( EndpointReferenceType originator )
+ {
+ m_originator = originator;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public EndpointReferenceType getOriginator()
+ {
+ return m_originator;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param timestamp DOCUMENT_ME
+ */
+ public void setTimestamp( Calendar timestamp )
+ {
+ m_timestamp = timestamp;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Calendar getTimestamp()
+ {
+ return m_timestamp;
+ }
public NamespaceVersionHolder getNamespaces()
{
return m_namespaces;
}
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public String toString( )
- {
- return new ToStringBuilder( this ).append( MSG.getMessage(Keys.NAME), m_name ).append( MSG.getMessage(Keys.FAULTCODE),
- getFaultCode( ) )
- .append( MSG.getMessage(Keys.FAULTSTRING),
- getFaultString( ) ).append( MSG.getMessage(Keys.DESCRIPTION), m_description )
- .append( MSG.getMessage(Keys.ERRORCODE), m_errorCode ).append( MSG.getMessage(Keys.FAULTCAUSE) , m_faultCause )
- .toString( );
- }
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String toString()
+ {
+ return new ToStringBuilder( this ).append( MSG.getMessage( Keys.NAME ), m_name ).append(
+ MSG.getMessage( Keys.FAULTCODE ),
+ getFaultCode() )
+ .append( MSG.getMessage( Keys.FAULTSTRING ),
+ getFaultString() ).append( MSG.getMessage( Keys.DESCRIPTION ), m_description )
+ .append( MSG.getMessage( Keys.ERRORCODE ), m_errorCode ).append( MSG.getMessage( Keys.FAULTCAUSE ),
+ m_faultCause )
+ .toString();
+ }
}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/Description.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/Description.java?view=auto&rev=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/Description.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/Description.java Wed Mar 2 15:59:21 2005
@@ -0,0 +1,49 @@
+/*=============================================================================*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.faults;
+
+/**
+ * The WS-BaseFaults Description type.
+ *
+ * @author Ian P. Springer
+ */
+public class Description
+{
+
+ private String m_value;
+ private String m_lang;
+
+ public Description( String value )
+ {
+ m_value = value;
+ }
+
+ public String getValue()
+ {
+ return m_value;
+ }
+
+ public String getLang()
+ {
+ return m_lang;
+ }
+
+ public void setLang( String lang )
+ {
+ m_lang = lang;
+ }
+
+}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/ErrorCode.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/ErrorCode.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/ErrorCode.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/ErrorCode.java Wed Mar 2 15:59:21 2005
@@ -25,16 +25,15 @@
import java.util.Arrays;
/**
- * LOG-DONE
- * The WS-BaseFaults error code type.
+ * The WS-BaseFaults ErrorCode type.
*
* @author Ian P. Springer
*/
public class ErrorCode
{
public static final Messages MSG = MessagesImpl.getInstance();
- private URI m_dialect; // in the XML type, this is a required attribute on the top-level error code element
- private SOAPElement[] m_content;
+ private URI m_dialect; // in the XML type, this is a required attribute on the top-level ErrorCode element
+ private SOAPElement[] m_content;
/**
* Creates a new {@link ErrorCode} object.
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewBaseFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewBaseFaultException.java?view=auto&rev=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewBaseFaultException.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewBaseFaultException.java Wed Mar 2 15:59:21 2005
@@ -0,0 +1,291 @@
+/*=============================================================================*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.faults;
+
+import org.apache.axis.message.addressing.EndpointReferenceType;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.Soap1_1Constants;
+import org.apache.xmlbeans.XmlObject;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import java.util.Calendar;
+
+/**
+ * The WS-BaseFaults base fault type implemented as a Java exception.
+ *
+ * @author Ian P. Springer
+ */
+public class NewBaseFaultException extends AbstractFaultException
+{
+
+ private static final QName DEFAULT_FAULT_CODE = Soap1_1Constants.FAULT_CLIENT;
+
+ private Calendar m_timestamp;
+ private EndpointReferenceType m_originator; // TODO: use our EPR facade instead of the Apache Addressing type
+ private NewErrorCode m_errorCode;
+ private Description[] m_description;
+ private NewBaseFaultException[] m_faultCause;
+ private NamespaceVersionHolder m_namespaceSet;
+ private DetailEntry m_detailEntry;
+
+ public NewBaseFaultException( NamespaceVersionHolder namespaceSet, String faultString, QName faultCode )
+ {
+ super( faultCode, faultString );
+ m_namespaceSet = namespaceSet;
+ m_timestamp = Calendar.getInstance();
+ }
+
+ public NewBaseFaultException( NamespaceVersionHolder namespaceSet, String faultString )
+ {
+ this( namespaceSet, faultString, DEFAULT_FAULT_CODE );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param description DOCUMENT_ME
+ */
+ public void setDescription( Description[] description )
+ {
+ m_description = description;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Description[] getDescription()
+ {
+ return m_description;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param errorCode DOCUMENT_ME
+ */
+ public void setErrorCode( NewErrorCode errorCode )
+ {
+ m_errorCode = errorCode;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public NewErrorCode getErrorCode()
+ {
+ return m_errorCode;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param faultCause DOCUMENT_ME
+ */
+ public void setFaultCause( NewBaseFaultException[] faultCause )
+ {
+ m_faultCause = faultCause;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public NewBaseFaultException[] getFaultCause()
+ {
+ return m_faultCause;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param originator DOCUMENT_ME
+ */
+ public void setOriginator( EndpointReferenceType originator )
+ {
+ m_originator = originator;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public EndpointReferenceType getOriginator()
+ {
+ return m_originator;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param timestamp DOCUMENT_ME
+ */
+ public void setTimestamp( Calendar timestamp )
+ {
+ m_timestamp = timestamp;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Calendar getTimestamp()
+ {
+ return m_timestamp;
+ }
+
+ protected NamespaceVersionHolder getNamespaceSet()
+ {
+ return m_namespaceSet;
+ }
+
+ /**
+ * This method should be overridden by subclasses to create the appropriate
+ * type of BaseFault document XmlBean. It should only create the XmlBean,
+ * not populate it - this class will take care of populating it.
+ *
+ * @return a document XmlBean enclosing an XmlBean that extends BaseFaultType
+ */
+ protected XmlObject createBaseFaultDocumentXmlBean()
+ {
+ XmlObject baseFaultDocXBean;
+ if ( m_namespaceSet instanceof org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl )
+ {
+ baseFaultDocXBean =
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultDocument.Factory.newInstance();
+ }
+ else
+ {
+ baseFaultDocXBean =
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultDocument.Factory.newInstance();
+ }
+ return baseFaultDocXBean;
+ }
+
+ public Detail getDetail()
+ {
+ updateDetail();
+ return super.getDetail();
+ }
+
+ private void updateDetail()
+ {
+ XmlObject baseFaultDocXBean = toXmlObject();
+ if ( m_detailEntry != null )
+ {
+ m_detailEntry.detachNode();
+ }
+ m_detailEntry = addDetailEntry( baseFaultDocXBean );
+ }
+
+ public XmlObject toXmlObject()
+ {
+ XmlObject baseFaultDocXBean = createBaseFaultDocumentXmlBean();
+ if ( m_description == null )
+ {
+ m_description = new Description[] { new Description( getFaultString() ) };
+ }
+ if ( m_namespaceSet instanceof org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl )
+ {
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultDocument baseFaultDoc = (org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultDocument) baseFaultDocXBean;
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultType baseFaultType = baseFaultDoc.addNewBaseFault();
+ baseFaultType.setTimestamp( m_timestamp );
+ if ( m_description != null )
+ {
+ for ( int i = 0; i < m_description.length; i++ )
+ {
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultType.Description description = baseFaultType.addNewDescription();
+ description.setStringValue( m_description[i].getValue() );
+ if ( m_description[i].getLang() != null )
+ {
+ description.setLang( m_description[i].getLang() );
+ }
+ }
+ }
+ if ( m_errorCode != null )
+ {
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSBaseFaults12Draft03.BaseFaultType.ErrorCode errorCode = baseFaultType.addNewErrorCode();
+ errorCode.setDialect( m_errorCode.getDialect().toString() );
+ XmlObject[] elems = m_errorCode.getContent();
+ for ( int i = 0; i < elems.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( errorCode, elems[i] );
+ }
+ }
+ if ( m_faultCause != null )
+ {
+ for ( int i = 0; i < m_faultCause.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( baseFaultType, m_faultCause[i].toXmlObject() );
+ }
+ }
+ if ( m_originator != null )
+ {
+ // TODO
+ }
+ }
+ else
+ {
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultDocument baseFaultDoc = (org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultDocument) baseFaultDocXBean;
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultType baseFaultType = baseFaultDoc.addNewBaseFault();
+ baseFaultType.setTimestamp( m_timestamp );
+ if ( m_description != null )
+ {
+ for ( int i = 0; i < m_description.length; i++ )
+ {
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultType.Description description = baseFaultType.addNewDescription();
+ description.setStringValue( m_description[i].getValue() );
+ if ( m_description[i].getLang() != null )
+ {
+ description.setLang( m_description[i].getLang() );
+ }
+ }
+ }
+ if ( m_errorCode != null )
+ {
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSBaseFaults12Draft01.BaseFaultType.ErrorCode errorCode = baseFaultType.addNewErrorCode();
+ errorCode.setDialect( m_errorCode.getDialect().toString() );
+ XmlObject[] elems = m_errorCode.getContent();
+ for ( int i = 0; i < elems.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( errorCode, elems[i] );
+ }
+ }
+ if ( m_faultCause != null )
+ {
+ for ( int i = 0; i < m_faultCause.length; i++ )
+ {
+ XmlBeanUtils.addChildElement( baseFaultType, m_faultCause[i].toXmlObject() );
+ }
+ }
+ if ( m_originator != null )
+ {
+ // TODO
+ }
+ }
+ return baseFaultDocXBean;
+ }
+
+}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewErrorCode.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewErrorCode.java?view=auto&rev=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewErrorCode.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/faults/NewErrorCode.java Wed Mar 2 15:59:21 2005
@@ -0,0 +1,89 @@
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.faults;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlObject;
+
+import java.net.URI;
+import java.util.Arrays;
+
+/**
+ * The WS-BaseFaults ErrorCode type.
+ *
+ * @author Ian P. Springer
+ */
+public class NewErrorCode
+{
+ public static final Messages MSG = MessagesImpl.getInstance();
+ private URI m_dialect; // in the XML type, this is a required attribute on the top-level ErrorCode element
+ private XmlObject[] m_content;
+
+ /**
+ * Creates a new {@link NewErrorCode} object.
+ *
+ * @param dialect DOCUMENT_ME
+ */
+ public NewErrorCode( URI dialect )
+ {
+ m_dialect = dialect;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param content DOCUMENT_ME
+ */
+ public void setContent( XmlObject[] content )
+ {
+ m_content = content;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public XmlObject[] getContent( )
+ {
+ return m_content;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public URI getDialect( )
+ {
+ return m_dialect;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String toString( )
+ {
+ return new ToStringBuilder( this ).append( MSG.getMessage(Keys.DIALECT), m_dialect )
+ .append( MSG.getMessage(Keys.CONTENT),
+ Arrays.asList( m_content ) ).toString( );
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java Wed Mar 2 15:59:21 2005
@@ -186,7 +186,6 @@
throw new JAXRPCException( MSG.getMessage( Keys.UNEXPECTED_ERROR_WITH_EXCEPTION, t ) );
}
}
-
return false;
}
@@ -202,9 +201,7 @@
LOG.debug( MSG.getMessage( Keys.HANDLING_RESPONSE ) );
SOAPEnvelope responseEnvelope = getResponseEnvelope( (SOAPMessageContext) messageContext );
List responseBodyElems = (List) messageContext.getProperty( WSRF_RESPONSE_XMLOBJECT_LIST );
- LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS,
- Integer.toString( responseBodyElems.size() ) ) );
-
+ LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS, Integer.toString( responseBodyElems.size() ) ) );
if ( responseBodyElems != null )
{
try
@@ -229,7 +226,6 @@
}
}
}
-
return true;
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/handler/axis/ResourceProvider.java Wed Mar 2 15:59:21 2005
@@ -35,243 +35,267 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.rpc.soap.SOAPFaultException;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPMessage;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
/**
- * LOG-DONE
- * Axis provider that dispatches requests to WS-Resources.
+ * LOG-DONE Axis provider that dispatches requests to WS-Resources.
*
* @author Ian P. Springer, Sal Campana
*/
public class ResourceProvider
- extends ResourceHandler
- implements Handler
+ extends ResourceHandler
+ implements Handler
{
- private static final Log LOG = LogFactory.getLog( ResourceProvider.class );
+ private static final Log LOG = LogFactory.getLog( ResourceProvider.class );
public static final Messages MSG = MessagesImpl.getInstance();
- private GenericAxisHandler m_axisHelperHandler = new GenericAxisHandler( this );
+ private GenericAxisHandler m_axisHelperHandler = new GenericAxisHandler( this );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param doc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Element getDeploymentData( Document doc )
+ {
+ return m_axisHelperHandler.getDeploymentData( doc );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ */
+ public void setName( String name )
+ {
+ m_axisHelperHandler.setName( name );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getName()
+ {
+ return m_axisHelperHandler.getName();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ * @param value DOCUMENT_ME
+ */
+ public void setOption( String name,
+ Object value )
+ {
+ m_axisHelperHandler.setOption( name, value );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Object getOption( String name )
+ {
+ return m_axisHelperHandler.getOption( name );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param opts DOCUMENT_ME
+ */
+ public void setOptions( Hashtable opts )
+ {
+ m_axisHelperHandler.setOptions( opts );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Hashtable getOptions()
+ {
+ return m_axisHelperHandler.getOptions();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public List getUnderstoodHeaders()
+ {
+ return m_axisHelperHandler.getUnderstoodHeaders();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param qname DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean canHandleBlock( QName qname )
+ {
+ return m_axisHelperHandler.canHandleBlock( qname );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void cleanup()
+ {
+ m_axisHelperHandler.cleanup();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param msgContext DOCUMENT_ME
+ *
+ * @throws AxisFault DOCUMENT_ME
+ */
+ public void generateWSDL( MessageContext msgContext )
+ throws AxisFault
+ {
+ SOAPService service = msgContext.getService();
+ LOG.debug( MSG.getMessage( Keys.RECEIVED_WSDL_REQUEST, service.getName() ) );
+ service.generateWSDL( msgContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void init()
+ {
+ m_axisHelperHandler.init();
+ }
+
+ /**
+ * Invokes a Web service operation.
+ *
+ * @param msgContext Axis SOAP message context
+ *
+ * @throws AxisFault if a SOAP fault needs to be returned
+ */
+ public void invoke( MessageContext msgContext )
+ throws AxisFault
+ {
+ try
+ {
+ handleRequest( msgContext );
+ handleResponse( msgContext );
+ }
+ catch ( BaseFaultException bfe )
+ {
+ org.apache.ws.resource.properties.NamespaceVersionHolder namespaces = bfe.getNamespaces();
+ if ( namespaces instanceof org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl )
+ {
+ throw new org.apache.ws.resource.faults.axis.v1_2_draft03.BaseFaultType( bfe );
+ }
+ else
+ {
+ throw new org.apache.ws.resource.faults.axis.v1_2_draft01.BaseFaultType( bfe );
+ }
+ }
+ catch ( SOAPFaultException soapfe )
+ {
+ throw toAxisFault( soapfe );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param msgContext DOCUMENT_ME
+ */
+ public void onFault( MessageContext msgContext )
+ {
+ m_axisHelperHandler.onFault( msgContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soapMsgContext DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected SOAPMessage getResponseMessage( SOAPMessageContext soapMsgContext )
+ {
+ MessageContext axisMsgContext = ( (MessageContext) soapMsgContext );
+ Message responseMessage = axisMsgContext.getResponseMessage();
+ if ( responseMessage == null )
+ {
+ responseMessage = createMessage( axisMsgContext );
+ axisMsgContext.setResponseMessage( responseMessage );
+ }
+
+ return responseMessage;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soapMsgContext DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected ResourceContext createResourceContext( SOAPMessageContext soapMsgContext )
+ {
+ return new AxisResourceContext( soapMsgContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param responseBodyElem DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected SOAPBodyElement createSOAPBodyElement( XmlObject responseBodyElem )
+ {
+ return new org.apache.axis.message.SOAPBodyElement(
+ (Element) responseBodyElem.newDomNode().getFirstChild() );
+ }
+
+ private Message createMessage( MessageContext axisMsgContext )
+ {
+ SOAPEnvelope envelope =
+ new SOAPEnvelope( axisMsgContext.getSOAPConstants(),
+ axisMsgContext.getSchemaVersion() );
+ return new Message( envelope );
+ }
+
+ private AxisFault toAxisFault( SOAPFaultException soapfe )
+ {
+ AxisFault axisFault =
+ new AxisFault( soapfe.getFaultCode(),
+ soapfe.getFaultString(),
+ soapfe.getFaultActor(), null );
+ Detail detail = soapfe.getDetail();
+ Iterator detailEntryIter = detail.getDetailEntries();
+ while ( detailEntryIter.hasNext() )
+ {
+ DetailEntry detailEntry = (DetailEntry) detailEntryIter.next();
+ axisFault.addFaultDetail( detailEntry );
+ }
+ return ( axisFault );
+ }
- /**
- * DOCUMENT_ME
- *
- * @param doc DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Element getDeploymentData( Document doc )
- {
- return m_axisHelperHandler.getDeploymentData( doc );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param name DOCUMENT_ME
- */
- public void setName( String name )
- {
- m_axisHelperHandler.setName( name );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public String getName( )
- {
- return m_axisHelperHandler.getName( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param name DOCUMENT_ME
- * @param value DOCUMENT_ME
- */
- public void setOption( String name,
- Object value )
- {
- m_axisHelperHandler.setOption( name, value );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param name DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Object getOption( String name )
- {
- return m_axisHelperHandler.getOption( name );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param opts DOCUMENT_ME
- */
- public void setOptions( Hashtable opts )
- {
- m_axisHelperHandler.setOptions( opts );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Hashtable getOptions( )
- {
- return m_axisHelperHandler.getOptions( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public List getUnderstoodHeaders( )
- {
- return m_axisHelperHandler.getUnderstoodHeaders( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param qname DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public boolean canHandleBlock( QName qname )
- {
- return m_axisHelperHandler.canHandleBlock( qname );
- }
-
- /**
- * DOCUMENT_ME
- */
- public void cleanup( )
- {
- m_axisHelperHandler.cleanup( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param msgContext DOCUMENT_ME
- *
- * @throws AxisFault DOCUMENT_ME
- */
- public void generateWSDL( MessageContext msgContext )
- throws AxisFault
- {
- SOAPService service = msgContext.getService( );
- LOG.debug(MSG.getMessage(Keys.RECEIVED_WSDL_REQUEST, service.getName()));
- service.generateWSDL( msgContext );
- }
-
- /**
- * DOCUMENT_ME
- */
- public void init( )
- {
- m_axisHelperHandler.init( );
- }
-
- /**
- * Invokes a Web service operation.
- *
- * @param msgContext Axis SOAP message context
- *
- * @throws AxisFault if a SOAP fault needs to be returned
- */
- public void invoke( MessageContext msgContext )
- throws AxisFault
- {
- try
- {
- handleRequest( msgContext );
- handleResponse( msgContext );
- }
- catch ( BaseFaultException bfe )
- {
- org.apache.ws.resource.properties.NamespaceVersionHolder namespaces = bfe.getNamespaces();
- if( namespaces instanceof org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl)
- {
- throw new org.apache.ws.resource.faults.axis.v1_2_draft03.BaseFaultType( bfe );
- }
- else
- {
- throw new org.apache.ws.resource.faults.axis.v1_2_draft01.BaseFaultType( bfe );
- }
-
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param msgContext DOCUMENT_ME
- */
- public void onFault( MessageContext msgContext )
- {
- m_axisHelperHandler.onFault( msgContext );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soapMsgContext DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- protected SOAPMessage getResponseMessage( SOAPMessageContext soapMsgContext )
- {
- MessageContext axisMsgContext = ( (MessageContext) soapMsgContext );
- Message responseMessage = axisMsgContext.getResponseMessage( );
- if ( responseMessage == null )
- {
- responseMessage = createMessage( axisMsgContext );
- axisMsgContext.setResponseMessage( responseMessage );
- }
-
- return responseMessage;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soapMsgContext DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- protected ResourceContext createResourceContext( SOAPMessageContext soapMsgContext )
- {
- return new AxisResourceContext( soapMsgContext );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param responseBodyElem DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- protected SOAPBodyElement createSOAPBodyElement( XmlObject responseBodyElem )
- {
- return new org.apache.axis.message.SOAPBodyElement( (Element) responseBodyElem.newDomNode( ).getFirstChild( ) );
- }
-
- private Message createMessage( MessageContext axisMsgContext )
- {
- SOAPEnvelope envelope =
- new SOAPEnvelope( axisMsgContext.getSOAPConstants( ),
- axisMsgContext.getSchemaVersion( ) );
- return new Message( envelope );
- }
}
Added: incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/NewInvalidResourcePropertyQNameFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/NewInvalidResourcePropertyQNameFaultException.java?view=auto&rev=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/NewInvalidResourcePropertyQNameFaultException.java (added)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/properties/faults/NewInvalidResourcePropertyQNameFaultException.java Wed Mar 2 15:59:21 2005
@@ -0,0 +1,62 @@
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.properties.faults;
+
+import org.apache.ws.resource.faults.NewBaseFaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.xmlbeans.XmlObject;
+
+import javax.xml.namespace.QName;
+
+/**
+ * LOG-DONE WS-ResourceProperties InvalidResourcePropertyQName fault type implemented as a Java exception.
+ *
+ * @author Ian P. Springer
+ */
+public class NewInvalidResourcePropertyQNameFaultException
+ extends NewBaseFaultException
+{
+ public static final Messages MSG = MessagesImpl.getInstance();
+
+ /**
+ * Constructs a new NewInvalidResourcePropertyQNameFaultException.
+ *
+ * @param propName the invalid property QName
+ */
+ public NewInvalidResourcePropertyQNameFaultException( NamespaceVersionHolder namespaces, QName propName )
+ {
+ super( namespaces, MSG.getMessage( Keys.INVALID_PROP_NAME, propName ) );
+ }
+
+ protected XmlObject createBaseFaultDocumentXmlBean()
+ {
+ XmlObject baseFaultDocXBean;
+ if ( getNamespaceSet() instanceof org.apache.ws.resource.properties.v1_2_draft05.porttype.impl.NamespaceVersionHolderImpl )
+ {
+ baseFaultDocXBean =
+ org.oasisOpen.docs.wsrf.x2004.x11.wsrfWSResourceProperties12Draft05.InvalidResourcePropertyQNameFaultDocument.Factory.newInstance();
+ }
+ else
+ {
+ baseFaultDocXBean =
+ org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.InvalidResourcePropertyQNameFaultDocument.Factory.newInstance();
+ }
+ return baseFaultDocXBean;
+ }
+}
\ No newline at end of file
Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/SaajUtils.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/SaajUtils.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/SaajUtils.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/SaajUtils.java Wed Mar 2 15:59:21 2005
@@ -22,6 +22,8 @@
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
import javax.xml.soap.Node;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
@@ -33,225 +35,242 @@
/**
* LOG-DONE
+ *
* @author Ian P. Springer (Hewlett-Packard Company)
*/
public abstract class SaajUtils
{
public static final Messages MSG = MessagesImpl.getInstance();
- /**
- * Given a {@link SOAPElement}, returns a list containing the children of that element. If at least one of the
- * children is a SOAPElement, any {@link Text} nodes are excluded from the list. This is because it is assumed that
- * if the specified element has mixed content, it is only because of insignificant whitespace text nodes.
- *
- * @param soapElem a SAAJ {@link SOAPElement}
- *
- * @return a list containing the children of the specified {@link SOAPElement}
- */
- public static List getChildNodes( SOAPElement soapElem )
- {
- List elem_children = new ArrayList( );
- List text_children = new ArrayList( );
- Iterator node_iter = soapElem.getChildElements( );
-
- while ( node_iter.hasNext( ) )
- {
- Node child_node = (Node) node_iter.next( );
-
- if ( isSOAPElement( child_node ) )
- {
- elem_children.add( child_node );
- }
- else
- {
- text_children.add( child_node );
- }
- }
-
- return ( elem_children.isEmpty( ) ? text_children : elem_children );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param elem DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public static QName getQualifiedName( SOAPElement elem )
- {
- return ( elem != null ) ? NameUtils.toQName( elem.getElementName( ) ) : null;
- }
-
- /**
- * Returns true if the specified SAAJ node is an element, or false otherwise.
- *
- * @param soap_node a SAAJ node
- *
- * @return true if the specified SAAJ node is an element, or false otherwise
- */
- public static boolean isSOAPElement( Node soap_node )
- {
- // NOTE: the second condition below is nessary for Axis, because its Text impl also implements SOAPElement
- return ( soap_node instanceof SOAPElement && !( soap_node instanceof Text ) );
- }
-
- /**
- * Returns true if the specified SAAJ node is text, or false otherwise.
- *
- * @param soap_node a SAAJ node
- *
- * @return true if the specified SAAJ node is text, or false otherwise
- */
- public static boolean isText( Node soap_node )
- {
- return ( soap_node instanceof Text );
- }
-
- /**
- * Returns the value of the specified SAAJ text node.
- *
- * @param soapNode a SAAJ text node
- *
- * @return the value of the specified SAAJ text node
- *
- * @throws SOAPException
- */
- public static String getValue( Node soapNode )
- throws SOAPException
- {
- if ( soapNode == null )
- {
- throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MAY_NOT_BE_NULL) );
- }
-
- if ( isText( soapNode ) )
- {
- return getTextValue( (Text) soapNode );
- }
- else
- {
- return getSOAPElementValue( (SOAPElement) soapNode );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soapElem DOCUMENT_ME
- * @param value DOCUMENT_ME
- *
- * @throws SOAPException DOCUMENT_ME
- */
- public static void addTextNode( SOAPElement soapElem,
- String value )
- throws SOAPException
- {
- soapElem.addTextNode( value );
-
- if ( soapElem.getValue( ) == null )
- {
- Iterator childElemIter = soapElem.getChildElements( );
-
- if ( childElemIter.hasNext( ) )
- {
- Node firstChild = (Node) childElemIter.next( );
- if ( firstChild instanceof Text )
+ /**
+ * Given a {@link SOAPElement}, returns a list containing the children of that element. If at least one of the
+ * children is a SOAPElement, any {@link Text} nodes are excluded from the list. This is because it is assumed that
+ * if the specified element has mixed content, it is only because of insignificant whitespace text nodes.
+ *
+ * @param soapElem a SAAJ {@link SOAPElement}
+ *
+ * @return a list containing the children of the specified {@link SOAPElement}
+ */
+ public static List getChildNodes( SOAPElement soapElem )
+ {
+ List elem_children = new ArrayList();
+ List text_children = new ArrayList();
+ Iterator node_iter = soapElem.getChildElements();
+
+ while ( node_iter.hasNext() )
+ {
+ Node child_node = (Node) node_iter.next();
+
+ if ( isSOAPElement( child_node ) )
+ {
+ elem_children.add( child_node );
+ }
+ else
{
- firstChild.setValue( value );
+ text_children.add( child_node );
+ }
+ }
+
+ return ( elem_children.isEmpty() ? text_children : elem_children );
+ }
- return;
+ /**
+ * DOCUMENT_ME
+ *
+ * @param elem DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public static QName getQualifiedName( SOAPElement elem )
+ {
+ return ( elem != null ) ? NameUtils.toQName( elem.getElementName() ) : null;
+ }
+
+ /**
+ * Returns true if the specified SAAJ node is an element, or false otherwise.
+ *
+ * @param soap_node a SAAJ node
+ *
+ * @return true if the specified SAAJ node is an element, or false otherwise
+ */
+ public static boolean isSOAPElement( Node soap_node )
+ {
+ // NOTE: the second condition below is nessary for Axis, because its Text impl also implements SOAPElement
+ return ( soap_node instanceof SOAPElement && !( soap_node instanceof Text ) );
+ }
+
+ /**
+ * Returns true if the specified SAAJ node is text, or false otherwise.
+ *
+ * @param soap_node a SAAJ node
+ *
+ * @return true if the specified SAAJ node is text, or false otherwise
+ */
+ public static boolean isText( Node soap_node )
+ {
+ return ( soap_node instanceof Text );
+ }
+
+ /**
+ * Returns the value of the specified SAAJ text node.
+ *
+ * @param soapNode a SAAJ text node
+ *
+ * @return the value of the specified SAAJ text node
+ *
+ * @throws SOAPException
+ */
+ public static String getValue( Node soapNode )
+ throws SOAPException
+ {
+ if ( soapNode == null )
+ {
+ throw new IllegalArgumentException( MSG.getMessage( Keys.PARAM_MAY_NOT_BE_NULL ) );
+ }
+
+ if ( isText( soapNode ) )
+ {
+ return getTextValue( (Text) soapNode );
+ }
+ else
+ {
+ return getSOAPElementValue( (SOAPElement) soapNode );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soapElem DOCUMENT_ME
+ * @param value DOCUMENT_ME
+ *
+ * @throws SOAPException DOCUMENT_ME
+ */
+ public static void addTextNode( SOAPElement soapElem,
+ String value )
+ throws SOAPException
+ {
+ soapElem.addTextNode( value );
+
+ if ( soapElem.getValue() == null )
+ {
+ Iterator childElemIter = soapElem.getChildElements();
+
+ if ( childElemIter.hasNext() )
+ {
+ Node firstChild = (Node) childElemIter.next();
+
+ if ( firstChild instanceof Text )
+ {
+ firstChild.setValue( value );
+
+ return;
+ }
}
- }
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param value DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- *
- * @throws SOAPException DOCUMENT_ME
- */
- public static Text createTextNode( String value )
- throws SOAPException
- {
- return ( (Text) SOAPFactory.newInstance( ).createElement( "foo" ).addTextNode( value ).getChildElements( )
- .next( ) );
- }
-
- /**
- * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
- *
- * @param elem a DOM {@link org.w3c.dom.Element}
- *
- * @return a {@link javax.xml.soap.SOAPElement}
- *
- * @throws javax.xml.soap.SOAPException
- */
- public static SOAPElement toSOAPElement( Element elem )
- throws SOAPException
- {
- return ( new Dom2SaajConverter( ).toSOAPElement( elem ) );
- }
-
-
- private static String getSOAPElementValue( SOAPElement soapElem )
- {
- String value = soapElem.getValue( );
-
- if ( value == null )
- {
- Text textNode = getTextNode( soapElem );
-
- if ( textNode != null )
- {
- value = textNode.getValue( );
- }
- }
-
- if ( value == null )
- {
- value = soapElem.getNodeValue( );
- }
-
- return value;
- }
-
- private static Text getTextNode( SOAPElement soapElem )
- {
- Iterator childElemIter = soapElem.getChildElements( );
-
- if ( childElemIter.hasNext( ) )
- {
- Node firstChild = (Node) childElemIter.next( );
-
- if ( firstChild instanceof Text )
- {
- return (Text) firstChild;
- }
- }
-
- return null;
- }
-
- private static String getTextValue( Text soapText )
- throws SOAPException
- {
- String value = soapText.getValue( );
-
- if ( value == null )
- {
- value = soapText.toString( );
- }
-
- if ( value == null )
- {
- throw new SOAPException( MSG.getMessage( Keys.TEXT_NODE_IS_NULL) );
- }
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param value DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws SOAPException DOCUMENT_ME
+ */
+ public static Text createTextNode( String value )
+ throws SOAPException
+ {
+ return ( (Text) SOAPFactory.newInstance().createElement( "foo" ).addTextNode( value ).getChildElements()
+ .next() );
+ }
+
+ /**
+ * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
+ *
+ * @param elem a DOM {@link org.w3c.dom.Element}
+ *
+ * @return a {@link javax.xml.soap.SOAPElement}
+ *
+ * @throws javax.xml.soap.SOAPException
+ */
+ public static SOAPElement toSOAPElement( Element elem )
+ throws SOAPException
+ {
+ return ( new Dom2SaajConverter().toSOAPElement( elem ) );
+ }
+
+ /**
+ * Adds a DOM {@link org.w3c.dom.Element} as an entry to a SAAJ {@link Detail}.
+ *
+ * @param detail a SAAJ detail
+ * @param domElem a DOM element to be added as an entry in the specified detail
+ *
+ * @return a SAAJ detail entry
+ *
+ * @throws javax.xml.soap.SOAPException
+ */
+ public static DetailEntry addDetailEntry( Detail detail, Element domElem )
+ throws SOAPException
+ {
+ return ( new Dom2SaajConverter().addDetailEntry( detail, domElem ) );
+ }
+
+ private static String getSOAPElementValue( SOAPElement soapElem )
+ {
+ String value = soapElem.getValue();
+
+ if ( value == null )
+ {
+ Text textNode = getTextNode( soapElem );
+
+ if ( textNode != null )
+ {
+ value = textNode.getValue();
+ }
+ }
+
+ if ( value == null )
+ {
+ value = soapElem.getNodeValue();
+ }
+
+ return value;
+ }
+
+ private static Text getTextNode( SOAPElement soapElem )
+ {
+ Iterator childElemIter = soapElem.getChildElements();
+
+ if ( childElemIter.hasNext() )
+ {
+ Node firstChild = (Node) childElemIter.next();
+
+ if ( firstChild instanceof Text )
+ {
+ return (Text) firstChild;
+ }
+ }
+
+ return null;
+ }
+
+ private static String getTextValue( Text soapText )
+ throws SOAPException
+ {
+ String value = soapText.getValue();
+
+ if ( value == null )
+ {
+ value = soapText.toString();
+ }
+
+ if ( value == null )
+ {
+ throw new SOAPException( MSG.getMessage( Keys.TEXT_NODE_IS_NULL ) );
+ }
- return value;
- }
+ return value;
+ }
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java?view=diff&r1=155976&r2=155977
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/util/helper/Dom2SaajConverter.java Wed Mar 2 15:59:21 2005
@@ -21,211 +21,248 @@
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
-/** LOG-DONE
+/**
+ * LOG-DONE
+ *
* @author Ian P. Springer
*/
public class Dom2SaajConverter
{
- private SOAPFactory m_soap_factory;
+ private SOAPFactory m_soap_factory;
- /**
- * Creates a new {@link Dom2SaajConverter} object.
- *
- * @throws SOAPException DOCUMENT_ME
- */
- public Dom2SaajConverter( )
- throws SOAPException
- {
- m_soap_factory = SOAPFactory.newInstance( );
- }
-
- /**
- * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
- *
- * @param domElem a DOM {@link org.w3c.dom.Element}
- *
- * @return a {@link javax.xml.soap.SOAPElement}
- *
- * @throws javax.xml.soap.SOAPException
- */
- public SOAPElement toSOAPElement( Element domElem )
- throws SOAPException
- {
- if ( domElem == null )
- {
- return null;
- }
-
- SOAPElement soapElem;
- if ( domElem instanceof SOAPElement )
- {
- soapElem = (SOAPElement) domElem;
- }
- else
- {
- soapElem =
- m_soap_factory.createElement( domElem.getLocalName( ),
- getPrefix( domElem ),
- getNamespaceURI( domElem ) );
-
- buildSOAPElement( domElem, soapElem );
- }
-
- return ( soapElem );
- }
-
- /**
- * @param attrib
- *
- * @return
- */
- private static boolean isNamespaceDeclarationAttrib( org.w3c.dom.Node attrib )
- {
- String prefix = attrib.getPrefix( );
- String ns_uri = attrib.getNamespaceURI( );
-
- return ( ( ( prefix != null ) && prefix.equals( XmlConstants.NSPREFIX_XMLNS ) )
- || ( ( ns_uri != null ) && ns_uri.equals( XmlConstants.NSURI_XMLNS ) ) )
- && !attrib.getLocalName( ).equals( XmlConstants.NSPREFIX_XMLNS );
- }
-
- /**
- * @param node
- *
- * @return
- */
- private static String getNamespaceURI( org.w3c.dom.Node node )
- {
- String ns_uri = node.getNamespaceURI( );
-
- return ( ( ns_uri != null ) ? ns_uri : "" );
- }
-
- /**
- * @param node
- *
- * @return
- */
- private static String getPrefix( org.w3c.dom.Node node )
- {
- String prefix = node.getPrefix( );
-
- return ( ( prefix != null ) ? prefix : NameUtils.getNamespacePrefix( node.getNamespaceURI( ) ) );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soap_elem DOCUMENT_ME
- * @param elem DOCUMENT_ME
- *
- * @throws SOAPException DOCUMENT_ME
- */
- private SOAPElement addAttributes( SOAPElement soap_elem,
- Element elem )
- throws SOAPException
- {
- NamedNodeMap attribs = elem.getAttributes( );
-
- for ( int i = 0; i < attribs.getLength( ); i++ )
- {
- org.w3c.dom.Node attrib = attribs.item( i );
-
- if ( isNamespaceDeclarationAttrib( attrib ) )
- {
- soap_elem.addNamespaceDeclaration( attrib.getLocalName( ),
- attrib.getNodeValue( ) );
- }
- else
- {
- if ( hasPrefix( soap_elem ) && attrib.getLocalName( ).equals( XmlConstants.NSPREFIX_XMLNS ) )
+ /**
+ * Creates a new {@link Dom2SaajConverter} object.
+ *
+ * @throws SOAPException DOCUMENT_ME
+ */
+ public Dom2SaajConverter()
+ throws SOAPException
+ {
+ m_soap_factory = SOAPFactory.newInstance();
+ }
+
+ /**
+ * Converts a DOM {@link org.w3c.dom.Element} to a SAAJ {@link javax.xml.soap.SOAPElement}.
+ *
+ * @param domElem a DOM {@link org.w3c.dom.Element}
+ *
+ * @return a {@link javax.xml.soap.SOAPElement}
+ *
+ * @throws javax.xml.soap.SOAPException
+ */
+ public SOAPElement toSOAPElement( Element domElem )
+ throws SOAPException
+ {
+ if ( domElem == null )
+ {
+ return null;
+ }
+
+ SOAPElement soapElem;
+ if ( domElem instanceof SOAPElement )
+ {
+ soapElem = (SOAPElement) domElem;
+ }
+ else
+ {
+ soapElem =
+ m_soap_factory.createElement( domElem.getLocalName(),
+ getPrefix( domElem ),
+ getNamespaceURI( domElem ) );
+
+ buildSOAPElement( domElem, soapElem );
+ }
+
+ return ( soapElem );
+ }
+
+ /**
+ * Adds a DOM {@link org.w3c.dom.Element} as an entry to a SAAJ {@link Detail}.
+ *
+ * @param detail a SAAJ detail
+ * @param domElem a DOM element to be added as an entry in the specified detail
+ *
+ * @return a SAAJ detail entry
+ *
+ * @throws javax.xml.soap.SOAPException
+ */
+ public DetailEntry addDetailEntry( Detail detail, Element domElem )
+ throws SOAPException
+ {
+ if ( domElem == null )
+ {
+ return null;
+ }
+ DetailEntry detailEntry;
+ if ( domElem instanceof DetailEntry )
+ {
+ detailEntry = (DetailEntry) domElem;
+ }
+ else
+ {
+ detailEntry =
+ detail.addDetailEntry( m_soap_factory.createName( domElem.getLocalName(),
+ getPrefix( domElem ),
+ getNamespaceURI( domElem ) ) );
+ buildSOAPElement( domElem, detailEntry );
+ }
+ return detailEntry;
+ }
+
+ /**
+ * @param attrib
+ *
+ * @return
+ */
+ private static boolean isNamespaceDeclarationAttrib( org.w3c.dom.Node attrib )
+ {
+ String prefix = attrib.getPrefix();
+ String ns_uri = attrib.getNamespaceURI();
+
+ return ( ( ( prefix != null ) && prefix.equals( XmlConstants.NSPREFIX_XMLNS ) )
+ || ( ( ns_uri != null ) && ns_uri.equals( XmlConstants.NSURI_XMLNS ) ) )
+ && !attrib.getLocalName().equals( XmlConstants.NSPREFIX_XMLNS );
+ }
+
+ /**
+ * @param node
+ *
+ * @return
+ */
+ private static String getNamespaceURI( org.w3c.dom.Node node )
+ {
+ String ns_uri = node.getNamespaceURI();
+
+ return ( ns_uri != null ? ns_uri : "" );
+ }
+
+ /**
+ * @param node
+ *
+ * @return
+ */
+ private static String getPrefix( org.w3c.dom.Node node )
+ {
+ String prefix = node.getPrefix();
+
+ return ( prefix != null ? prefix : NameUtils.getNamespacePrefix( node.getNamespaceURI() ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soap_elem DOCUMENT_ME
+ * @param elem DOCUMENT_ME
+ *
+ * @throws SOAPException DOCUMENT_ME
+ */
+ private SOAPElement addAttributes( SOAPElement soap_elem,
+ Element elem )
+ throws SOAPException
+ {
+ NamedNodeMap attribs = elem.getAttributes();
+
+ for ( int i = 0; i < attribs.getLength(); i++ )
+ {
+ org.w3c.dom.Node attrib = attribs.item( i );
+
+ if ( isNamespaceDeclarationAttrib( attrib ) )
+ {
+ soap_elem.addNamespaceDeclaration( attrib.getLocalName(),
+ attrib.getNodeValue() );
+ }
+ else
{
- // don't add an xmlns="..." attribute if the element has a prefix
- continue;
+ if ( hasPrefix( soap_elem ) && attrib.getLocalName().equals( XmlConstants.NSPREFIX_XMLNS ) )
+ {
+ // don't add an xmlns="..." attribute if the element has a prefix
+ continue;
+ }
+
+ Name attrib_pqname =
+ m_soap_factory.createName( attrib.getLocalName(),
+ attrib.getPrefix(),
+ attrib.getNamespaceURI() );
+
+ soap_elem.addAttribute( attrib_pqname,
+ attrib.getNodeValue() );
}
+ }
+
+ return ( soap_elem );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soap_elem DOCUMENT_ME
+ * @param elem DOCUMENT_ME
+ *
+ * @throws SOAPException DOCUMENT_ME
+ */
+ private SOAPElement addChildren( SOAPElement soap_elem,
+ Element elem )
+ throws SOAPException
+ {
+ NodeList children = elem.getChildNodes();
+
+ for ( int i = 0; i < children.getLength(); i++ )
+ {
+ org.w3c.dom.Node node = children.item( i );
+ short node_type = node.getNodeType();
+
+ if ( node_type == org.w3c.dom.Node.ELEMENT_NODE )
+ {
+ SOAPElement new_elem =
+ soap_elem.addChildElement( node.getLocalName(),
+ getPrefix( node ),
+ getNamespaceURI( node ) );
+
+ buildSOAPElement( (Element) node, new_elem );
+ }
+ else if ( node_type == org.w3c.dom.Node.TEXT_NODE )
+ {
+ soap_elem.addTextNode( node.getNodeValue() );
+ }
+ }
+
+ return ( soap_elem );
+ }
- Name attrib_pqname =
- m_soap_factory.createName( attrib.getLocalName( ),
- attrib.getPrefix( ),
- attrib.getNamespaceURI( ) );
-
- soap_elem.addAttribute( attrib_pqname,
- attrib.getNodeValue( ) );
- }
- }
-
- return ( soap_elem );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soap_elem DOCUMENT_ME
- * @param elem DOCUMENT_ME
- *
- * @throws SOAPException DOCUMENT_ME
- */
- private SOAPElement addChildren( SOAPElement soap_elem,
- Element elem )
- throws SOAPException
- {
- NodeList children = elem.getChildNodes( );
-
- for ( int i = 0; i < children.getLength( ); i++ )
- {
- org.w3c.dom.Node node = children.item( i );
- short node_type = node.getNodeType( );
-
- if ( node_type == org.w3c.dom.Node.ELEMENT_NODE )
- {
- SOAPElement new_elem =
- soap_elem.addChildElement( node.getLocalName( ),
- getPrefix( node ),
- getNamespaceURI( node ) );
-
- buildSOAPElement( (Element) node, new_elem );
- }
- else if ( node_type == org.w3c.dom.Node.TEXT_NODE )
- {
- soap_elem.addTextNode( node.getNodeValue( ) );
- }
- }
-
- return ( soap_elem );
- }
-
- /**
- * Workhorse method for {@link Dom2SaajConverter#toSOAPElement} - calls itself recursively.
- *
- * @param elem the DOM element to be converted
- * @param soap_elem the SAAJ SOAP element being built
- *
- * @throws SOAPException
- */
- private SOAPElement buildSOAPElement( Element elem,
- SOAPElement soap_elem )
- throws SOAPException
- {
- return ( addChildren( addAttributes( soap_elem, elem ),
- elem ) );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param soap_elem DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- private static boolean hasPrefix( SOAPElement soap_elem )
- {
- String prefix = soap_elem.getElementName( ).getPrefix( );
+ /**
+ * Workhorse method for {@link Dom2SaajConverter#toSOAPElement} - calls itself recursively.
+ *
+ * @param elem the DOM element to be converted
+ * @param soap_elem the SAAJ SOAP element being built
+ *
+ * @throws SOAPException
+ */
+ private SOAPElement buildSOAPElement( Element elem,
+ SOAPElement soap_elem )
+ throws SOAPException
+ {
+ return ( addChildren( addAttributes( soap_elem, elem ),
+ elem ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param soap_elem DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ private static boolean hasPrefix( SOAPElement soap_elem )
+ {
+ String prefix = soap_elem.getElementName().getPrefix();
- return ( ( prefix != null ) && !prefix.equals( XmlConstants.NSPREFIX_DEFAULT ) );
- }
+ return ( ( prefix != null ) && !prefix.equals( XmlConstants.NSPREFIX_DEFAULT ) );
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org