cancel
Showing results for 
Search instead for 
Did you mean: 

Exception handling web dynpro and adaptive web service model

Former Member
0 Kudos
63

Hi Experts,

I have a problem with my eexception handling in my web service model.

My Model is an adaptive web service model. It has a session bean where a exception is thrown. But I can't catch this exception in web Dynpro. My code is like the following

Session bean:

public sessionMeth() throws MyException{

...

...

throw new MyException("Reason of Exception");

}

wd Custom controller:

try{

...

request.execute()

}catch(WDWSModelExecuteException e){

IWDMessageManager msgMan = wdComponentAPI.getMessageManager();

msgMan.reportException(a.getCause().getMessage(), true);

}

when I run this I get an unhandled ClassCastException what means my app aborts. When I replace the WDWSModelExecuteException by an normal Exception I can catch the classCastException but I don't get the message I have thrown in my Session Bean.

When I test my WebService in the Web Service Navigator I get the message in the faultString of the repsonse. So I guess the Web Service is ok.

So what is the right approach to handle this?

Any help is appreciated.

Regards Manuel

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear Manuel,

Do not change the exception you are catching from WDWSModelExecuteException to a normal Exception.

Because a class cast exception might be handled here, but then your application may not run as required.

Instead can you post the code where you are getting the class cast exception? (Not just that line but the entire try block).

We may be able to help looking at the code.

Regards,

Mayuresh

Former Member
0 Kudos

Dear Mayuresh,

here is my entire try-catch

try {

//initialising first model

ZV_Model_WS model = new ZV_Model_WS();

wdContext.nodeRequest_FindByVkbur().bind(new Request_FindByVkbur(model));

//initialising second model

ZV_Model_WS model2 = new ZV_Model_WS();

Request_FindVkbursByDate req = new Request_FindVkbursByDate(model2);

FindVkbursByDate vkbd = new FindVkbursByDate(model2);

wdContext.nodeRequest_FindVkbursByDate().bind(req);

//setting parameters and call web service

req.setFindVkbursByDate(vkbd);

Calendar cal = Calendar.getInstance();

cal.add(Calendar.DATE, -1);

vkbd.setEndDate(new Timestamp(cal.getTimeInMillis()));

cal.add(Calendar.DATE, -2);

vkbd.setStartDate(new Timestamp(cal.getTimeInMillis()));

req.execute();

wdContext.nodeResponse3().invalidate();

filterEmptyVkburs();

wdContext.nodeString().sortElements(new VkburComparator());

} catch (WDWSModelExecuteException a) {

IWDMessageManager msgMan = wdComponentAPI.getMessageManager();

msgMan.reportException(a.toString()" -


"a.getMessage()"-------"a.getCause().getMessage()+"----", true);

StackTraceElement[] arr = a.getCause().getStackTrace();

for (int i = 0; i < arr.length; i++) {

msgMan.reportException(arr<i>.toString(), true);

}

}

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi Manuel,

Are you done with following steps? check this once:

(1) In the Package explorer, select your project, right click, cick on "Set Additional Libraries.."

(2) Select security.class and tc/sec/destinations/interface

(3) Click on menu Project > Properties, goto Webdynpro refereces node in the tree and add the following

(a) Interface References: tcsecdestinations~interface

(b) Service References: tcsecdestinations~service

See this link too:

[Here|;

Try debugging and post more error trace.

Regards, Suresh KB

Former Member
0 Kudos

Hi Suresh KB,

I proceed like in the tutorial "Protecting Access to the Web Dynpro Application Using UME Permissions"

There is nothing said about the libraries you mentioned, only about com.sap.security.api.sda and tc/sec/wssec/service.

I added the libraries to my EJB and EAR Project and added the references to my web dynpro. But still the same.

Here is the exception when I want to catch the WDWSModelExecuteException

java.lang.ClassCastException

at com.sap.tc.webdynpro.model.webservice.model.WSGenericModelClass.setRelatedObjectsForName(WSGenericModelClass.java:210)

at com.sap.tc.webdynpro.model.webservice.model.WSGenericModelClass.setRelatedObjectsForName(WSGenericModelClass.java:278)

at com.sap.tc.webdynpro.model.webservice.model.WSGenericModelClassExecutable.fillOutputParametersToMc(WSGenericModelClassExecutable.java:297)

at com.sap.tc.webdynpro.model.webservice.model.WSGenericModelClassExecutable.execute(WSGenericModelClassExecutable.java:97)

at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClassExecutable.execute(WSTypedModelClassExecutable.java:46)

at com.sap.chiron.comps.ZV_Cust.wdDoInit(ZV_Cust.java:146)

at com.sap.chiron.comps.wdp.InternalZV_Cust.wdDoInit(InternalZV_Cust.java:233)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)

at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)

at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:449)

at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:387)

at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:416)

at com.sap.tc.webdynpro.progmodel.context.MappingInfo.getDataNode(MappingInfo.java:83)

at com.sap.tc.webdynpro.progmodel.context.MappingInfo.initMapping(MappingInfo.java:125)

at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:121)

at com.sap.tc.webdynpro.progmodel.context.MappedNodeInfo.doInit(MappedNodeInfo.java:215)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:671)

at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:674)

at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)

at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:709)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:579)

at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:155)

at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.doOpen(WebDynproWindow.java:295)

at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.show(ApplicationWindow.java:183)

at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.open(ApplicationWindow.java:178)

at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:364)

at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:748)

at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:283)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)

at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)

at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)

at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)