Skip to end of metadata
Go to start of metadata

Author: Siva Rama Krushna

When working with Web Service Model in Web Dynpro Java, often we are often getting so many types of exceptions:

I am working in NWCE7.1 EHP1.  

So I thought to provide the details about the exceptions and how I resolved them so that it will be helpful for others  

Exception on execution of web service with WSDL URL
'http://j2eeserver:port/xxxx/Config1?wsdl'
with operation 'RequestNode' in interface
'urn:xxxxx'

One reason for this exception is authorization. We need to provide user credentials for this web service before execution.

If you are using normal Web Service Model then modify execute method

try{
wdContext.current<WSRequestnode>Element().modelObject()._setUser("username");
wdContext.current<WSRequestnode>Element().modelObject()._setPassword("password");
  wdContext.current<WSRequestnode>Element().modelObject().execute();
  wdContext.<WSResponsenode>().invalidate();
}catch(Exception e){
  wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);
}

 If you are using Adaptive Web Service Model then modify execute method

 try{
wdContext.current<WSRequestnode>Element().modelObject().setInvokerProperty(Stub.USERNAME_PROPERTY,  "username");
wdContext.current<WSRequestnode>Element().modelObject().setInvokerProperty(Stub.PASSWORD_PROPERTY, "password");
  wdContext.current<WSRequestnode>Element().modelObject().execute();
  wdContext.<WSResponsenode>().invalidate();
}catch(Exception e){
  wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);
}

You need to import javax.xml.rpc.Stub; in the file.

I am going to add more common exceptions to this wiki later. I request the readers to add  the same if you found any.

(smile)