BizTalk 2010-无法导入在ASP.Net Core 2.1中创建的WSDL无法获取元数据

问题描述

WSDL服务是使用ASP.Net Core 2.1创建的

当我添加对WCF服务的引用时,出现错误消息:

Metadata not available 
Failed to get Metadata from "http://xxx.xxx.xxx.xxx:port/somewsdl?wsdl".

(Microsoft.BizTalk.Adapter.Wcf.Consuming.MetadataExchange.MetadataExchangeException) Unable to download Metadata from "http://xxx.xxx.xxx.xxx:port/somewsdl??wsdl" using WS-Metadata Exchange.
(system.invalidOperationException) Metadata contains a reference that cannot be resolved: 'http://xxx.xxx.xxx.xxx:port/somewsdl??wsdl'. (System.ServiceModel.CommunicationException) 
The server did not provide a meaningful reply; this might be caused by a contract mismatch,a premature session shutdown or an internal server error. 

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processpath="dotnet" arguments=".\somedll.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
    </system.webServer>
  </location>
</configuration>

当我从SoapUI测试wsdl时,它可以工作。你能帮我吗?

VS 2010 Ultimate版本10.0.30319.1
BizTalk Server 2010版本3.9.469.0

我做了一个测试,以确保它与旧版VS / BizTalk无关:
VS 2015专业版
BizTalk Server 2016

--------------编辑---------------------

我正在使用以下方式添加参考:

enter image description here

enter image description here

enter image description here

enter image description here

当我在“ BizTalk WCF服务使用向导”中使用“元数据文件”时,出现错误

enter image description here

wsdl文件

<wsdl:deFinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/Metadata" targetNamespace="http://tempuri.org/" name="ISomeImport" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
            <xs:element name="InputData">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" maxOccurs="1" name="template" type="tns:FormTemplateType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="InputDataResponse">
                <xs:element minOccurs="0" maxOccurs="1" name="InputDataResult" type="tns:FormTemplateResponseType"/>
            </xs:element>
            <xs:complexType name="FormTemplateType">
                <xs:sequence>
                    <xs:element minOccurs="1" maxOccurs="1" name="Changed" type="xs:dateTime"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Data" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Gestor" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Identifier" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Publisher" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Status" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Version" type="tns:FormTemplteVersion"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="FormTemplateResponseType">
                <xs:sequence>
                    <xs:element minOccurs="1" maxOccurs="1" name="Code" type="xs:int"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="Message" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="TimestampStart" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="TimestampEnd" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:complexType name="FormTemplteVersion">
                <xs:sequence>
                    <xs:element minOccurs="1" maxOccurs="1" name="Major" type="xs:int"/>
                    <xs:element minOccurs="1" maxOccurs="1" name="Minor" type="xs:int"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="ISomeImport_InputData_InputMessage">
        <wsdl:part name="parameters" element="tns:InputData"/>
    </wsdl:message>
    <wsdl:message name="ISomeImport_InputData_OutputMessage">
        <wsdl:part name="parameters" element="tns:FormTemplateResponseType"/>
    </wsdl:message>
    <wsdl:portType name="ISomeImport">
        <wsdl:operation name="InputData">
            <wsdl:input message="tns:ISomeImport_InputData_InputMessage"/>
            <wsdl:output message="tns:ISomeImport_InputData_OutputMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BasicHttpBinding" type="tns:ISomeImport">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="InputData">
            <soap:operation soapAction="http://tempuri.org/ISomeImport/InputData" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ISomeImport">
        <wsdl:port name="BasicHttpBinding" binding="tns:BasicHttpBinding">
            <soap:address location="http://xxx.xxx.xxx.xxx:port/someImport"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:deFinitions>

解决方法

尝试从浏览器浏览WSDL文件,将其保存在本地。然后在WCF服务使用向导中选择下载的wsdl文件。它应该工作。 有一个l Consume web service using Wcf-basichttp adapter

,

问题出在wsdl中。

新的wsdl:

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/" name="IsomeImport">
    <script/>
    <script/>
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces"/>
            <xs:element name="InputData">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" minOccurs="0" name="template" nillable="true" type="q1:EFormTemplateType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="InputDataResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" minOccurs="0" name="InputDataResult" nillable="true" type="q2:EFormTemplateResponseType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/">
            <xs:element name="anyType" nillable="true" type="xs:anyType"/>
            <xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
            <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
            <xs:element name="boolean" nillable="true" type="xs:boolean"/>
            <xs:element name="byte" nillable="true" type="xs:byte"/>
            <xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
            <xs:element name="decimal" nillable="true" type="xs:decimal"/>
            <xs:element name="double" nillable="true" type="xs:double"/>
            <xs:element name="float" nillable="true" type="xs:float"/>
            <xs:element name="int" nillable="true" type="xs:int"/>
            <xs:element name="long" nillable="true" type="xs:long"/>
            <xs:element name="QName" nillable="true" type="xs:QName"/>
            <xs:element name="short" nillable="true" type="xs:short"/>
            <xs:element name="string" nillable="true" type="xs:string"/>
            <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
            <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
            <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
            <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
            <xs:element name="char" nillable="true" type="tns:char"/>
            <xs:simpleType name="char">
                <xs:restriction base="xs:int"/>
            </xs:simpleType>
            <xs:element name="duration" nillable="true" type="tns:duration"/>
            <xs:simpleType name="duration">
                <xs:restriction base="xs:duration">
                    <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
                    <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
                    <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
                </xs:restriction>
            </xs:simpleType>
            <xs:element name="guid" nillable="true" type="tns:guid"/>
            <xs:simpleType name="guid">
                <xs:restriction base="xs:string">
                    <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
                </xs:restriction>
            </xs:simpleType>
            <xs:attribute name="FactoryType" type="xs:QName"/>
            <xs:attribute name="Id" type="xs:ID"/>
            <xs:attribute name="Ref" type="xs:IDREF"/>
        </xs:schema>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/someeFormFiller.Models.Interfaces">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/System"/>
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
            <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateType">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Changed" type="xs:dateTime"/>
                    <xs:element minOccurs="0" name="Data" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="Gestor" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="Identifier" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="Publisher" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="Status" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="Version" nillable="true" type="tns:EFormTemplateVersion"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="EFormTemplateType" nillable="true" type="tns:EFormTemplateType"/>
            <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateVersion">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Major" type="xs:int"/>
                    <xs:element minOccurs="0" name="Minor" type="xs:int"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="EFormTemplateVersion" nillable="true" type="tns:EFormTemplateVersion"/>
            <xs:complexType xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" name="EFormTemplateResponseType">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Code" type="xs:int"/>
                    <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="TimestampEnd" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="TimestampStart" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="EFormTemplateResponseType" nillable="true" type="tns:EFormTemplateResponseType"/>
        </xs:schema>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="IsomeImport_InputData_InputMessage">
        <wsdl:part name="parameters" element="tns:InputData"/>
    </wsdl:message>
    <wsdl:message name="IsomeImport_InputData_OutputMessage">
        <wsdl:part name="parameters" element="tns:InputDataResponse"/>
    </wsdl:message>
    <wsdl:portType name="IsomeImport">
        <wsdl:operation name="InputData">
            <wsdl:input wsam:Action="http://tempuri.org/IsomeImport/InputData" message="tns:IsomeImport_InputData_InputMessage"/>
            <wsdl:output wsam:Action="http://tempuri.org/IsomeImport/InputDataResponse" message="tns:IsomeImport_InputData_OutputMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BasicHttpBinding" type="tns:IsomeImport">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="InputData">
            <soap:operation soapAction="http://tempuri.org/IsomeImport/InputData" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="IsomeImport">
        <wsdl:port name="BasicHttpBinding" binding="tns:BasicHttpBinding">
            <soap:address location="http://xxx.xxx.xxx.xxx:port/someImport.svc"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>