Ссылка на службу не загружается: не удалось найти схему с целевым пространством имен
Я пытаюсь добавить ссылку на службу в свой проект, и я постоянно получаю ту же ошибку.
Я создал макет службы с SOAP UI, который кажется прекрасным, затем я пытаюсь добавить ссылку на службу в этот макет службы, и появляется ошибка:
Warning 14 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'urn:oasis:names:tc:dss:1.0:core:schema' could not be found.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/esign']/wsdl:portType[@name='EsignServiceSoap11PortType']
импорт в wsdl, где загружается схема с urn пространства имен:oasis:names:tc:dss:1.0:core:schema:
<wsdl:types>
<schema xmlns="urn:oasis:names:tc:dss:1.0:core:schema">
<import namespace="urn:oasis:names:tc:dss:1.0:core:schema" schemaLocation="oasis-dss-core-schema-v1.0-os.xsd"/>
</schema>
.....
</wsdl:types>
Я уже пытался связать schemaLocation непосредственно с файлом в та же папка, что и wsdl, к url-адресу, где он опубликован на частном сервере, и к общедоступному uri, где он также опубликован.
Я получаю всегда одну и ту же ошибку и я начинаю чувствовать, что, возможно, я ошибаюсь с источником проблемы.
любое понимание будет высоко ценится.
UPDATE:я ввел urn:oasis:names:tc:dss:1.0:core: schema полное определение внутри моего файла wsdl, вместо того, чтобы пытаться импортировать его. Когда я это делаю, SOAP UI все еще создает правильно насмешливая служба, однако, когда я пытаюсь добавить ссылку на службу, эта ошибка возникает во время обнаружения службы:
The document was understood, but it could not be processed.
- The WSDL document contains links that could not be resolved.
- DTD is prohibited in this XML document.
Metadata contains a reference that cannot be resolved: 'http://elite8100-3:8088/mockEsignServiceSoap11Binding?WSDL'.
The content type text/html; charset=iso-8859-1 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 455 bytes of the response were: '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>Server</soap:Value>
</soap:Code>
<soap:Reason>
<!--1 or more repetitions:-->
<soap:Text xml:lang="en">Missing operation for soapAction [null] and body element [null] with SOAP Version [SOAP 1.2]</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>'.
The remote server returned an error: (500) Internal Server Error.
If the service is defined in the current solution, try building the solution and adding the service reference again.
EDIT2: я использовал Fiddler для проверки http-трафика при попытке создать прокси-сервер, как предложено в ответе. Во время создания 500 внутренняя ошибка сервера появляется на Fiddler при попытке достичь url-адреса mockService, ответ от сервера был " отсутствует операция для soapAction [null] и элемент тела [null] с версией SOAP [SOAP 1.2]".
в настоящее время это WSDL, который я использую для создания mockService.
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://www.w3.org/2001/XMLSchema" schemaLocation="http://aplicaciones.serpasa.es/CONTROLAMBIENTAL/oasis-dss-core-schema-v1.0-os.xsd"/>
</schema>
<schema xmlns="http://princast.es/esign/2.0/esign.xsd">
<import namespace="http://princast.es/esign/2.0/esign.xsd" schemaLocation="http://aplicaciones.serpasa.es/CONTROLAMBIENTAL/esign.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="SignRequestMessage">
<wsdl:part element="dss:SignRequest" name="payload"/>
</wsdl:message>
<wsdl:message name="SignResponseMessage">
<wsdl:part element="dss:SignResponse" name="payload"/>
</wsdl:message>
<wsdl:message name="VerifyRequestMessage">
<wsdl:part element="dss:VerifyRequest" name="payload"/>
</wsdl:message>
<wsdl:message name="VerifyResponseMessage">
<wsdl:part element="dss:VerifyResponse" name="payload"/>
</wsdl:message>
<wsdl:message name="GetSignInfoFromDocumentRequestMessage">
<wsdl:part element="esign:SignInfoRequest" name="payload"/>
</wsdl:message>
<wsdl:message name="GetSignInfoFromDocumentResponseMessage">
<wsdl:part element="esign:SignInfo" name="payload"/>
</wsdl:message>
<wsdl:message name="GetSignConfigurationRequestMessage">
<wsdl:part element="esign:SignConfigurationRequest" name="payload"/>
</wsdl:message>
<wsdl:message name="GetSignConfigurationResponseMessage">
<wsdl:part element="esign:SupportedSignConfiguration" name="payload"/>
</wsdl:message>
<!-- Port -->
<wsdl:portType name="EsignServiceSoap11PortType">
<wsdl:operation name="sign">
<wsdl:input message="impl:SignRequestMessage" name="signRequest"/>
<wsdl:output message="impl:SignResponseMessage" name="signResponse"/>
</wsdl:operation>
<wsdl:operation name="verify">
<wsdl:input message="impl:VerifyRequestMessage" name="verifyRequest"/>
<wsdl:output message="impl:VerifyResponseMessage" name="verifyResponse"/>
</wsdl:operation>
<wsdl:operation name="getSignConfiguration">
<wsdl:input message="impl:GetSignConfigurationRequestMessage" name="getSignConfigurationRequest"/>
<wsdl:output message="impl:GetSignConfigurationResponseMessage" name="getSignConfigurationResponse"/>
</wsdl:operation>
<wsdl:operation name="getSignInfoFromDocument">
<wsdl:input message="impl:GetSignInfoFromDocumentRequestMessage" name="getSignInfoFromDocumentRequest"/>
<wsdl:output message="impl:GetSignInfoFromDocumentResponseMessage" name="getSignInfoFromDocumentResponse"/>
</wsdl:operation>
</wsdl:portType>
<!-- Binding -->
<wsdl:binding name="EsignServiceSoap11Binding" type="impl:EsignServiceSoap11PortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sign">
<wsdl:documentation>
Realiza una firma digital delegada sobre un
documento segun el estandard OASIS Digital Signature Service (DSS)
</wsdl:documentation>
<wsdlsoap:operation soapAction="urn:sign"/>
<wsdl:input name="signRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="signResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="verify">
<wsdl:documentation>
Verifica una firma digital OASIS Digital
Signature Service (DSS)
</wsdl:documentation>
<wsdlsoap:operation soapAction="urn:verify"/>
<wsdl:input name="verifyRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="verifyResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getSignConfiguration">
<wsdl:documentation>
Obtiene los certificados con los que una
aplicacion en el MC de Firma Digital puede realizar
una firma
</wsdl:documentation>
<wsdlsoap:operation soapAction="urn:getSignConfiguration"/>
<wsdl:input name="getSignConfigurationRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getSignConfigurationResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getSignInfoFromDocument">
<wsdl:documentation>
Obtiene informacion de un fichero de firma
</wsdl:documentation>
<wsdlsoap:operation soapAction="urn:getSignInfoFromDocument"/>
<wsdl:input name="getSignInfoFromDocumentRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getSignInfoFromDocumentResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EsignService">
<wsdl:documentation>
Servicio web de firma digital
</wsdl:documentation>
<wsdl:port binding="impl:EsignServiceSoap11Binding" name="EsignServiceSoap11Port">
<wsdlsoap:address location="http://someexternalsite.com"/>
</wsdl:port>
</wsdl:service>
Я загрузил каждый .xsd связал и опубликовал их на общедоступном сервере, также я изменил schemaLocations, чтобы они указывали на адреса на этом общедоступном сервере, однако проблема, похоже, связана со структурой WSDL.
1 ответов
основная проблема перед обновлением должна заключаться в неправильном синтаксисе. Где вы говорите <schema xmlns="urn:oasis:names:tc:dss:1.0:core:schema">
инструмент ожидает <schema xmlns="http://www.w3.org/2001/XMLSchema">
. Чтобы просто импортировать внешний xsd-файл, приведенное выше исправление пространства имен XML по умолчанию-это все, что вам нужно.
импорт схемы / включает может быть довольно загроможден; для тех случаев, когда их помещают внутрь WSDL, как вы предположили, легко совершать ошибки, поскольку это не простой случай просто вырезать и вставить. Например, некоторые инструменты могут иметь проблемы обработка ссылок, первоначально основанных на xsd:include; chameleon includes, не может быть воспроизведена внутри WSDL; и все ваши xsd:imports не должны использовать атрибут schemaLocation.
для устранения неполадок, связанных со сломанными ссылками, я настоятельно рекомендую использовать отладчик HTTP, такой как Fiddler. Он скажет вам, по крайней мере, какие ссылки вы забыли очистить, или любые HTTP-заголовки, которые ваше макет-решение не устанавливает должным образом.
Если вышеуказанное все еще выходит вы с некоторыми вопросами вам придется опубликовать измененный WSDL.