Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear,
i am trying to call a soap web service from my .net application and getting
"Error 407 Proxy authentication is required."
in soap document model they have written this credential to pass but i have no idea to pass this information while calling the service.
i am calling serive by adding web reference in visual studio 2008.
My code is this
**************************************
//Creating Input objects
MyImportLead[] leads = new MyImportLead[1];
MyImportLead ld = new MyImportLead();
MyInput inpt =new MyInput();
inpt.ListOfMyImportLead = leads;

//Creating Cleint
MyService clt = new MyService();
//Calling Service & getting output
MessageBox.Show("Service is about to launch");
MyOutput outPut = clt.GetOutput(inpt);
MessageBox.Show("Srvice is launched successfully");
****************************************

********************SOAP Envelop****************
XML
- <soapenv:Header>
  <UsernameToken xmlns="http://siebel.com/webservices">SADMIN</UsernameToken>
  <PasswordText xmlns="http://siebel.com/webservices">SADM1N13PGL</PasswordText>
  <SessionType xmlns="http://siebel.com/webservices">None</SessionType>
  </soapenv:Header>

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

Can any one help me how to call this service passing these credentials which our client has given in soap envelope.
thanks
Posted

There is a property called 'Credentials' to be set toa uthenticate the Service.
For you this might be as below :-

C#
clt.Credentials = new
           NetworkCredential("username", "password", "domain name");


Add this line to pass the credential details to service and then call your required method.
Please check with this and let me know if it works for you.

Else you can look for the authenticating .Net Web Service through custom header here.
Authenticate .NET Web Service with Custom SOAP Header[^]

Hope this will be working for you.
 
Share this answer
 
v2
Dear smruti,
i have added this code but still it gives same error.

C#
clt.ClientCredentials.UserName.UserName = "abc";
                clt.ClientCredentials.UserName.Password = "123456";


My app.config contains this code.

***********************************
XML
<system.net>
   <settings>
     <servicePointManager expect100Continue="false" />
   </settings>
 </system.net>

<security mode="None">
                        <transport clientcredentialtype="None" proxycredentialtype="None">
                            realm="" />
                        <message clientcredentialtype="UserName" algorithmsuite="Default" />
</transport></security>

***********************************
Can u check if any thing is possible?
thnx
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900