2016-03-17 23 views
9

Tôi đang cố gắng thêm một Tham chiếu dịch vụ vào dự án của mình và tôi sẽ liên tục gặp lỗi tương tự.Tham chiếu dịch vụ không tải: Không thể tìm thấy lược đồ có không gian tên đích

tôi đã tạo ra một dịch vụ giả với giao diện người dùng SOAP mà có vẻ tốt đẹp, sau đó tôi cố gắng thêm một tài liệu tham khảo phục vụ cho dịch vụ giả này và các lỗi xuất hiện:

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']  

Việc nhập khẩu trên wsdl nơi schema với namespace urn: ốc đảo: tên: tc: dss: 1,0: lõi: schema đang được nạp là:

<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> 

tôi đã cố gắng để liên kết các schemaLocation trực tiếp đến các tập tin trong thư mục cùng hơn wsdl, để một url nơi nó được xuất bản trong một máy chủ riêng và đến một uri công cộng, nơi nó cũng được xuất bản.

Tôi nhận được cùng một lỗi và tôi bắt đầu cảm thấy rằng có thể tôi đã nhầm lẫn với nguồn gốc của vấn đề.

Mọi thông tin chi tiết sẽ được đánh giá cao.

CẬP NHẬT: Tôi đã tiêm urn: ốc đảo: tên: tc: dss: 1.0: core: định nghĩa hoàn thành giản đồ bên trong tệp wsdl của tôi, thay vì cố nhập nó. Khi tôi làm như vậy, SOAP UI vẫn tạo ra một cách chính xác các dịch vụ chế nhạo, tuy nhiên, khi tôi cố gắng thêm một Reference Service, lỗi này được ném trong phát hiện dịch vụ:

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: Tôi đã sử dụng Fiddler để kiểm tra http lưu lượng truy cập khi cố tạo proxy, như được đề xuất trong câu trả lời. Trong quá trình tạo, 500 lỗi máy chủ nội bộ xuất hiện trên Fiddler khi cố gắng truy cập url mockService, phản hồi từ máy chủ là "Thiếu hoạt động cho soapAction [null] và phần tử cơ thể [null] với phiên bản SOAP [SOAP 1.2]".

Đây là, hiện tại, WSDL tôi đang sử dụng để tạo 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> 

Tôi đã tải mỗi XSD đơn liên quan và xuất bản chúng trên một máy chủ nào, tôi cũng đã thay đổi schemaLocations để họ trỏ đến địa chỉ trên máy chủ công cộng này, tuy nhiên , vấn đề dường như liên quan đến cấu trúc WSDL.

+0

Để cập nhật, có vẻ như tiêu đề loại nội dung không được đặt chính xác, văn bản/html thay vì (ứng dụng/xà phòng + xml; charset = utf-8), mặc dù tải trọng trông giống như phong bì xà phòng. Ngoài ra, máy chủ đang ném (500) Lỗi Máy chủ Nội bộ. Bạn có quyền truy cập vào các lỗi trên máy chủ đó không? – Dijkgraaf

+0

@Dijkgraaf Lỗi loại nội dung hoàn toàn mất phương hướng cho tôi, vì khi tôi chỉ đưa lược đồ vào thì không có vấn đề gì với nó. Đáng buồn là tôi đã không truy cập để xem lỗi trên máy chủ từ xa. – Bardo

+0

Một câu hỏi nhỏ, đã cố gắng để xem điều gì xảy ra khi bạn cố gắng kết nối với một lược đồ thử nghiệm cục bộ? một lược đồ trong cùng một vị trí như lược đồ có vấn đề? Câu hỏi cơ bản là, Có phải vấn đề khi truy cập lược đồ nói chung hay lược đồ cụ thể này không? Tôi biết nó sẽ không giải quyết được vấn đề, nhưng nó sẽ bản địa hoá vấn đề – user3569147

Trả lời

1

Vấn đề chính trước khi cập nhật của bạn phải là cú pháp của bạn sai. Nơi bạn nói <schema xmlns="urn:oasis:names:tc:dss:1.0:core:schema"> công cụ đang chờ <schema xmlns="http://www.w3.org/2001/XMLSchema">. Để chỉ cần nhập một tệp XSD bên ngoài, không gian tên XML mặc định ở trên sửa chữa tất cả những gì bạn cần.

Nhập/bao gồm lược đồ có thể khá lộn xộn; cho những trường hợp đó, khi một người đặt chúng vào trong WSDL, như bạn đã gợi ý, rất dễ mắc lỗi, vì nó không phải là một trường hợp đơn giản chỉ cần cắt và dán. Ví dụ: một số công cụ có thể gặp sự cố khi xử lý các tham chiếu ban đầu được dựa trên xsd: include; tắc kè hoa bao gồm không thể được sao chép bên trong WSDL; và tất cả các xsd của bạn: nhập khẩu PHẢI KHÔNG sử dụng thuộc tính schemaLocation.

Để khắc phục sự cố liên quan đến tham chiếu bị hỏng, tôi khuyên bạn nên sử dụng trình gỡ rối HTTP, chẳng hạn như Fiddler. Nó sẽ cho bạn biết ít nhất những gì bạn tham khảo quên để làm sạch, hoặc bất kỳ tiêu đề HTTP rằng giải pháp giả của bạn không được thiết lập đúng.

Nếu phần trên vẫn để lại cho bạn một số câu hỏi, bạn sẽ phải đăng WSDL đã sửa đổi của mình.

+0

Tôi đã thêm WSDL hoàn chỉnh. Tôi đã kiểm tra Fiddler trong khi tham khảo dịch vụ và tôi nhận được lỗi sau: "Thiếu hoạt động cho soapAction [null] và phần tử cơ thể [null] với SOAP Version [SOAP 1.2]" – Bardo

+0

@Bardo, bạn phải sửa WSDL theo đề xuất đầu tiên của tôi . Đảm bảo rằng không gian tên của phần tử lược đồ là 'http: // www.w3.org/2001/XMLSchema' nó không thể/không hoạt động theo cách bạn có. –

+0

Tôi cũng đã làm điều đó, nhưng không thay đổi bất cứ điều gì. Lỗi tương tự. Tôi đã phản ánh sự thay đổi về đoạn mã của câu hỏi. – Bardo

Các vấn đề liên quan