Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

webservice 401 problem

Hello all

I tried to consume a web service using webdynpro model. When I run the web service I get the following error:

java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException : <b>Invalid Response Code: (401) Unauthorized</b>. The requested URL was:"http://<xxx>/<yyy>/xxxService.svc"

My colleague used this web service successfully by .NET and they told me that I should explicitly set UseDefaultCredentials to true.

They are using the following codes for using the webservise:

string url = " http://<xxx>/<yyy>/xxxService.svc ";

xxxService xxxWcfService = new xxxService (url);

<b>xxxWcfService.UseDefaultCredentials = true;</b>

How and where should I set UseDefaultCredentials to true in my webdynpro project?

I am using the following code for instancing and binding the webservise in wdDoInit() function of component controller:

Request_xxx req = new Request_xxx

wdContext.nodeRequest_xxx().bind(req);

and following codes for execute the web service:

wdContext.currentRequestElement ().modelObject().execute();

Thanks in advance

Former Member
Not what you were looking for? View more on this topic or Ask a question