Use XML attributes to specify another XML name or namespace...

Discussion in 'ASP .Net Web Services' started by Web Developer, Feb 17, 2005.

  1. I've written a ServiceDescriptionFormatExtension that is used by my custom
    SoapExtensionReflector so that I can add an authorization header to each web
    service in my environment. In order for the update to work, I need the
    following header added to the input and output sections of each service
    operation of the wsdl:

    <soap:header message="s0:AddRequesterIdentityHeader"
    part="RequesterIdentityHeader" use="literal" />

    The error below occurs when I use the following attribute on my custom
    ServiceDescriptionFormatExtension:
    <XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/",
    GetType(OutputBinding), GetType(InputBinding))> _

    Here's the error:
    System.InvalidOperationException:
    There was an error reflecting type
    'System.Web.Services.Description.ServiceDescription'. --->
    System.InvalidOperationException: There was an error reflecting property
    'Bindings'. --->
    System.InvalidOperationException: There was an error reflecting type
    'System.Web.Services.Description.Binding'. --->
    System.InvalidOperationException: There was an error reflecting property
    'Operations'. --->
    System.InvalidOperationException: There was an error reflecting type
    'System.Web.Services.Description.OperationBinding'. --->
    System.InvalidOperationException: There was an error reflecting property
    'Input'. --->
    System.InvalidOperationException: There was an error reflecting type
    'System.Web.Services.Description.InputBinding'. --->
    System.InvalidOperationException: There was an error reflecting property
    'Extensions'. --->
    System.InvalidOperationException:
    The XML element named 'header' from namespace
    'http://schemas.xmlsoap.org/wsdl/soap/' references distinct types
    System.Web.Services.Description.SoapHeaderBinding and (my custom
    ServiceDescriptionFormatExtension class).
    Use XML attributes to specify another XML name or namespace for the element
    or types.
    at
    System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(ElementAccessor accessor)
    at
    System.Xml.Serialization.XmlReflectionImporter.ReconcileLocalAccessor(ElementAccessor accessor, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
    accessor, FieldModel model, XmlAttributes a, String ns, Type
    choiceIdentifierType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
    parent, FieldModel model, XmlAttributes a, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
    accessor, FieldModel model, XmlAttributes a, String ns, Type
    choiceIdentifierType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
    parent, FieldModel model, XmlAttributes a, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
    accessor, FieldModel model, XmlAttributes a, String ns, Type
    choiceIdentifierType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
    parent, FieldModel model, XmlAttributes a, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
    accessor, FieldModel model, XmlAttributes a, String ns, Type
    choiceIdentifierType)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
    parent, FieldModel model, XmlAttributes a, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    --- End of inner exception stack trace ---
    at
    System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
    model, String ns, ImportContext context, String dataType, Boolean repeats)
    at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel
    model, XmlRootAttribute root, String defaultNamespace)
    at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type
    type, XmlRootAttribute root, String defaultNamespace)
    at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type
    type, XmlRootAttribute root)
    at System.Xml.Serialization.XmlSerializer..ctor(Type type,
    XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root,
    String defaultNamespace)
    at System.Xml.Serialization.XmlSerializer..ctor(Type type,
    XmlAttributeOverrides overrides)
    at System.Web.Services.Description.ServiceDescription.get_Serializer()
    at System.Web.Services.Protocols.DiscoveryServerType..ctor(Type type,
    String uri)
    at System.Web.Services.Protocols.DiscoveryServerProtocol.Initialize()
    at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
    HttpContext context, HttpRequest request, HttpResponse response)
    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
    HttpContext context, HttpRequest request, HttpResponse response, Boolean&
    abortProcessing)


    Is there another way to generate the soap:header entries in the wsdl? There
    seems to be a namespace conflict when I try to add nodes from the
    http://schemas.xmlsoap.org/wsdl/soap/ schema.

    Thank you.
    Web Developer, Feb 17, 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. Replies:
    0
    Views:
    5,127
  2. Jason Heyes
    Replies:
    1
    Views:
    448
    Woebegone
    Nov 19, 2004
  3. Replies:
    1
    Views:
    509
    George Bina
    Jul 20, 2006
  4. K Viltersten

    How to specify attributes from code behind

    K Viltersten, Aug 7, 2009, in forum: ASP .Net
    Replies:
    5
    Views:
    330
    Gregory A. Beamer
    Aug 7, 2009
  5. Fred
    Replies:
    0
    Views:
    69
Loading...

Share This Page