Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Mar 20, 2007 at 07:21 PM

    Hi Yoel,

    I think that 'UseDefaultCredentials' in .NET passes to current user data to the Web Service.

    So, your credentials are sent to the server.

    Assuming your colleague is running the Web Service from <b>his</b> computer then <b>his</b> Credentials are sent and authenticated.

    Try to run the .NET appilcation from your computer (under your account).

    Also, ask your colleague for username & password and pass them to the WebService like this:

    xxxWcfService._setUser(user)
    xxxWcfService._setPassword(password)

    Omri

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2007 at 02:38 AM

    Check this too /people/anilkumar.vippagunta2/blog/2006/12/13/secured-webservices-ii

    Regards,Anilkumar

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 21, 2007 at 08:36 AM

    Hi Yoel,

    I think you want to pass the current user credential to ur application. So u can use SAP Logon Ticket for the same. This will create a ticket and send that ticket to the portal, where user will check for the credentials.

    You can find more on SSO at

    herehttp://help.sap.com/saphelp_nw04s/helpdata/en/42/de20c8157b162fe10000000a1553f7/content.htm">here>

    PS : please reward points.

    Abhinav Sharma

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Yeol,

      Look into Note 958107 and use the diatool to check your SPNego setup.

      Maybe the below links could also help you.

      Quick guide for setting up SSo between EP and r/3:

      /people/sap.user72/blog/2004/09/15/quick-guide-for-setting-up-sso-between-ep-and-r3

      Connecting SAP systems to Enterprise portal with SSO.

      /people/dennis.kleymeonov/blog/2005/09/15/connecting-sap-systems-to-enterprise-portal-with-sso

      How to setup R/3 Reference system for User Mapping

      /people/gregor.wolf3/blog/2005/02/11/how-to-setup-r3-reference-system-for-user-mapping

      Hope that helps.