WCF Serialization problems with WSDL file created by Java tools

前端 未结 5 1248
甜味超标
甜味超标 2021-02-05 12:15

My team is tasked with getting several in-house developed .NET client applications to connect to some new Java web services. The Java web service is a third party, vendor suppli

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 12:55

    Based on generated code it looks like your Java service expects request like:

    
      ...
      
        
          
            ...
          
        
      
    
    

    The problem is that WCF recognized QueryPBOT_MXWO_OS as wrapper element for request. I'm not sure why it fires exception but probably there is some restriction that wrapper element can't have attributes. I'm suspicious that this is just global error handling shared with version which uses IsWrapped=false where usage of attributes is error.

    You can try to modify your proxy in this way:

    [System.Diagnostics.DebuggerStepThroughAttribute()]        
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]        
    [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]        
    public partial class QueryPBOT_MXWO_OSRequest 
    { 
        [MessageBodyMemberAttribute(Name="QueryPBOT_MXWO_OS", Namespace="http://www.ibm.com/maximo")]
        public QueryPBOT_MXWO_OS QueryPBOT_MXWO_OS { get; set; }
    }  
    
    [XmlRoot(ElementName="QueryPBOT_MXWO_OS", Namespace="http://www.ibm.com/maximo")]
    public class QueryPBOT_MXWO_OS
    {
        [XmlElement(Namespace="http://www.ibm.com/maximo")]    
        public ConsoleApplication7.wsMaximo.PBOT_MXWO_OSQueryType PBOT_MXWO_OSQuery;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]           
        public string baseLanguage;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]         
        public string transLanguage;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]       
        public string messageID;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]       
        public string maximoVersion;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]       
        [System.ComponentModel.DefaultValueAttribute(false)]           
        public bool uniqueResult;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]      
        public string maxItems;           
    
        [XmlAttribute(Namespace="http://www.ibm.com/maximo")]           
        [System.ComponentModel.DefaultValueAttribute("0")]           
        public string rsStart;  
    }     
    

提交回复
热议问题