Skip to Content
author's profile photo Former Member
Former Member

connection with password authentication problems

Hi experts,

I'm trying to retrieve an XML file from a server with password authentication. I'm using the following code:

url = new URL(myUrl);
URLConnection con = url.openConnection();
Authenticator.setDefault(new SimpleAuthenticator(username,password));
InputStream stream = con.getInputStream();
...

This works if I run the code in NWDS as JAVA APPLICATION.

If I deploy the same code on the web application server wraped with web service I get the error 401 UNAUTHORIZED as server response. The WAS runs on the same machine with the same system user.

Is class Authenticator the right one to use for authentication in the NWCE 7.1 Java EE 5 server?

Thanks in advance!

Best regards,

Kevin

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 14, 2008 at 04:36 PM

    hi kevin,

    what about creating a http destination, configure the authentication inside the nwa (e.g. using saplogonticket, if your ws runs inside the same webas instance) and

    call the getConnection() via destination api

    http://help.sap.com/saphelp_nw2004s/helpdata/en/8b/8e7dac1e661d44bf2a676fd3948cc6/frameset.htm

    hth,

    jens

    Edited by: Jens Neuhaus on Jun 14, 2008 7:24 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.