axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farzad Panahi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-3239) Custom fault handling issue in code-first approach
Date Fri, 04 Jul 2008 18:13:31 GMT

    [ https://issues.apache.org/jira/browse/AXIS2-3239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610635#action_12610635
] 

Farzad Panahi commented on AXIS2-3239:
--------------------------------------

It seems to me that this issue is related to AXIS2-3443.

Because when the soapenv fault detail section is empty, then no detail will be created for
the AxisFault on the client side. 

Also on the generated stub on the client side we have: 

         }catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
                if (faultExceptionNameMap.containsKey(faultElt.getQName())){
                    //make the fault by reflection
                   
                   //throw generated custom exception


                }else{
                    throw f;
                }
            }else{
                throw f;
            }

Which simply says that if there is no detail for AxisFault just throw the AxisFault.

Any updates, fixes or thoughts on this issue ?

Tnx

> Custom fault handling issue in code-first approach
> --------------------------------------------------
>
>                 Key: AXIS2-3239
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3239
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: winxp, jdk15, 
>            Reporter: Charitha Kankanamge
>            Assignee: Deepal Jayasinghe
>            Priority: Critical
>         Attachments: AxisFaultservice.aar, Faultclient.java, userTest-test-client.jar
>
>
> This issue has been identified and discussed by Jay Zawar in the following mailing threads.

> http://marc.info/?l=axis-user&m=119132155713767&w=2
> http://marc.info/?l=axis-user&m=119131613622185&w=2
> There seems to be an issue with custom fault handling when code-first approach is used.
Axis2 Faulthandling sample works fine since it is used contract-first method.  
> Steps to reproduce:
> ===============
> 1. Write the service implementation class which returns a customexception
> public class AService {
> public long Add(int a, int b, int exceptionThrown) throws CustomException {
> 		
> 		if (exceptionThrown != 0) {
> 			System.out.println("CustomException to b instantiated");	
> 			
> 			CustomException e = new CustomException();
> 			e.setCustomMsg("bar");
> 			throw e;
> 		}
> 		
> 		
> 		return a+b;}
> }
> 2. Write CustomeException class 
> public class CustomException extends java.lang.Exception implements Serializable{
> 	private static final long serialVersionUID = 1542353156105984960L;
> 	private String customMsg = "This is my error";
> 	public String getCustomMsg() {return customMsg;}
> 	public void setCustomMsg(String customMsg) {this.customMsg= "custom : " +customMsg;}
> }
> 3. Bundle the service archive correctly and deploy it.
> 4. Generate ADB client code
> 5. Write a client 
> public class Faultclient {
> 	
> 	public static void main(String[] args) {
> 		try {
> 			UserTestStub stub;
> 			stub = new UserTestStub("http://localhost:9764/services/userTest");
> 			UserTestStub.Add req = new UserTestStub.Add();
> 			req.setA(4);
> 			req.setB(5);
> 			req.setExceptionThrown(2);
> 			UserTestStub.AddResponse res;
> 			res = stub.Add(req);
> 			System.out.println(res.get_return());
> 		} catch (AxisFault e1) {
> 			e1.printStackTrace();
> 			e1.getCause();
> 		} catch (CustomExceptionException0 e) {
> 			System.out.println("Error!!!!");
> 		} catch (RemoteException e) {
> 			e.printStackTrace();
> 		}
> 	}
> 6. I'm always getting 'org.apache.axis2.AxisFault: Exception occurred while trying to
invoke service method Add' error at the client side, though I expected customexception specified
in the service.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
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