Changin the Soap Header in the client request

P

pontocom

I all,

I would lile to know if there is a way to add/change the SOAP request
at the client side by adding special information to the header in the
request.

The detail explaination to my problem follows:
I'm building a C# application that will consume a Java-implemented
web-service, from which I know only the WSDL location. In Visual Studio
..Net 2003 I have added to my project a Web-Reference object that allows
me to call the web-services functions. So far so good.
The problem is that I need to add extra-header information to the SOAP
message that will be passed to the web-service. I would like to know if
this is possible and how is this done in C#. I have done successfuly
in other programming languages, such as PHP - so I guess it would be
also possible to do it in C#, right?

Thanks in advance for any help that you could provide me.

Rgds,
 
P

pontocom

Hi,
I already installed installed the WSE and tried to used within the
Visual Studio .Net in my project. I tried following the examples,
nevertheless I haven't got much success.

For instance, it seems I can't access the RequestSoapContext in the
following example. It allways gives me the follwing error 'Object
reference not set to an instance of an object'.

This is the source-code:

using System;

namespace nstest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class nsTest
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//

Console.WriteLine("Testing the N-Services Integration");
nservices.NServicesFrameworkImpl ws = new
nstest.nservices.NServicesFrameworkImpl();
string[] param = {"username", "test", "password", "test"};
string sid = ws.login(param);
Console.WriteLine("Session ID = "+sid);

string version = ws.getVersion(sid);
Console.WriteLine("Version = "+version);

nservices.NServiceEndpointData data = ws.getCapability(sid,
"ADE_DRMAUS");
Console.WriteLine("Capability Token ="+data.capabilityToken);
Console.WriteLine("Capability End Point URL ="+data.endpointURL);

ausNS.opensdrmwsWse nsaus = new nstest.ausNS.opensdrmwsWse();

Microsoft.Web.Services2.SoapContext sc ;

string result_message ="", list_of_pgw="";
try
{
nsaus.Url = data.endpointURL;

sc = nsaus.RequestSoapContext;
Console.WriteLine("SOAP context = " + sc.Envelope.Value);
nsaus.AUSrequestListOfPGW("identification", "algorithm_identifier",
"authentication_type", "signature", ref result_message, ref
list_of_pgw);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}

ws.logout(sid);
}
}
}

Can someone provide help to solve this problem?

Thanks in advance.

Carlos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top