2009-07-31 3 views
1

WSDL 스키마를 전달한 WCF 서비스 인터페이스를 생성했습니다.이 인터페이스는 아무 문제없이 내 WCF 서비스 중 하나에서 구현되었습니다.다른 WSDL에서 생성 된 서비스

[ServiceBehavior(Name = "HL7Service", Namespace = "urn:hl7-org:v3")] 
[ServiceContract(Namespace = "urn:hl7-org:v3", Name = "HL7Service", SessionMode = SessionMode.Allowed)] 
public class HL7Service : IPatientRegistryQueryTracker_Binding 
{ 


    [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "PRPA_IN201302NO_Operation")] 
    public PRPA_IN201302NOResponse PRPA_IN201302NO_Operation(PRPA_IN201302NO request) 
    { 

    } 

    [OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "PRPA_IN201304NO_Operation")] 
    public PRPA_IN201304NOResponse PRPA_IN201304NO_Operation(PRPA_IN201304NO request) 
    { 

    } 

} 

이상한 부분은 새로운 서비스의 WSDL이 생성 된 WSDL을 준수하지 않는다는 것입니다.

<xs:complexType name="PRPA_MT201302UV02.Patient"> 
    <xs:sequence> 
     <xs:group ref="InfrastructureRootElements"/> 
     <xs:element name="id" type="PRPA_MT201302UV02.Patient.id" maxOccurs="unbounded"/> 
     <xs:element name="addr" type="AD" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="telecom" type="TEL" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="statusCode" type="PRPA_MT201302UV02.Patient.statusCode"/> 
     <xs:element name="effectiveTime" type="IVL_TS" minOccurs="0"/> 
     <xs:element name="confidentialityCode" type="CE" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="veryImportantPersonCode" type="CE" minOccurs="0"/> 
     <xs:choice> 
      <xs:element name="patientPerson" type="PRPA_MT201302UV02.Patient.patientPerson" nillable="true"/> 
      <xs:element name="patientNonPersonLivingSubject" type="PRPA_MT201302UV02.Patient.patientNonPersonLivingSubject" nillable="true"/> 
     </xs:choice> 
     <xs:element name="providerOrganization" type="COCT_MT150003UV03.Organization" nillable="true" minOccurs="0"/> 
     <xs:element name="subjectOf" type="PRPA_MT201302UV02.Subject4" nillable="true" minOccurs="0" maxOccurs="unbounded"/> 
     <xs:element name="coveredPartyOf" type="PRPA_MT201302UV02.CoveredParty" nillable="true" minOccurs="0" maxOccurs="unbounded"/> 
    </xs:sequence> 
    <xs:attributeGroup ref="InfrastructureRootAttributes"/> 
    <xs:attribute name="nullFlavor" type="NullFlavor" use="optional"/> 
    <xs:attribute name="classCode" type="RoleClass" use="required" fixed="PAT"/> 
</xs:complexType> 

이 같은 전달 WSDL lookt의 일부가 내 서비스

[System.Xml.Serialization.XmlElementAttribute("patientNonPersonLivingSubject", typeof(PRPA_MT201302UV02PatientpatientNonPersonLivingSubject), IsNullable=true)] 
[System.Xml.Serialization.XmlElementAttribute("patientPerson", typeof(PRPA_MT201302UV02PatientpatientPerson), IsNullable=true)] 
public object Item { 
    get { 
     return this.itemField; 
    } 
    set { 
     this.itemField = value; 
    } 
} 

이 괜찮 메스에 다음과 같은 인터페이스로 생성하는 방법에

예. 이것이 내 서비스 WSDL에서 동일한 부분을 보는 방식입니다.

<xs:complexType name="PRPA_MT201302UV02Patient"> 
− 
<xs:sequence> 
    <xs:element name="addrField" nillable="true" type="tns:ArrayOfAD"/> 
    <xs:element name="classCodeField" nillable="true" type="xs:string"/> 
    <xs:element name="confidentialityCodeField" nillable="true" type="tns:ArrayOfCE"/> 
    <xs:element name="coveredPartyOfField" nillable="true" type="tns:ArrayOfPRPA_MT201302UV02CoveredParty"/> 
    <xs:element name="effectiveTimeField" nillable="true" type="tns:IVL_TS"/> 
    <xs:element name="idField" nillable="true" type="tns:ArrayOfPRPA_MT201302UV02Patientid"/> 
    <xs:element name="itemField" nillable="true" type="xs:anyType"/> 
    <xs:element name="nullFlavorField" nillable="true" type="xs:string"/> 
    <xs:element name="providerOrganizationField" nillable="true" type="tns:COCT_MT150003UV03Organization"/> 
    <xs:element name="realmCodeField" nillable="true" type="tns:ArrayOfCS"/> 
    <xs:element name="statusCodeField" nillable="true" type="tns:PRPA_MT201302UV02PatientstatusCode"/> 
    <xs:element name="subjectOfField" nillable="true" type="tns:ArrayOfPRPA_MT201302UV02Subject4"/> 
    <xs:element name="telecomField" nillable="true" type="tns:ArrayOfTEL"/> 
    <xs:element name="templateIdField" nillable="true" type="tns:ArrayOfII"/> 
    <xs:element name="typeIdField" nillable="true" type="tns:II"/> 
    <xs:element name="veryImportantPersonCodeField" nillable="true" type="tns:CE"/> 
</xs:sequence> 

선택 요소 간단한 anyType에 요소로 대체? 그리고이 문제는 itemfield에 배치되는 것으로 가정되는 유형 (PRPA_MT201302UV02.Patient.patientPerson 및 PRPA_MT201302UV02.Patient.patientNonPersonLivingSubject)이 클라이언트 프록시 클래스에서 생성되지 않는다는 것입니다.

서비스가 생성 된 WSDL 전달 된 스키마에서 프록시 클라이언트 클래스를 생성하려고 시도했지만 올바른 프록시 클라이언트를 만들지 만 서비스와 통신하려고 할 때 Datacontract missmatch 예외가 발생합니다

WSDL 스키마가 같은 이유는 무엇입니까?

+0

왜 동일할까요? 하나는 생성 중이며 다른 하나는 파일에 있습니다. WCF가 동일하게하려면 WCF가 파일에서 WSDL을 반환하도록해야합니다. –

+0

WCF 서비스가 MySchemaA.WSDL에서 생성 된 인터페이스를 구현하는 경우이 서비스가이 WSDL을 따르기 때문에 자체 WSDL이 거의 동일하게 렌더링 될 것으로 기대합니다. 내 서비스에서 MySchemaA.WSDL을 제공 할 수있는 방법은 무엇입니까? 그리고 이것이 정말로 메이더일까요? 예외가 같지 않아야합니까? –

+0

아니요, 안됩니다. 이는 WSDL이 상호 운용성을 저하시키는 복잡한 기능을 사용하기 때문에 특히 그렇습니다. 예를 들어, xs : group. –

답변

0

계약 (인터페이스) 대신 운영 계약으로 클래스를 표시하는 것처럼 보입니다.

또한 DataContract/DataMember 특성으로 메시지를 표시했는지 표시하지 않습니다.

관련 문제