cancel
Showing results for 
Search instead for 
Did you mean: 

unable to access web service from webdynpro.

Former Member
0 Kudos

Hi All:

I have created a stateless session bean and from this I am calling a function module.

I converted this into a webservice. when I run the webservice from SAP NetWeaver Developer Studio

(http://localhost:50000/custwebservice/Config) and click on test button It promots me to enter userId and password.

Q1> Every time I run webservice I have to enter "Administartor" and "sap" as userId and password.How do I provide userId and password so that the webservice doesn't prompt me to enter userid and password.

From WebDynpro I am consuming the webservice.

This is what I am doing in my WebDynpro.

public void onActionEnter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionEnter(ServerEvent)

try{

wdContext.currentSoldToElement().modelObject().setCustNo("0000101925");

wdContext.currentSoldToElement().modelObject().execute();

wdContext.nodeResponse().invalidate();

wdThis.wdGetSampleComponentController().wdGetContext().currentContextElement().setDetails(wdContext.currentSoldToElement().modelObject().getResponse().getResult());

}catch(Exception ex){

com.sap.tc.webdynpro.progmodel.controller.MessageManager msgMgr = (com.sap.tc.webdynpro.progmodel.controller.MessageManager) wdThis.wdGetAPI().getComponent().getMessageManager();

msgMgr.setReportSingle(true);

wdThis.wdGetSampleComponentController().wdGetContext().currentContextElement().setDetails(ex.getLocalizedMessage());

}

}

When I run this WebDynpro Application and click on Enter button I get

"Service call exception;nested exception is;java.lang.Exception Transport Error! Response code (401) unauthorized"

Any suggestions

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

martijndeboer
Advisor
Advisor
0 Kudos

Hi,

I assume you configured some authentication in the security section of the ws-deployment descriptor.

So there are two possible answers:

1) Configure authentication from your web service client. This can either be accomplished by coding a username/password in your WebDypro application (call setUsername, setPassword on the model) or using an HTTP Destination. See

2) Configure the web service without authentication in the ws deployment descriptor.

Best Regards,

Martijn de Boer