我有一个需要从 BizTalk 业务流程使用的 Web 服务。我已经定义了在 BizTalk 中使用的消息架构,它们看起来像
<?xml version="1.0" encoding="utf-16"?>
<xs:schema
xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
xmlns="http://www.myapp.com/schemas/IntegrationApplication-instance"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
xmlns:ns0="https://DTIB.PropertySchema"
elementFormDefault="qualified"
targetNamespace="http://www.myapp.com/schemas/IntegrationApplication-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation=".\CommonTypes.xsd" />
<xs:element name="ProviderRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Header" type="HeaderType" />
<xs:element name="Parameters" type="ParametersType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
在 WCF 服务中,我定义了类似的方法
public ProviderResponse Provide(ProviderRequest providerRequest) {...}
其中ProviderRequest
定义为
[DataContract(Namespace = "http://www.myapp.com/schemas/IntegrationApplication-instance")]
public class ProviderRequest
{
[DataMember]
public Header Header { get; set; }
[DataMember]
public Parameter[] Parameters { get; set; }
}
当我创建发送端口并尝试发送 ProviderRequest 消息时,它会失败并出现不同的错误。
使用与 BizTalk 项目中定义的相同架构的 WCF 服务的最佳方法是什么?