954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Soap Header Problem

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

aju982007
Newbie Poster
2 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

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.

mcriscolo
Posting Whiz in Training
218 posts since Apr 2008
Reputation Points: 57
Solved Threads: 64
 
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 /////////////////////
           


        }

    
    }
}
aju982007
Newbie Poster
2 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

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

nrrbalaji
Newbie Poster
2 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: