2012-11-05 32 views
4

我一直在爲這些日子苦苦掙扎,對於如何解決這個問題毫無頭緒。基本上,我有以下的WSDL服務定義:在WCF和Biztalk中從WSDL導入鍵/值complexType定義

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://sample.org/schemas/2012" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://sample.org/schemas/2012" name="SampleServiceImplService"> 
<types> 
<xsd:schema> 
<xsd:import namespace="http://sample.org/schemas/2012" schemaLocation="http://localhost:8080/sampleServices_war_exploded/sample?xsd=1"/> 
</xsd:schema> 
</types> 
<message name="ExecuteSample"> 
<part name="parameters" element="tns:ExecuteSample"/> 
</message> 
<message name="ExecuteSampleResponse"> 
<part name="parameters" element="tns:ExecuteSampleResponse"/> 
</message> 
<message name="SampleException"> 
<part name="fault" element="tns:SampleException"/> 
</message> 
<portType name="SampleService"> 
<operation name="ExecuteSample"> 
<input wsam:Action="http://sample.org/schemas/2012/SampleService/ExecuteSampleRequest" message="tns:ExecuteSample"/> 
<output wsam:Action="http://sample.org/schemas/2012/SampleService/ExecuteSampleResponse" message="tns:ExecuteSampleResponse"/> 
<fault message="tns:SampleException" name="SampleException" wsam:Action="http://sample.org/schemas/2012/SampleService/ExecuteSample/Fault/SampleException"/> 
</operation> 
</portType> 
<binding name="SampleServiceImplPortBinding" type="tns:SampleService"> 
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
<operation name="ExecuteSample"> 
<soap:operation soapAction=""/> 
<input> 
<soap:body use="literal"/> 
</input> 
<output> 
<soap:body use="literal"/> 
</output> 
<fault name="SampleException"> 
<soap:fault name="SampleException" use="literal"/> 
</fault> 
</operation> 
</binding> 
<service name="SampleServiceImplService"> 
<port name="SampleServiceImplPort" binding="tns:SampleServiceImplPortBinding"> 
<soap:address location="http://localhost:8080/sampleServices_war_exploded/sample"/> 
</port> 
</service> 
</definitions> 

用下面的陪同XSD文件定義:

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown. --><xs:schema xmlns:tns="http://sample.org/schemas/2012" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://sample.org/schemas/2012"> 
<xs:element name="ExecuteSample" type="tns:ExecuteSample"/> 
<xs:element name="ExecuteSampleResponse" type="tns:ExecuteSampleResponse"/> 
<xs:element name="SampleException" nillable="true" type="tns:faultInfo"/> 
<xs:complexType name="ExecuteSample"> 
<xs:sequence> 
<xs:element name="name" type="xs:string" minOccurs="0"/> 
<xs:element name="values"> 
<xs:complexType> 
<xs:sequence> 
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded"> 
<xs:complexType> 
<xs:sequence> 
<xs:element name="key" minOccurs="0" type="xs:string"/> 
<xs:element name="value" minOccurs="0" type="xs:string"/> 
</xs:sequence> 
</xs:complexType> 
</xs:element> 
</xs:sequence> 
</xs:complexType> 
</xs:element> 
</xs:sequence> 
</xs:complexType> 
<xs:complexType name="ExecuteSampleResponse"> 
<xs:sequence/> 
</xs:complexType> 
<xs:complexType name="faultInfo"> 
<xs:sequence/> 
</xs:complexType> 
</xs:schema> 

確定,文件看起來不錯,我們定義了一個名爲ExecuteSample(請求類型)的complexType是包含兩個成員,名稱和值,最後一個是具有鍵和值的條目,名爲「entry」的另一個複雜類型。

這看起來像一本字典,實際上是一本字典。它甚至使用'建議'暴露字典的方式,唯一的區別是封裝在'entry'參數中。

那麼,猜猜看,WCF svcutil既不biztalk也不能識別WSDL。 SvcUtil工具和Visual Studio失敗,一個非常愚蠢的錯誤,告訴我是這樣的:

Warning 1 Custom tool warning: Cannot import wsdl:portType 
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter 
Error: Object reference not set to an instance of an object. 
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://sample.org/schemas/2012']/wsdl:portType[@name='SampleService'] C:\src\biztalk\ConsoleApplication6\ConsoleApplication6\Service References\ServiceReference1\Reference.svcmap 1 1 ConsoleApplication6 

在BizTalk WSDL導入嚮導失敗沒有任何錯誤信息,只是告訴我,什麼是錯的...

我已經試了一切,看起來一切都可能在網絡上,沒有真正的爆裂..我絕望,不知道到底發生了什麼,一切看起來不錯,但沒有工作...

奇怪的...任何想法?

回答

2

您需要將targetNamespace添加到wsdl的types部分中的模式標記。

<types> 
    <xsd:schema targetNamepace="http://blah.org"> 
    ... 
    </xsd:schema> 
</types> 
相關問題