How to pass networkcredentials in java client code for .Net web service?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Techmighty
    New Member
    • Sep 2008
    • 1

    How to pass networkcredentials in java client code for .Net web service?

    Hello All,

    I want to invoke the .Net Based webservice from a java client code using axis api.

    As we pass the credentials in .Net
    "uin.Credential s = new NetworkCredenti al("administrat or", "Tech1234", "WORKGROUP" );"

    I have to pass them in java code.

    I have tried with
    " System.setPrope rty("http.proxy User","Administ rator");
    System.setPrope rty("http.proxy Password","Tech 1234");
    "
    But still I am getting 401 Unauthorized response.

    How I can pass these credentials through a java code?

    Thanks And Regards,
    Amarja
  • abhishekbrave
    New Member
    • Dec 2007
    • 79

    #2
    try this
    [code=java]
    HttpClient client = new HttpClient ();
    NTCredentials creds = new NTCredentials (user, password, machine, domain);
    client.getState ().setProxyCred entials (AuthScope.ANY, creds);
    HostConfigurati on config = new HostConfigurati on ();
    config.setProxy (proxyHost, proxyPort);
    PostMethod post = new PostMethod (endPoint);
    [/code]
    it is not working in my case:( may be helpful to you...
    Last edited by Nepomuk; Sep 24 '08, 03:21 PM. Reason: Added [CODE] tags

    Comment

    • numberwhun
      Recognized Expert Moderator Specialist
      • May 2007
      • 3467

      #3
      I believe this to actually be a Java question and not an Apache question. For that reason, I am moving this to the Java forum.

      Regards,

      Jeff

      Comment

      • Nepomuk
        Recognized Expert Specialist
        • Aug 2007
        • 3111

        #4
        Hi Techmighty!
        Is there a good reason, why you have different capitalisation?
        Originally posted by Techmighty
        "uin.Credential s = new NetworkCredenti al("administrat or", "Tech1234", "WORKGROUP" );"
        ...
        " System.setPrope rty("http.proxy User","Administ rator");
        System.setPrope rty("http.proxy Password","Tech 1234");
        "
        ("administrator " vs. "Administrator" ) That could be your Problem.

        Greetings,
        Nepomuk

        Comment

        Working...