axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bille (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-801) UserException -> AxisFault is not put in details to the SOAP-response ++ Davanum advised me to open an issue
Date Sat, 14 Oct 2006 02:47:56 GMT
    [ http://issues.apache.org/jira/browse/AXIS2-801?page=comments#action_12442137 ] 
            
Bille commented on AXIS2-801:
-----------------------------


   [[ Old comment, sent by email on Thu, 08 Jun 2006 12:13:41 +0200 ]]

Hi Eran,

Three things is left concerning the SOAP Version.
1) I read that Axis2 uses SOAP 1.2 per default, so I wodered why my
SOAP-response is SOAP 1.1. I used SOAP12Factory to build the SOAPFault, so why
this ?
2) How can I set that the server is the errorcause, till the response says
'Client' ?
3) If I don't use stubs and skeletons from wsdl2java generation, do I have to
create the SOAPFaults manually like I did? Or is there a nicer way to do that.
If manually, so then Userexptions-classes do not make really sense, do they?

So far, so good. If you could shed some lighton this, ot would be really
nice.
The issue could be closed. Thanks a lot for your help

Bille



in details to the SOAP-response ++ Davanum advised me to open an issue


http://issues.apache.org/jira/browse/AXIS2-801?page=comments#action_12415248 ]
Davanum advised me to open an issue
-----------------------------------------------------------------------------
-------------------------------
I created it manually.
a KIDnotFoundException, which then should be transported with all its details
as a SOAPFault in the response to the client.
Fehler beim Starten des Tomcat
overloading !!!!
org.apache.ws.java2wsdl.SchemaGenerator.generateSchema(SchemaGenerator.java:1
43)
org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:213)
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.jav
a:149)
org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(A
rchiveReader.java:76)
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup
(ArchiveReader.java:118)
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:6
20)
msgCtx.toString());
{
opctx.toString());
opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
opctx.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
MUs.
in diesem Container
dass darueber
+ mu);
ne.getMessage());
soapFactory.createSOAPFaultValue(faultCode);
soapFactory.createSOAPFaultReason(soapFault);
soapFactory.createSOAPFaultText(soapFaultReason);
faultCode);
soapFaultReason);
//outMsgCtx.setProperty(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
faultDetail);
getEONGDSGrous()", ne);
"'";
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(Raw
XMLINOutMessageReceiver.java:102)
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractI
nOutSyncMessageReceiver.java:37)
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTT
PTransportUtils.java:284)
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationF
ilterChain.java:237)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCha
in.java:157)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.jav
a:214)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext
.java:104)
serviceimplementation - outMsgCtx.setProperty():
debugging the service:
service-method is called and throws an exception as expected. The exception is
of type
object of type AxisFault, with the detailvariable set to the originally thrown
exception and the detailmessage set to my individuel errormessage.
using mentioned InvocationTargetException, like this:
user definitions are gone.
Axis2 would work with SOAP 1.2 per default ?
formerly tried the init(param1); if so I get a serious error while starting
the server:
!!!!
org.apache.ws.java2wsdl.SchemaGenerator.generateSchema(SchemaGenerator.java:1
43)
org.apache.axis2.deployment.util.Utils.fillAxisService(Utils.java:213)
org.apache.axis2.deployment.ServiceBuilder.populateService(ServiceBuilder.jav
a:149)
org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(A
rchiveReader.java:76)
org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup
(ArchiveReader.java:118)
org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:6
20)
using UserExeptions the right way.


______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


> 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)
>          Issue Type: Bug
>          Components: transports
>    Affects Versions: 1.0
>         Environment: WinXP Prof, JDK 1.4.2_09,Tomcat 5.0.28,
>            Reporter: Bille
>         Assigned To: 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


Mime
View raw message