Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8160255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:10:32+00:00 2026-06-06T18:10:32+00:00

SCENARIO I have to access a web service with a .NET client. The service

  • 0

SCENARIO

I have to access a web service with a .NET client.
The service is an Apache CXF Web Service.
Username and password authentication is required.
I have created the proxy.
I have set up the credential.

MyServiceReference proxy = new MyServiceReference();
proxy.Credentials = new NetworkCredential("username", "password");
string res = proxy.Method1();

When I run the client, the following exception is thrown:

System.Web.Services.Protocols.SoapHeaderException: An error was discovered processing the <wsse:Security> header

The service publisher told me that the credentials are not present in the SOAP headers.
So, I guess that IWebProxy.Credentials is not the correct way to set up the authentication.

QUESTION

So, how can I set up the SOAP header required for the authentication?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:10:34+00:00Added an answer on June 6, 2026 at 6:10 pm

    Eventually I had to invoke the service creating the whole SOAP message and making an HttpWebRequest. In the SOAP message I manually specify the security header:

    <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand='1' xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>
         <wsse:UsernameToken wsu:Id='UsernameToken-1' xmlns:wsu='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'>
            <wsse:Username>Foo</wsse:Username>
            <wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>Bar</wsse:Password>
            <wsse:Nonce EncodingType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'>qM6iT8jkQalTDfg/TwBUmA==</wsse:Nonce>
            <wsu:Created>2012-06-28T15:49:09.497Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
    </soapenv:Header>
    

    And here the service client:

    String Uri = "http://web.service.end.point"
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Uri);
    req.Headers.Add("SOAPAction", "\"http://tempuri.org/Register\"");
    req.ContentType = "text/xml;charset=\"utf-8\"";
    req.Accept = "text/xml";
    req.Method = "POST";
    
    String SoapMessage = "MySoapMessage, including envelope, header and body"
    using (Stream stm = req.GetRequestStream())
    {
        using (StreamWriter stmw = new StreamWriter(stm))
        {
            stmw.Write(SoapMessage);
        }
    }
    
    
    try
    {
        WebResponse response = req.GetResponse();
        StreamReader sr = new StreamReader(response.GetResponseStream());
        log.InfoFormat("SoapResponse: {0}", sr.ReadToEnd());
    }
    catch(Exception ex)
    {
        log.Error(Ex.ToString());
    }
    

    Interesting resources about Web Service Security (WSS):

    • Wikipedia
    • OASIS
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a scenario where some .NET code is attempting to access the current
I have the following scenario. The client code only has access to FooHandler, not
i have an asp.net web application and deployed on web server. in a scenario
Scenario: A publically available Web Service that I have full control over. But I
Imagine this scenario: you have a WCF web service that gets hit up to
I have a scenario where users of my ASP.NET web application submit testimonials consisting
I have an ASP.Net MVC site, which connects to a web service. The site's
We have a system (third party) where we access a web service to read
I have a scenario where a user will have access to a one-time-url. When
Scenario: I have a console application that needs to access a network share with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.