axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ashut...@apache.org
Subject svn commit: r210116 - in /webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj: DetailImpl.java SOAPFaultImpl.java
Date Mon, 11 Jul 2005 12:56:37 GMT
Author: ashutosh
Date: Mon Jul 11 05:56:36 2005
New Revision: 210116

URL: http://svn.apache.org/viewcvs?rev=210116&view=rev
Log:
The SOAPFault and Detail implementation classes for SAAJ based on OM SOAPFault classes

Modified:
    webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
    webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java

Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java?rev=210116&r1=210115&r2=210116&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java (original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java Mon
Jul 11 05:56:36 2005
@@ -19,11 +19,15 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAPFaultDetail;
 
 import javax.xml.soap.Detail;
 import javax.xml.soap.DetailEntry;
 import javax.xml.soap.Name;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+
 import java.util.ArrayList;
 import java.util.Iterator;
 
@@ -38,7 +42,7 @@
 	/**
 	 * Field detail
 	 */
-	OMElement detail;
+	protected SOAPFaultDetail detail;
 	
 	/**
 	 * Constructor DetailImpl
@@ -46,14 +50,15 @@
 	 * @param detailName
 	 * @param parent
 	 */
-	public DetailImpl(javax.xml.namespace.QName detailName, OMElement parent){
-		OMFactory omFactory = OMAbstractFactory.getOMFactory();
-		detail = omFactory.createOMElement(detailName, parent);
+	public DetailImpl(SOAPFault parent){
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		org.apache.axis2.soap.SOAPFault omFault = ((SOAPFaultImpl)parent).getOMFault();
+		detail = soapFactory.createSOAPFaultDetail(omFault);
 	}
 	
-	/*public DetailImpl(OMElement detail){
+	public DetailImpl(SOAPFaultDetail detail){
 		this.detail = detail;
-	}*/
+	}
 
 	/**
 	 * Method addDetailEntry
@@ -64,15 +69,12 @@
 	 * @see javax.xml.soap.Detail#addDetailEntry(javax.xml.soap.Name)
 	 */
 	public DetailEntry addDetailEntry(Name name) throws SOAPException {
-		
-		// Create a OMElement and add it as a child of Detail
-		// May need change after OM allows adding multiple detailEntries
-		// as then we can delegate the task there rather than dealing with OMElement here 
+		 
 		String localName = name.getLocalName();
 		OMFactory omFactory = OMAbstractFactory.getOMFactory(); 
 		OMNamespace ns = omFactory.createOMNamespace(name.getURI(), name.getPrefix());
 		OMElement detailEntry = omFactory.createOMElement(localName, ns);
-		detail.addChild(detailEntry);
+		detail.addDetailEntry(detailEntry);
 		return (new DetailEntryImpl(detailEntry));
 	}
 	
@@ -82,9 +84,9 @@
 	 * @param detailEntry
 	 * @return
 	 */
-	protected DetailEntry addDetailEntry(org.apache.axis2.om.OMNode detailEntry){
-		detail.addChild(detailEntry);
-		return (new DetailEntryImpl((OMElement)detailEntry));
+	protected DetailEntry addDetailEntry(org.apache.axis2.om.OMElement detailEntry){
+		detail.addDetailEntry(detailEntry);
+		return (new DetailEntryImpl(detailEntry));
 	}
 
 	/**
@@ -96,7 +98,7 @@
 	public Iterator getDetailEntries() {
 		// Get the detailEntried which will be omElements
 		// convert them to soap DetailEntry and return the iterator
-		Iterator detailEntryIter = detail.getChildren();
+		Iterator detailEntryIter = detail.getAllDetailEntries();
 		ArrayList aList = new ArrayList();
 		while(detailEntryIter.hasNext()){
 			Object o = detailEntryIter.next();

Modified: webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=210116&r1=210115&r2=210116&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
(original)
+++ webservices/axis/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
Mon Jul 11 05:56:36 2005
@@ -19,6 +19,16 @@
 import javax.xml.soap.Name;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAPFaultCode;
+import org.apache.axis2.soap.SOAPFaultDetail;
+import org.apache.axis2.soap.SOAPFaultNode;
+import org.apache.axis2.soap.SOAPFaultReason;
+import org.apache.axis2.soap.SOAPFaultText;
+import org.apache.axis2.soap.SOAPFaultValue;
+
 import java.util.Locale;
 
 /**
@@ -35,7 +45,7 @@
 	/**
 	 * Field fault   The omSOAPFault field
 	 */
-	org.apache.axis2.soap.SOAPFault fault;
+	protected org.apache.axis2.soap.SOAPFault fault;
 	
 	/**
 	 * Constructor SOAPFaultImpl
@@ -45,6 +55,10 @@
 		this.fault = fault;
 	}
 
+	public org.apache.axis2.soap.SOAPFault getOMFault(){
+		return fault;
+	}
+	
 	/**
 	 * Method setFaultCode
 	 * 
@@ -53,9 +67,13 @@
 	 * @see javax.xml.soap.SOAPFault#setFaultCode(java.lang.String)
 	 */
 	public void setFaultCode(String faultCode) throws SOAPException {
-		//QName qName = new QName(faultCode);
-		//fault.setFaultCode(qName);
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		// No direct mapping of SOAP 1.1 faultCode to SOAP 1.2, Mapping it to 
+		// (Fault Value of FaultCode) in OM impl
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		SOAPFaultCode fCode = soapFactory.createSOAPFaultCode(fault);
+		SOAPFaultValue value = soapFactory.createSOAPFaultValue(fCode);
+		fCode.setValue(value);
+		value.setText(faultCode);
 	}
 
 	/**
@@ -66,9 +84,8 @@
 	 */
 	public String getFaultCode() {
 	
-		//QName qName = fault.getFaultCode();
-		//return qName.getLocalPart();
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		//FaultCode mapped to Fault.FaultCode.FaultValue in OM
+		return fault.getCode().getValue().getText();
 	}
 
 	/**
@@ -80,8 +97,10 @@
 	 */
 	public void setFaultActor(String faultActor) throws SOAPException {
 		
-		//fault.setFaultActor(faultActor);
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		//faultActor mapped to SOAPFaultNode in OM
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		SOAPFaultNode fNode = soapFactory.createSOAPFaultNode(fault);
+		fNode.setNodeValue(faultActor);
 	}
 
 	/**
@@ -92,8 +111,8 @@
 	 */
 	public String getFaultActor() {
 	
-		//return fault.getFaultActor();
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		// return the text value in SOAPFaultNode of OM
+		return fault.getNode().getNodeValue();
 	}
 
 	/**
@@ -105,8 +124,12 @@
 	 */
 	public void setFaultString(String faultString) throws SOAPException {
 	
-		//fault.setFaultString(faultString);
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		//FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
+		SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
+		text.setText(faultString);
+		fReason.setSOAPText(text);
 	}
 
 	/**
@@ -117,8 +140,8 @@
 	 */
 	public String getFaultString() {
 	
-		//return fault.getFaultString();
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		//return text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+		return fault.getReason().getSOAPText().getText();
 	}
 
 	/**
@@ -128,14 +151,9 @@
 	 * @see javax.xml.soap.SOAPFault#getDetail()
 	 */
 	public Detail getDetail() {
-		// May need to change after w have detail and detail entry implementation
-		//in SoapEnvelope of OM
-		/*QName detailName = new QName("detail");
-		DetailImpl detail = new DetailImpl(detailName, fault);
-		OMNode entry = fault.getDetailInformation();
-		detail.addDetailEntry(entry);
-		return detail;*/
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		
+		SOAPFaultDetail detail =  fault.getDetail();
+		return new DetailImpl(detail);
 	}
 
 	/**
@@ -146,12 +164,10 @@
 	 * @see javax.xml.soap.SOAPFault#addDetail()
 	 */
 	public Detail addDetail() throws SOAPException {
-		// Not sure what detail information to add
-		//May need to change later
-		/*QName detailName = new QName("detail");
-		DetailImpl detail = new DetailImpl(detailName, fault);
-		return detail;*/
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		SOAPFaultDetail detail = soapFactory.createSOAPFaultDetail(fault);
+		return new DetailImpl(detail);
 	}
 
 	/**
@@ -192,9 +208,13 @@
 	 */
 	public void setFaultString(String faultString, Locale locale)
 			throws SOAPException {
-	
-		//fault.setFaultString(faultString);
-		throw new UnsupportedOperationException("No supoprted for M2 release");
+		//FaultString mapped to text elemtnt of SOAPFaultReason->SOAPFaultText in OM
+		// Not using Locale information
+		SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+		SOAPFaultReason fReason = soapFactory.createSOAPFaultReason(fault);
+		SOAPFaultText text = soapFactory.createSOAPFaultText(fReason);
+		text.setText(faultString);
+		fReason.setSOAPText(text);	
 	}
 
 	/**



Mime
View raw message