Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Can't use SoapHeaderAttribute and SoapExtensionAttribute together

Reply
Thread Tools

Can't use SoapHeaderAttribute and SoapExtensionAttribute together

 
 
Mike
Guest
Posts: n/a
 
      11-15-2005
I need to use a SOAP Extension within a .NET CF application. The
application invokes web services, and there is currently a
SoapHeaderAttribute specified for authentication information.

Within the web service proxy, there is a class defined like this:

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://myurl")]

[System.Xml.Serialization.XmlRootAttribute(Namespac e="http://myurl",
IsNullable=false)]
public class MyAuthenticationHeader :
System.Web.Services.Protocols.SoapHeader {

/// <remarks/>
public string Username;

/// <remarks/>
public string Password;
}

The web method declaration within the web service proxy is currently:

[System.Web.Services.Protocols.SoapHeaderAttribute( "MyAuthenticationHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://myurl/MyWebMethod",
RequestNamespace="http://myurl", ResponseNamespace="http://myurl",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
public string[] MyWebMethod(string[] arg1, string[] arg2) {
object[] results = this.Invoke("MyWebMethod", new object[]
{
arg1,
arg2});
return ((string[])(results[0]));
}


I want to add a SOAP Extension Attribute to the method declaration like
this:

[System.Web.Services.Protocols.SoapHeaderAttribute( "MyAuthenticationHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://myurl/MyWebMethod",
RequestNamespace="http://myurl", ResponseNamespace="http://myurl",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
[MySoapExtension]
public string[] MyWebMethod(string[] arg1, string[] arg2) {
object[] results = this.Invoke("MyWebMethod", new object[]
{
arg1,
arg2});
return ((string[])(results[0]));
}

Everything works if I use EITHER the SoapHeaderAttribute OR the
SoapExtensionAttribute. However, if I try to use both, I get an
ArgumentNullException immediately after the GetInitializer() method in
my SOAP Extension class fires. There is no other information
available.

Worst case, I can put the authentication information into the SOAP
Header by means of my SOAP Extension, and just do without the
SoapHeaderAttribute. However, this is code someone else has written
and is maintaining, so I want to change it as little as possible.

Thanks in advance for any help.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't you use varargs and keyword arguments together? Sandra-24 Python 1 12-22-2006 01:03 AM
Can you use multiple authentications (Windows and None) together =?Utf-8?B?TW9yaQ==?= ASP .Net 3 01-18-2006 10:34 PM
Can I use SoapExtensionAttribute at the client proxy side? A.M-SG ASP .Net Web Services 1 09-14-2005 03:18 AM
SoapHeaderAttribute Required is obsolete. How to verify the header? Tim Tyannikov ASP .Net Web Services 1 08-18-2004 10:50 AM
SoapHeaderAttribute Required is obsolete. How to verify the header? Tim Tyannikov ASP .Net Web Services 0 08-17-2004 09:37 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57