i have a ibm java webservice with soap protection username and password needed to give for accesing this webservice .. i need to call this webservice from C# client ... when i call this webservice .its showing this error


com.ibm.wsspi.wssecurity.SoapSecurityException: WSEC5048E: One of "SOAP Header" elements required.


please help me... give me the C# code for accessing this javawebservice

The .NET Framework, in conjunction with Visual Studio has a facility to generate a proxy class for a WSDL-based SOAP web service. First, can you reference the WSDL of the service? You should be able to get to it with HTTP syntax like: http://www.somesite.com/someservice?WSDL That will differ from site to site, but if you can get to the WSDL, the tool in Visual Studio will be able to generate the proxy class.

Then, in Visual Studio, in your Solution Explorer, you should see an item labled "References". Right-click and a menu will appear, with an option for "Add Web Reference...". It is in here that you will use the URL to the WSDL of the site in question. Once the proxy class is generated, you should see methods in the class that correspond to the functions of the web service.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using TestingWebservice.CustomerDetails;

namespace TestingWebservice
{
    public partial class LookUpForm : Form
    {
        public LookUpForm()
        {
            InitializeComponent();
        

      

        private void button4_Click(object sender, EventArgs e)
        {

            CustomerService r = new CustomerService();

            Customerdetails t = r.getcustomerdetails("12345");   ----- error occuring here showing one of soap header element required how can i pass soap header element to this customer service . i don't have method for adding soap header /////////////////////
           


        }

    
    }
}

I saw your code. I too have the same problem.

But in .Net soap web services, the producer will defined the headers so consumer can set the value for that headers. Up to my knowledge until unless producer defined the soap headers the consumer cant set the value for that soap headers. The following is the C# code sample for producing and consuming soap web services with headers

http://www.wrox.com/WileyCDA/Section/Using-SOAP-Headers-with-ASP-NET-2-0-Web-Services-Page-2.id-291723.html

Thanks,
Balaji

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.