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

Discussion in 'ASP .Net Web Services' started by Emul, Dec 12, 2005.

  1. Emul

    Emul Guest

    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.
    }
     
    Emul, Dec 12, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. K B
    Replies:
    2
    Views:
    530
  2. fx5900
    Replies:
    18
    Views:
    591
    Lie Ryan
    Nov 3, 2008
  3. mlt
    Replies:
    2
    Views:
    852
    Jean-Marc Bourguet
    Jan 31, 2009
  4. poi
    Replies:
    2
    Views:
    120
  5. Peter van der veen

    How to add SOAP header to a SOAP message?

    Peter van der veen, Nov 8, 2006, in forum: ASP .Net Web Services
    Replies:
    6
    Views:
    594
    J. Dudgeon
    Nov 14, 2006
Loading...

Share This Page