You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Eran Chinthaka (JIRA)" <ji...@apache.org> on 2006/06/03 20:40:30 UTC

[jira] Assigned: (AXIS2-801) UserException -> AxisFault is not put in details to the SOAP-response ++ Davanum advised me to open an issue

     [ http://issues.apache.org/jira/browse/AXIS2-801?page=all ]

Eran Chinthaka reassigned AXIS2-801:
------------------------------------

    Assign To: Eran Chinthaka

> UserException -> AxisFault is not put in details to the SOAP-response ++ Davanum advised me to open an issue
> ------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS2-801
>          URL: http://issues.apache.org/jira/browse/AXIS2-801
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug

>   Components: transports
>     Versions: 1.0
>  Environment: WinXP Prof, JDK 1.4.2_09,Tomcat 5.0.28,
>     Reporter: Bille
>     Assignee: Eran Chinthaka

>
> Service works fine in normal use. I did not use code-generation with WSDL; I created it manually.
> When one parameter for the service is not usable, the service should throw a KIDnotFoundException, which then should be transported with all its details as a SOAPFault in the response to the client.
> ------------------------- my UserException -----------------
> import java.rmi.RemoteException;
> public class KIDnotFoundException extends RemoteException {
> 		public KIDnotFoundException(String message, Throwable ex){
> 			super(message, ex);				      
> 		}
> }
> ------------------------- my service implementation -----------------
> import de.eonis.bd.ws.util.*;
> import java.util.*;
> import java.util.logging.Logger;
> import javax.naming.NamingEnumeration;   // JDK
> import javax.naming.NamingException;
> import javax.naming.directory.*;
> import javax.xml.namespace.QName;   // aus stax-api-1.0.jar
> import org.apache.axiom.om.*;    // aus axiom-api-1.0.jar
> import org.apache.axiom.soap.*;
> import org.apache.axis2.AxisFault;
> import org.apache.axis2.context.*;
> import org.apache.axis2.context.*;
> import org.apache.axis2.wsdl.WSDLConstants;
> public class LDAPQueryService {
> 	private LDAPQuery ldapQuery = null;
> 	private MessageContext inMsgCtx = null;
> 	private MessageContext outMsgCtx = null;
> 	
> 	// Konstanten fuer die Market-Units (MU)
> 	public static final String MU_EAG = "eonag";
> 	public static final String MU_EEA = "eea";
> 	public static final String MU_ERG = "ruhrgas";
> 	public static final String MU_NOR = "eno";
> 	public static final String MU_UK = "eonuk";
> 	public static final String MU_US = "lgee";
> 	public static final String MU_ALL = "global";
> 	// lasse ich init(param in) und setOperationConext drin erhalte ich den Fehler beim Starten des Tomcat
> 	/**
> 	 * - Error in schema generating  Sorry we don't support methods overloading !!!! 
> java.lang.Exception:  Sorry we don't support methods overloading !!!! 
> 	at org.apache.ws.java2wsdl.SchemaGenerator.generateSchema(SchemaGenerator.java:143)
> 	at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:213)
> 	at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:149)
> 	at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:76)
> 	at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:118)
> 	at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:620)
> 	....
> 	 */
> 	/*
> 	public void init(MessageContext msgCtx){
> System.out.println("setting MessageContext: " + msgCtx.toString());		
> 		this.MsgCtx = msgCtx;
> 	}
> /**	
> 	public void init(MessageContext inCtx, MessageContext msgCtx){
> 		System.out.println("setting outgoing MessageContext: " + msgCtx.toString());		
> 				this.msgCtx = msgCtx;
> 			}
> 			
> **/
> 	
> 	/**
> 	 * Das geht
> 	 * aus : http://marc.theaimsgroup.com/?l=axis-user&m=114715486422557&w=2
> 	 */
> 	public void setOperationContext(OperationContext opctx) throws AxisFault {
> System.out.println("setting in- & outgoing MessageContext: " + opctx.toString());		
> 	    this.inMsgCtx =	opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
> 	    this.outMsgCtx = opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
> 	}
> 	
> 	
> 	/**
> 	 * Liefert die Gruppen eines Users im EONGDS, dh fuer alle moeglichen MUs.
> 	 * Die MU des Users kann noch mit uebergeben werden, dann wird auch nur in diesem Container 
> 	 * nach dem User gesucht.
> 	 *  
> 	 * Das EONGDS ist aktuell noch nicht soweit mit dem GDir synchronisiert, dass darueber
> 	 * alle MUs abbildbar waeren.
> 	 * Zur Zeit enthalten GDir und EONGDS nicht die gleichen Gruppen.
> 	 *   
> 	 * @param kid String die eindeutige Konzern-ID des Users.
> 	 * @param mu String Kuerzel fuer die zu durchsuchende MU
> 	 */
> 	public OMElement getEONGDSGroups(OMElement input) throws AxisFault {
> 		// String kid, String marketUnit
> 		String method = "getEONGDSGroups()";
> 		// fully qualified Names
> 		QName kidName = new QName(OMHelper.NAMESPACE, "kid");
> 		String kid = input.getFirstChildWithName(kidName).getText();
> 		QName muName = new QName(OMHelper.NAMESPACE, "mu");
> 		String mu = input.getFirstChildWithName(muName).getText();
> System.out.println("Up to search EONGDS-Groups for KID " + kid + " in MU " + mu);		
> 		
> 		OMElement result;
> 		if (Utils.isValidKID(kid)){
> 			try {			
> System.out.println("up to query directory...");
> 				ldapQuery = new LDAPQuery(false, LDAPQuery.EONGDS, "o=eon,c=de");
> 				// nur Groupmembership-Attribut ist relevant
> 				ldapQuery.setReturnAtts(new String []{"groupmembership"});
> 				String base = "ou=users,ou=" + mu + ",o=eon,c=de";
> 				String filter = "(&(cn=" + kid + ")(objectClass=person))";
> 				NamingEnumeration data = ldapQuery.querySubtree(base, filter);
> 				result = OMHelper.getSOAPFromLDAPResult(data);
> 			} 
> 			catch (NamingException ne){
> 				result = null;
> System.out.println("getEONGDSGroups throws NamingException: " + ne.getMessage());				
> 				SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory(); 
> 				SOAPFault soapFault = soapFactory.createSOAPFault();
> 				SOAPFaultCode faultCode = soapFactory.createSOAPFaultCode(soapFault);
> 				faultCode.declareNamespace("http://someuri.org", "m");
>         SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(faultCode);
>         soapFaultValue.setText("m:FaultException");	
> 				SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(soapFault);
> 				SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText(soapFaultReason);
> 				soapFaultText.setText("the reason of the error");
> 	            
> 				// setting the outgoing MessageContext
> 				outMsgCtx.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, faultCode);
> 	      outMsgCtx.setProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
>             //outMsgCtx.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, faultDetail);
> 			
> 				// throw the AxisFault
> 				 throw new AxisFault("Exception in service-method :: getEONGDSGrous()", ne);
> 			}
> 		}
> 		else {
> 			String text = "invalid KID: KID' " + kid + "' not found in MU '" + mu + "'";
> 			result = handleInvalidData(text, method);
> 		}
> 	
> 		return result;
> 		
> 	}	
> 	// ... some more service-methods ...
> }
> ------------------------- the SOAP response -----------------
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header />
> <soapenv:Body>
> <soapenv:Fault>
> 		  <faultcode>soapenv:Client</faultcode>
> 		  <faultstring>unknown</faultstring>
> 		  <detail>
> 		    <Exception>
> 		       org.apache.axis2.AxisFault
> 		       at org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(RawXMLINOutMessageReceiver.java:102)
> 		       at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
> 		       at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454) 
> 		       at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
> 		       at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136) 
> 		       at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 		       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 
> 		       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) 
> 		       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) 
> 		       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)		       
> 		       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
> 		       ....
> 		    </Exception>
> 		  </detail>
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
> ------------------------- SOAPFault manually built  -----------------
> The following is set to the outgoing messageContext in my serviceimplementation - outMsgCtx.setProperty():
> <soapenv:Fault xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
> <soapenv:Code xmlns:m="http://someuri.org">
> 	<soapenv:Value>m:FaultException</soapenv:Value>
> </soapenv:Code>
> <soapenv:Reason>
> 	<soapenv:Text>the reason of the error</soapenv:Text>
> </soapenv:Reason>
> </soapenv:Fault>
> ------------------------- issues I wonder about -----------------
> 1)  My details aren't reaching the client. The following I found out while debugging the service:
> In class RawXMLINOutMessageReceiver::invokeBusinessLogic() my service-method is called and throws an exception as expected. The exception is of type
> InvocationTargetException and has as a member variable called "target" an object of type AxisFault, with the detailvariable set to the originally thrown exception and the detailmessage set to my individuel errormessage.
> The invokeBusinessLogic() catches this exception and throws an AxisFault using mentioned InvocationTargetException, like this:
> throw new AxisFault(e.getMessage());
> The message member of the InvocationTargetException is null !! so all my user definitions are gone.
> 2) The above depicted response looks like SOAP 1.1 and not 1.2.  I thought Axis2 would work with SOAP 1.2 per default ?
> 3) In addition the faultCode says CLIENT !!!
> 4) I could access the messageContext only by setOperationContext(). I formerly tried the init(param1); if so I get a serious error while starting the server:
>  - Error in schema generating  Sorry we don't support methods overloading !!!! 
> java.lang.Exception:  Sorry we don't support methods overloading !!!! 
> 	at org.apache.ws.java2wsdl.SchemaGenerator.generateSchema(SchemaGenerator.java:143)
> 	at org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:213)
> 	at org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.java:149)
> 	at org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:76)
> 	at org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:118)
> 	at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:620)
> Maybe I'm missing something; unfortunately I could not find any sample for using UserExeptions the right way.
> Could someone clear these issues please - Thanks a lot

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org