473,587 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.Net client having problems w/SOAP Header to Axis WS

I am having a problem with formatting a SOAP Header in a .Net client. The
client calls a Java Axis 1.1 based web service. In order to authenticate the
caller, the web service call is intercepted by another web service that
validates a security token in the header.

I have pasted my current SOAP message that my code sends as captured from a
trace function that I added. Below that is a sample SOAP message that the
developer of the web service provided. The second message was generated from
a Java Client that they used for testing.

From what I can see, the biggest differences in the header is that the Java
Client explicitly defines the security token as: xsi:type="xsd:s tring"
Secondarily, the Java client also specifies that the web service does not
need to understand the header
by using the following attribute: soapenv:mustUnd erstand="0"

I am looking for what to add/change in the C# code that invokes the web
service to attempt to match the SOAP message that works. The C# code is also
pasted below.

Any suggestions would be appreciated.

Thanks in advance,

Daniel Thune, MCSE
Systems Engineer
Control Application and Maintenance, Inc.
dt****@cam-co.org


//---------- MS.NET Client SOAP envelope -- this fails because the header
is not processed correctly -----------------------
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">

<soap:Header>
<SecurityCook ie xmlns="http://some.site.com/security">
...
</SecurityCookie>
</soap:Header>
<soap:Body>
<doSomething xmlns="urn:doSo methingNS">
<Code>VU</Code>
<status>Valid </status>
<ID>43195538</ID>
</doSomething>
</soap:Body>
</soap:Envelope>

//---------- Java Client SOAP envelope -- This message will work
-----------------------
<soapenv:Envelo pe xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header >
<ns1:SecurityCo okie
soapenv:mustUnd erstand="0"
xsi:type="xsd:s tring"
xmlns:ns1="http ://some.site.com/security">
...
</ns1:SecurityCoo kie>
</soapenv:Header>
<soapenv:Body >
<doSomething xmlns="urn:doSo methingNS">
<Code>VU</Code>
<status>VALID </status>
<ID>1845041</ID>
</doSomething>
</soapenv:Body>
</soapenv:Envelop e>
// ------------ C# client code
---------------------------------------------------------

using System;
using System.Web;
using System.Xml;
using System.IO;
using System.Diagnost ics;
using System.Xml.Seri alization;
using System.Componen tModel;
using System.Web.Serv ices;
using System.Web.Serv ices.Protocols;
/// <remarks/>
[System.Diagnost ics.DebuggerSte pThroughAttribu te()]
[System.Componen tModel.Designer CategoryAttribu te("code")]
[System.Web.Serv ices.WebService BindingAttribut e(Name="doSomet hingSoapBinding ", Namespace="urn: doSomethingNS")]
public class doSomethingServ ice :
System.Web.Serv ices.Protocols. SoapHttpClientP rotocol
{
/// <summary>
/// securityCookie SoapHeader for authentication
/// </summary>

public securityCookie SecurityCookie;
/// Generated Method to call the web service.
public doSomethingServ ice()
{
this.Url = "http://some.site.com/doSomething";
}

/// Function call for the method to call the web service.
[System.Diagnost ics.DebuggerSte pThroughAttribu te()]
[System.Web.Serv ices.Protocols. SoapDocumentMet hodAttribute("" ,
RequestNamespac e="urn:doSometh ingNS",
ResponseNamespa ce="urn:doSomet hingNS",
Use=System.Web. Services.Descri ption.SoapBindi ngUse.Literal,

ParameterStyle= System.Web.Serv ices.Protocols. SoapParameterSt yle.Wrapped)]
[return: System.Xml.Seri alization.XmlEl ementAttribute( "doSomethingRet urn")]
[System.Web.Serv ices.Protocols. SoapHeader("Sec urityCookie")]
[Trace(Filename= "C:\\TraceLog\\ SoapTraceLog.lo g")]
public int
doSomething([System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]
string Code, [System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )]
string status,
[System.Xml.Seri alization.XmlEl ementAttribute( IsNullable=true )] string ID)
{
object[] results = this.Invoke("do Something", new object[] { Code, status,
ID} );
return ((int)(results[0]));
}

/// generated function to start an asynchronous call to the web service
public System.IAsyncRe sult BegindoSomethin g(string Code, string status,
string ID, System.AsyncCal lback callback, object asyncState)
{
return this.BeginInvok e("doSomething" , new object[] { Code, status, ID},
callback, asyncState);
}

/// generated function to complete an asynchronous call to the web service
public int EnddoSomething( System.IAsyncRe sult asyncResult)
{
object[] results = this.EndInvoke( asyncResult);
return ((int)(results[0]));
}
}

/// <summary>
/// this class added to define the soap header used for security.
/// the cookie will be retreived separately by the calling app
/// and inserted into the SecurityCookieS tring property of this class.
/// </summary>
[System.Xml.Seri alization.XmlRo otAttribute(Ele mentName="Secur ityCookie",
Namespace="http ://some.site.com/security", IsNullable=fals e,
DataType="Strin g")]
public class securityCookie : System.Web.Serv ices.Protocols. SoapHeader
{
//[System.Xml.Seri alization.XmlTe xtAttribute]
public string SecurityCookieS tring;
}

Nov 23 '05 #1
0 4658

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2195
by: Anand Natrajan | last post by:
Hi! I have a VB .NET client that is accessing an rpc/encoded service deployed in Axis 1.2. One of the operations, whoami, returns a string array. The server-side Java signature of this method is String whoami(MyPrincipal principal) My .NET client is unable to access the results of that array. The odd thing is that the very same client was...
6
20237
by: john deviney | last post by:
I have a C#/.Net 1.1 client talking to a Java based web service. I need to insert a soap header on the client side which is expected on the server side. Currently, the Java ws provider, Axis, does not support automatic wsdl generation of custom headers so the wsdl has no information regarding the required header. I've read through a lot of...
0
2634
by: jennifer.perkins | last post by:
I've seen a couple posts by people having similar problems, but the suggested solutions I've tried so far haven't worked. I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the third party web service it's consuming is served by Axis. The request messages my client sends are processed fine by the server, and the SOAP response...
3
2187
by: Dhananjayan | last post by:
Hi, I have a java webservice running on Axis, Iam able to create a java client to invoke the webservice and obtain the result. But iam not able to invoke the service from .Net client.. Here are the steps i followed to create a .net client I created a web reference("NetClient") for a webservice running in Axis thru "Add Web Reference", it...
7
8886
by: Jamie Phillips | last post by:
I'm sure this topic has been "around the block" a few times, but I have not been able to find ANY solutin that fits this particular problem. I have written a Java Axis web service that has a method which returns an object with the following characteristics: public class MMPerson { public string firstName; public string surname; public int...
5
4148
by: vthakur | last post by:
Hello: I have a Axis Web Service that sets the sessionid in the SOAP header for persisting the session. The client is a .Net client that processes the header as an Unknown Header. It sets the session id received from the Service request on subsequent requests to the service. However the Axis Web service does not process the SOAP header...
3
3136
by: GT | last post by:
I have a .NET client that consumes an Axis web service. A change was made recently to the AXIS web service, and ever since then my .NET proxy class has been throwing an InvalidCastException. The proxy class was auto-generated by Visual Studio from WSDL provided by people who provide the Axis service, and I have not modified it (except to add...
0
4503
by: karazy | last post by:
I have been reading all the forums and understand whats going wrong but am not sure how to fix it. I have written a basic doc/literal web service. But when it is called by a .net client it will return NULL. I used proxytrace to check the data that goes back and forward. I can see my request and response. See below at the bottom. I...
2
3560
by: David R | last post by:
I am writing a .NET web services client that is calling an Axis web service. I have two questions. 1. The following code should set the authentication; when I call a method on the web service, the call fails with "bad username/password". // wrWorkReq is the name of the service wrWorkReq.Credentials = new...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8205
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.