2012-05-11 2 views
1

WCF .Net 4.0을 사용하여 Java로 작성된 웹 서비스를 호출합니다. WSDL의 일부에는 SPML 2.0에 대한 참조가 있으며 어떤 일이 발생했는지 설명하기 위해 몇 가지 코드를 첨부했습니다.WCF 4.0 Java 웹 서비스에서 SOAP을 deserialize 할 수 없습니다.

일부 XSD에 대한 WSDL 참조, 내가 사용하고있는 조각 그래서 WCF 서비스 참조 생성 된 프록시 클래스가

[System.Xml.Serialization.XmlIncludeAttribute(typeof(SchemaType1))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ObjectClassDefinitionType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ObjectClassDefinitionReferencesType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ObjectClassDefinitionReferenceType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AttributeDefinitionReferencesType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AttributeDefinitionReferenceType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AttributeDefinitionType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CapabilityType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CapabilitiesListType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SchemaEntityRefType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SchemaType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(TargetType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PSOType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ActiveResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ValidatePasswordResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResetPasswordResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BatchResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ListTargetsResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LookupResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ModifyResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AddResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AuthenticateUserResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SuggestUserIDResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResultsIteratorType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchQueryType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(NamespacePrefixMappingType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(QueryClauseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(IsActiveType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LogicalOperatorType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SelectionType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ModificationType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(IdentifierType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PSOIdentifierType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(RequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ActiveRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResumeRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SuspendRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CloseIteratorRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(IterateRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ValidatePasswordRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResetPasswordRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ExpirePasswordRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SetPasswordRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BatchRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ListTargetsRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LookupRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(DeleteRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ModifyRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AddRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AuthenticateUserRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SuggestUserIDRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(VerifySecurityAnswerRequestType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(CapabilityDataType))] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")] 
[System.SerializableAttribute()] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:oasis:names:tc:SPML:2:0")] 
public partial class ExtensibleType : object, System.ComponentModel.INotifyPropertyChanged { 

    private System.Xml.XmlElement[] anyField; 

    private System.Xml.XmlAttribute[] anyAttrField; 

    /// <remarks/> 
    [System.Xml.Serialization.XmlAnyElementAttribute(Order=0)] 
    public System.Xml.XmlElement[] Any { 
     get { 
      return this.anyField; 
     } 
     set { 
      this.anyField = value; 
      this.RaisePropertyChanged("Any"); 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlAnyAttributeAttribute()] 
    public System.Xml.XmlAttribute[] AnyAttr { 
     get { 
      return this.anyAttrField; 
     } 
     set { 
      this.anyAttrField = value; 
      this.RaisePropertyChanged("AnyAttr"); 
     } 
    } 

    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 

    protected void RaisePropertyChanged(string propertyName) { 
     System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 
     if ((propertyChanged != null)) { 
      propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 
     } 
    } 
} 

[System.Xml.Serialization.XmlIncludeAttribute(typeof(ActiveResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SearchResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ValidatePasswordResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ResetPasswordResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(BatchResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ListTargetsResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(LookupResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ModifyResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AddResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AuthenticateUserResponseType))] 
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SuggestUserIDResponseType))] 
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")] 
[System.SerializableAttribute()] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:oasis:names:tc:SPML:2:0")] 
public partial class ResponseType : ExtensibleType { 

    private string[] errorMessageField; 

    private StatusCodeType statusField; 

    private string requestIDField; 

    private ErrorCode errorField; 

    private bool errorFieldSpecified; 

    /// <remarks/> 
    [System.Xml.Serialization.XmlElementAttribute("errorMessage", Order=0)] 
    public string[] errorMessage { 
     get { 
      return this.errorMessageField; 
     } 
     set { 
      this.errorMessageField = value; 
      this.RaisePropertyChanged("errorMessage"); 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlAttributeAttribute()] 
    public StatusCodeType status { 
     get { 
      return this.statusField; 
     } 
     set { 
      this.statusField = value; 
      this.RaisePropertyChanged("status"); 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlAttributeAttribute(DataType="ID")] 
    public string requestID { 
     get { 
      return this.requestIDField; 
     } 
     set { 
      this.requestIDField = value; 
      this.RaisePropertyChanged("requestID"); 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlAttributeAttribute()] 
    public ErrorCode error { 
     get { 
      return this.errorField; 
     } 
     set { 
      this.errorField = value; 
      this.RaisePropertyChanged("error"); 
     } 
    } 

    /// <remarks/> 
    [System.Xml.Serialization.XmlIgnoreAttribute()] 
    public bool errorSpecified { 
     get { 
      return this.errorFieldSpecified; 
     } 
     set { 
      this.errorFieldSpecified = value; 
      this.RaisePropertyChanged("errorSpecified"); 
     } 
    } 
} 

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")] 
[System.SerializableAttribute()] 
[System.Diagnostics.DebuggerStepThroughAttribute()] 
[System.ComponentModel.DesignerCategoryAttribute("code")] 
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:corp:iam:spml2:security")] 
public partial class SuggestUserIDResponseType : ResponseType { 

    private string[] uidField; 

    /// <remarks/> 
    [System.Xml.Serialization.XmlElementAttribute("uid", Order=0)] 
    public string[] uid { 
     get { 
      return this.uidField; 
     } 
     set { 
      this.uidField = value; 
      this.RaisePropertyChanged("uid"); 
     } 
    } 
} 

하나에

<?xml version="1.0" encoding="utf-8"?> 
<xsd:schema xmlns:spml="urn:oasis:names:tc:SPML:2:0" xmlns:sec="urn:corp:iam:spml2:security" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:corp:iam:spml2:security" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsd:import schemaLocation="../oasis-spml-xsds/pstc_spmlv2_core.xsd" namespace="urn:oasis:names:tc:SPML:2:0" /> 
    <xsd:complexType name="SuggestUserIDResponseType"> 
    <xsd:complexContent mixed="false"> 
     <xsd:extension base="spml:ResponseType"> 
     <xsd:sequence> 
      <xsd:element minOccurs="1" maxOccurs="5" name="uid" type="xsd:string" /> 
     </xsd:sequence> 
     </xsd:extension> 
    </xsd:complexContent> 
    </xsd:complexType> 
</xsd:schema> 

그리고

<?xml version="1.0" encoding="utf-8"?> 
<xsd:schema xmlns:spml="urn:oasis:names:tc:SPML:2:0" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:oasis:names:tc:SPML:2:0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <xsd:complexType name="ExtensibleType"> 
    <xsd:sequence> 
     <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax" /> 
    </xsd:sequence> 
    <xsd:anyAttribute namespace="##other" processContents="lax" /> 
    </xsd:complexType> 
    <xsd:complexType name="ResponseType"> 
    <xsd:complexContent mixed="false"> 
     <xsd:extension base="spml:ExtensibleType"> 
     <xsd:sequence> 
      <xsd:element minOccurs="0" maxOccurs="unbounded" name="errorMessage" type="xsd:string" /> 
     </xsd:sequence> 
     <xsd:attribute name="status" type="spml:StatusCodeType" use="required" /> 
     <xsd:attribute name="requestID" type="xsd:ID" use="optional" /> 
     <xsd:attribute name="error" type="spml:ErrorCode" use="optional" /> 
     </xsd:extension> 
    </xsd:complexContent> 
    </xsd:complexType> 
</xsd:schema> 

있습니다 리턴 된 SOAP 메시지는

입니다. 는 SOAP 제대로 SuggestUserIDResponseType 클래스에 deserialzed되지 않은 그 시점에서 91,363,210
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
     <ns3:suggestUserIDResponse status="success" requestID="MyApp" xmlns="urn:oasis:names:tc:SPML:2:0" xmlns:ns2="urn:oasis:names:tc:SPML:2:0:password" xmlns:ns3="urn:corp:iam:spml2:security" xmlns:ns4="urn:oasis:names:tc:SPML:2:0:suspend" xmlns:ns5="urn:oasis:names:tc:SPML:2:0:search" xmlns:ns6="urn:oasis:names:tc:SPML:2:0:DSML" xmlns:ns7="urn:oasis:names:tc:DSML:2:0:core" xmlns:ns8="urn:oasis:names:tc:SPML:2:0:batch"> 
     <ns3:uid>text1</ns3:uid> 
     <ns3:uid>text2</ns3:uid> 
     <ns3:uid>text3</ns3:uid> 
     </ns3:suggestUserIDResponse> 
    </soap:Body> 
</soap:Envelope> 

SuggestUserIDResponseType.uid는 항상 null이지만, 반복 UID 만에 SuggestUserIDResponseType.AnyXmlElement 같은 데이터 형식을 나타납니다.

어떤 제안이 잘못 되었나요?

+0

웹 참조를 사용하도록 변경되었으며 현재 잘 작동하지만 후드 아래의 차이점은 무엇입니까? – hardywang

+1

의도적 인 차이가 없으며 다른 버그가 있습니다 ... –

답변

0

방금 ​​같은 문제가 발생했습니다. 이 문제는 XmlAnyElementAttribute 속성으로 장식 된 public System.Xml.XmlElement[] Any 속성과 Order 한정자 세트의 조합으로 처리해야합니다. XmlElement[] Any 배열을 가진 기본 클래스에서 상속 할 때만 발생하는 것일 수도 있습니다.

내 경우에는이 솔루션

XmlElementAttribute attibutes, XmlAnyElementAttribute 속성과 MessageBodyMemberAttribute 속성 상속 된 모든 클래스에서 에 주문 한정자를 제거하는 것이었다.

참고 :

형 멤버 "XYZ" "ABC_Type"선언이 필요없는 '순서' 특성 : 굵은 이탤릭체로 그 비트가, 그렇지 않으면 당신은 같은 오류 뭔가를 얻을 수 있습니다 중요합니다. 클래스 계층 구조에서 하나 개의 클래스가 명시 적 시퀀싱 기능 (주문)를 사용하는 경우, 기본 클래스와 모든 클래스 I이 가능한 어떤 부작용을 확인하기 위해 연구를 수행하지 않은 같은

을 할 필요가 도출 여기에서 중요한 것은 아마도 클래스에서 올바른 순서로 속성을 가지고 직렬화가 올바른 순서로 수행된다는 것입니다.

희망이 있으면 누군가에게 도움이됩니다.

관련 문제