473,416 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Passing Web Services Credentials (Username and Password of Web Services) using WCF

Hi,



Can any one please tell how to pass Web Services Credentials(Web Services Username and Password) using WCF.



Inorder to Communicate with Web Services i have to provide username and password of the web services.



And There is no SoapAction in wsdl, and it has only one method.



The Request xml which i am passing is



<?xml version="1.0" encoding="UTF-8"?>
<ISO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PassportPlus002.xsd ">
<SignonRq>
<SignonPswd>
<CustId>
<SPName>com.iso</SPName>
<CustPermId>xxx</CustPermId>
</CustId>
<CustPswd>
<EncryptionTypeCd>NONE</EncryptionTypeCd>
<Pswd>yyy</Pswd>
</CustPswd>
</SignonPswd>
<ClientDt>2005-02-23T10:18:25</ClientDt>
<CustLangPref>en-US</CustLangPref>
<ClientApp>
<Org> </Org>
<Name></Name>
<Version></Version>
</ClientApp>
</SignonRq>
<PassportSvcRq>
<SPName>com.iso</SPName>
<Quoteback>(Client Supplied Data)</Quoteback>
<PassportInqRq/>
</PassportsvcRq>
</ISO>



Here are the code and config file detais given.



Code:



XmlDocument requestXml = new XmlDocument();

requestXml.Load("c:\\NewRequest.XML");

string webserviceUrl = "https://xxxpassports.com/WebListener/services/SOAPListener";

string webserviceAction = "";


CustomBinding customBinding = new CustomBinding();

customBinding = new CustomBinding("HttpsSoap11Binding");

ChannelFactory<IRequestChannel> factory = new ChannelFactory<IRequestChannel>(customBinding, webserviceUrl);

IRequestChannel channel = factory.CreateChannel();

Message requestMessage = Message.CreateMessage(customBinding.MessageVersion , webserviceAction, new XmlNodeReader(requestXml));

Message responseMessage = channel.Request(requestMessage);

Response.Write(responseMessage.ToString());



Config File Details:



<system.serviceModel>

<bindings>

<customBinding>

<binding name="HttpsSoap11Binding">

<textMessageEncoding messageVersion="Soap11"/>

<httpsTransport useDefaultWebProxy="true" transferMode="Buffered"/>

</binding>

</customBinding>

</bindings>

</system.serviceModel>





And also we are using https in Web Service URL.


When i try running the above code, it gives the following error,



An exception of type 'System.ServiceModel.Security.MessageSecurityExcep tion' occurred in mscorlib.dll but was not handled in user code

Additional information: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="iso.com"'.
Apr 4 '08 #1
0 1941

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mdh | last post by:
I have an application written for mod_perl and Apache that needs to be able to send some XML queries to a WebMethods server for access to corporate systems. I have been attempting to use LWP to...
3
by: Brent | last post by:
Hi, Recently, we installed Sharepoint Services on our test server (Server 2003) to try it out. I made a new web for my regular aspx pages. My problem is that now whenever I try to access my old...
4
by: Grind Boy | last post by:
Hi, I'm writing this off the top of my head as I don't have the exact information to hand. We are attempting to set up a secure internet site using ASP.NET on IIS5. We are having some...
7
by: Wade Wegner | last post by:
Hello, I have been desperately trying to programmatically authenticate a windows user, create their credentials, and then redirect them to a different server while passing the credentials at the...
4
by: Dan Higman | last post by:
I'm sure this is easy and I'll be embarrassed when I see the answer, but I just can't figure this one out. Using .Net/ASP 1.1 on a server using integrated authentication-- I have a web page...
3
by: GRB | last post by:
My webiste has integrated windows authentication. I need to pass a clients credentials (username, password) to my site without the login pop up. I send the client to an anonymous page, get an...
6
by: David++ | last post by:
Hi folks, So I have implemented a Web service which provides several Web Methods. Before the client can use the WebMethods they must first be authenticated and authorized i.e. they login, obtain...
3
by: Dmitry | last post by:
I am trying to figure out how to pass set of credentials to System.IO Challenge is: App is running under one set of credentials, but via GUI user have a chance to enter another set. I would like...
0
by: sanbm79 | last post by:
Hi All, I am facing a problem in posting Web request with username and password credentials. I am working on migrating Java client application to .Net which will send request to Java servlet. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.