Quantcast
Channel: SCN : Unanswered Discussions - Service-Oriented Architecture (SOA) and SAP
Viewing all articles
Browse latest Browse all 360

Calling IIS web service (using NTLM Authentication) from SAP Web AS Java failed

$
0
0

Hi,

 

I am trying to call web service to IIS using Window Authentication (NTLM) from my application (under SAP Web AS Java). However, it is giving me the error as below.

 

 

**********************************************************************

[EXCEPTION]

javax.xml.ws.WebServiceException: Invalid Response code (401). Server [http://xxx/Optimist8_Demo/IntegrationServices/LegalEntityService.svc] returned message [Unauthorized]. Http proxy info:  none

    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:174)

    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEISyncMethod(WSInvocationHandler.java:121)

    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEIMethod(WSInvocationHandler.java:84)

    at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invoke(WSInvocationHandler.java:65)

    at $Proxy624.searchLegalEntitiesByReferenceCode(Unknown Source)

 

**********************************************************************

 

 

 

I have already set the default authenticator (with the user and password). When I run the code locally on PC, everything work fine.

 

 

[Source code]

------------------------------------------------------------------

 

Authenticator.setDefault(new NtlmAuthenticator(user, password));

 

 

 

import java.net.Authenticator;

import java.net.PasswordAuthentication;

 

class NtlmAuthenticator extends Authenticator {

 

  private final String username;

  private final char[] password;

 

  public NtlmAuthenticator(final String username, final String password) {

    super();

    this.username = username;

    this.password = password.toCharArray();

  }

 

  public PasswordAuthentication getPasswordAuthentication() {

      System.out.println("Scheme:" + getRequestingScheme());

    return (new PasswordAuthentication (username, password));

  }

}

 

 

Please help.

 

Thanks.


Viewing all articles
Browse latest Browse all 360

Trending Articles