Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从WSDL生成的服务返回不同的WSDL_C#_Wcf_Wsdl_Datacontract - Fatal编程技术网

C# 从WSDL生成的服务返回不同的WSDL

C# 从WSDL生成的服务返回不同的WSDL,c#,wcf,wsdl,datacontract,C#,Wcf,Wsdl,Datacontract,我已经从一个交付的WSDL模式生成了一个WCF服务接口,这个接口已经在我的一个WCF服务中实现,没有任何问题 [ServiceBehavior(Name = "HL7Service", Namespace = "urn:hl7-org:v3")] [ServiceContract(Namespace = "urn:hl7-org:v3", Name = "HL7Service", SessionMode = SessionMode.Allowed)] public class HL7Servic

我已经从一个交付的WSDL模式生成了一个WCF服务接口,这个接口已经在我的一个WCF服务中实现,没有任何问题

[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

有关交付的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中相同部分的外观

<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>

choice元素被替换为简单的anyType元素?问题是,假定放在itemfield上的类型(PRPA_MT201302UV02.Patient.patientPerson和PRPA_MT201302UV02.Patient.patientNonPersonLivingSubject)从未在客户端代理类中生成

我已尝试从生成服务的交付的WSDL模式生成代理客户端类,这将创建正确的代理客户端,但在尝试与服务通信时,将出现Datacontract missmatch异常


为什么WSDL模式不一样?

看起来您在用操作契约而不是契约(接口)标记类


此外,您也不会显示是否已使用DataContract/DataMember属性标记邮件。

为什么会相同?一个正在生成,另一个在文件中。如果您希望它是相同的,那么您应该让WCF从文件中返回WSDL。如果WCF服务实现从MySchemaA.WSDL生成的接口,那么我希望服务遵循此WSDL,从而呈现其自己的WSDL完全相同。我如何让我的服务提供自己的MySchemaA.WSDL intead?这真的会发生吗?例外情况是否应该不同?不,不应该。这一点尤其正确,因为您的WSDL使用了复杂的特性,这会影响互操作性。例如,xs:group。
<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>