客戶爲我們提供了他們想開發的服務的模式和wsdl。當我跳上這個項目時,已經有了一個服務實施。當我在IE中拉起svc文件時,它顯示了正常的svcutil命令等等。當我深入瞭解,並且看到我們使用的wsdl導入的模式時,我注意到MessageContracts沒有顯示在架構。我可以做些什麼來使MessageContracts顯示出來,這樣模式將是明智的?如何使我的WCF消息協定顯示在導入的模式中?
例如,客戶給了我們這一點,
<xs:schema elementFormDefault="qualified" targetNamespace="http://ws.tcore.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.tcore.com">
<xs:import schemaLocation="ATISDataContracts.xsd" namespace="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
<xs:import schemaLocation="Serialization.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xs:element name="ASICDetectorInventoryRequestMC">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="DetectorInventoryRequest" nillable="true" type="q1:DetectorInventoryRequestDC" xmlns:q1="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ConnectionRequest" nillable="true" type="q2:ConnectionRequestDC" xmlns:q2="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
但是當我深入到從我的SVC的WSDL,和我複製/粘貼模式導入,我看到消息合同丟失,雖然「q1:」等都是正確的。我的模式看起來像這樣。
<xs:schema elementFormDefault="qualified" targetNamespace="http://ws.tcore.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.tcore.com">
<xs:import schemaLocation="http://localhost:9305/mex?xsd=xsd1" namespace="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
<xs:import schemaLocation="http://localhost:9305/mex?xsd=xsd0" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xs:element name="DetectorInventoryRequest" nillable="true" type="q1:DetectorInventoryRequestDC" xmlns:q1="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
<xs:element name="ConnectionRequest" nillable="true" type="q2:ConnectionRequestDC" xmlns:q2="http://schemas.datacontract.org/2004/07/tcore.ATISDataContracts" />
大部分看起來都是一樣的。我如何讓我的MessageContract元素出現在模式中?
下面是一個消息合同C#代碼
namespace tcore.ATISDataContracts
{
[MessageContract(IsWrapped = false)]
public class ASICDetectorInventoryRequestMC
{
[MessageHeader]
public ConnectionRequestDC ConnectionRequest;
[MessageBodyMember]
public DetectorInventoryRequestDC DetectorInventoryRequest;
}
}
其架構示出了複雜類型的樣品,但我的派生模式只顯示元件,而不是複雜類型。我在這裏做錯了什麼?任何幫助或提示表示讚賞。
感謝您的幫助,
〜CK在聖地亞哥