XmlXxxAttribute() not working at all in Soap Header (Desperate)

E

Emul

I am having trouble getting the XmlXxxAttributes to work in a C# web
service. I have tried everything possible and am at my wit's end. I
see many examples and none work. I can even copy code from MSDN or
microsoft.public.dotnet.framework.webservices and it does not work.
Is this a known problem with VS 7.1.3088 or .NET 1.1.4322? For
instance, XmlAttributeAttribute() or XmlTextAttribute() do absolutely
nothing different than if those lines were missing. The code is below.
If you look at the two attributes toward the bottom (in red) they
should have an impact on the output. Yet whether they are present or
not, the Id and Text come out as elements, not as an attribute and
literal text. (I'm watching the request with a network sniffer just to
be sure.) Thank you so very much in advance.

using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="IPServiceSoapBinding",
Namespace="http://flf0001826d7077/services/IPService")]
public class IPServiceService :
System.Web.Services.Protocols.SoapHttpClientProtocol {

public NetxHeader NetxHeaderValue = new NetxHeader();

public IPServiceService()
{
this.Url = http://flf0001826d7077/services/IPService;
}

[System.Web.Services.Protocols.SoapHeaderAttribute("NetxHeaderValue",
Direction=SoapHeaderDirection.In)]
[System.Web.Services.Protocols.SoapRpcMethoddttribute("",
RequestNamespace="http://webservice.imageportal.products.netxposure.com",
ResponseNamespace="http://flf0001826d7077/services/IPService")]
[return:
System.Xml.Serialization.SoapElementAttribute("getAssetFileReturn",
DataType="base64Binary")]
public System.Byte[] getAssetFile(int in0) {
object[] results = this.Invoke("getAssetFile", new object[]
{in0});
return ((System.Byte[])(results[0]));
}

// other (currently uinused) methods omitted

[System.Xml.Serialization.SoapTypeAttribute("NetxHeader",
"urn:http://www.netxposure.com/exogen")]
public class NetxHeader : SoapHeader
{
[System.Xml.Serialization.XmlAttributeAttribute("Id",
Namespace="http://schemas.xmlsoap.org/WS/2002/07/utility")]
public string Id;
[System.Xml.Serialization.XmlTextAttribute()]
public string[] Text;
}}

main()
{
// ...

IPServiceService NetxService = new IPServiceService();
NetxService.NetxHeaderValue.Id = "Id_Test";
NetxService.NetxHeaderValue.Text = new string [1];
NetxService.NetxHeaderValue.Text[0] = "<test>test</test>";
outBytes = NetxService.getAssetFile(2);
// etc.
}
 

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

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top