I am trying to access the Java service using the WCF approach where i added the service reference to the solution. The service is a JAVA service hosted in a WAS server. The request sent is the following information,
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<VisSvcHeaders xmlns="http://dai.e.VisSvc/2010/svc">
<packNGo>false</packNGo>
</VisSvcHeaders>
<wsa:Action>http://vissvc.e.com/2010/svc/getData</wsa:Action>
<wsa:From>
<wsa:Address>Vis</wsa:Address>
</wsa:From>
<wsa:MessageID>urn:uuid:6e1fd026-99cf-4abf-90f0-35f7803aa624</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://vissvc.e.intra.net/VisSvcNative/Service</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-79d3f408-1f2b-45c9-a04c-448a3ceb6afe">
<wsu:Created>2014-02-14T06:13:44Z</wsu:Created>
<wsu:Expires>2014-02-14T06:18:44Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
the front end code snippet is
using (ServiceReference1.ServicePortTypeClient svc = new ServiceReference1.VisServicePortTypeClient())
{
svc.ClientCredentials.UserName.UserName = "username";
svc.ClientCredentials.UserName.Password = "password";
ServiceReference1.ResponseType response = svc.getData();
Console.WriteLine("Connected");
}
the app.config file is
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="WebServiceUrl" value="https://vissvc.e.intra.net/VisSvcNative/Servic"/>
<add key="LogoutUrl" value="http://login.e.corpintra.net/internal/logout"/>
</appSettings>
<system.net>
<defaultProxy >
<proxy autoDetect ="True" />
</defaultProxy>
</system.net>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding>
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" realm="VisService.intra"/>
<message clientCredentialType="UserName" />
</security>
</binding>
<binding name="VisSoapBinding" >
</binding>
</basicHttpBinding>
<client>
<endpoint address="https://vissvc.e.intra.net/VisSvcNative/Servic"
binding="basicHttpBinding" bindingConfiguration="VisSoapBinding"
contract="ServiceReference1.VisServicePortType" name="VisServicePort" />
</client>
</system.diagnostics>
</configuration>
i always get an error "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'basic realm="VisService.intra./VisSvcNative"'". Whatever I change the security mode i am getting the same error. Please help me in this.
I am using .net c# 4.0