Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Java soap message not getting deserialized in c# APP + SGEN

$
0
0

One of the Java webservices that I consume within my c# application has a returned type "marketCalendar" defined like following in the wsdl. WSDL's Target name space is http://www.xyz.com

<?xml version="1.0"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.xyz.com/wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xyz.com/api" name="cscreen" targetNamespace="http://www.xyz.com/wsdl"><wsdl:types><xsd:schema targetNamespace="http://www.xyz.com/api" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element name="getMarketCalendar"><xsd:complexType></xsd:complexType></xsd:element><xsd:element name="marketCalendar"><xsd:complexType><xsd:sequence><xsd:element name="country" minOccurs="1" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="exchange" minOccurs="1" maxOccurs="unbounded"><xsd:complexType><xsd:sequence><xsd:element name="calendarDay" minOccurs="1" maxOccurs="unbounded"><xsd:complexType><xsd:attribute name="type" type="calendarDayType" use="required"/><xsd:attribute name="date" type="xsd:string" use="required"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="name" type="xsd:string" use="required"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="name" type="xsd:string" use="required"/></xsd:complexType></xsd:element></xsd:sequence><xsd:attribute name="sessionID" type="xsd:string" use="required"/></xsd:complexType></xsd:element></xsd:schema></wsdl:types>	<!--Get information on calendars --><wsdl:message name="getMarketCalendarRsp"><wsdl:part name="marketCalendar" element="marketCalendar"/></wsdl:message><wsdl:message name="getMarketCalendarReq"><wsdl:part name="getMarketCalendar" element="getMarketCalendar"/></wsdl:message><wsdl:portType name="Cscreen_PortType"><wsdl:operation name="getMarketCalendarRequest"><wsdl:input message="tns:getMarketCalendarReq"/><wsdl:output message="tns:getMarketCalendarRsp"/></wsdl:operation></wsdl:portType><wsdl:binding name="Cscreen_Binding" type="tns:Cscreen_PortType"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>		<wsdl:operation name="getMarketCalendarRequest"><soap:operation soapAction=""/><wsdl:input><soap:body use="literal"/></wsdl:input><wsdl:output><soap:body use="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="Cscreen_Service"><wsdl:documentation>This WSDL file describes how to access the Cscreen OTC Equity Derivatives Price Discovery Platform through the SOAP API. This software was developed by Cinnober Financial Technology.</wsdl:documentation><wsdl:port name="Cscreen_Port" binding="tns:Cscreen_Binding"><soap:address location="https://hostname/api/v16"/><!-- hostname can for example be stage.xyz.com and www.xyz.com --></wsdl:port></wsdl:service></wsdl:definitions>

And corresponding C# proxy has following interpretation,

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.xyz.com")]
public partial class marketCalendar {

    private marketCalendarCountry[] countryField;

    private string sessionIDField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("country", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public marketCalendarCountry[] country {
        get {
            return this.countryField;
        }
        set {
            this.countryField = value;
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string sessionID {
        get {
            return this.sessionIDField;
        }
        set {
            this.sessionIDField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.xyz.com")]
public partial class marketCalendarCountry {

    private marketCalendarCountryExchange[] exchangeField;

    private string nameField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("exchange", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public marketCalendarCountryExchange[] exchange {
        get {
            return this.exchangeField;
        }
        set {
            this.exchangeField = value;
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string name {
        get {
            return this.nameField;
        }
        set {
            this.nameField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.xyz.com")]
public partial class marketCalendarCountryExchange {

    private marketCalendarCountryExchangeCalendarDay[] calendarDayField;

    private string nameField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute("calendarDay", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
    public marketCalendarCountryExchangeCalendarDay[] calendarDay {
        get {
            return this.calendarDayField;
        }
        set {
            this.calendarDayField = value;
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string name {
        get {
            return this.nameField;
        }
        set {
            this.nameField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.xyz.com")]
public partial class marketCalendarCountryExchangeCalendarDay {

    private calendarDayType typeField;

    private string dateField;

    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public calendarDayType type {
        get {
            return this.typeField;
        }
        set {
            this.typeField = value;
        }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAttributeAttribute()]
    public string date {
        get {
            return this.dateField;
        }
        set {
            this.dateField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.xyz.com")]
public enum calendarDayType {

    /// <remarks/>
    HOLIDAY,

    /// <remarks/>
    EXPIRATION,
}

Problem# my c# application invokes a method GetMarketCalendar on the java webservice and does see the XML response coming in but can't deserialize it back into a marketCalendar response. So I started digging by using XGen generated class.

I noticed that for types countryexchangecalendarDay - c#'s default deserializer is comparing the namespace coming in the soap response to an empty string i.e.

if (((object) Reader.LocalName == (object)id84_country && (object) Reader.NamespaceURI == (object)id2_Item)) {

where incoming is Reader.NamespaceURI = "http://www.xyz.com" and id2_Item = Reader.NameTable.Add(@""); i.e. empty.

Is this a C# XMLSerializer bug or there is something wrong with the marketCalendar definition in wsdl?



Regards, Vinay




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>