Tôi đã tạo WSDL bằng tay chỉ có một thao tác không có tham số đầu vào và không có tham số đầu ra.Bao gồm Loại lược đồ trong tệp WSDL
Tôi nhận được lỗi sau khi tôi cố gắng tạo ra một khách hàng từ WSDL này:
Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter Error: Schema with target namespace ' http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/ ' could not be found. XPath to Error Source: //wsdl:definitions[@targetNamespace=' http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/ ']/wsdl:portType[@name='GAMEAssociateIntf'] C:\toolbox\BlueTest\BloodRedTest\BloodRedTest\Service
Các types
(được sử dụng trong các khách hàng) cần phải được tạo ra từ hiện tại XML trong WSDL. Tôi nghĩ rằng, trong khi thêm tham chiếu dịch vụ, công cụ không tạo ra nó do một số lỗi trong XML. xsd có vẻ là vấn đề.
Cần thay đổi gì trong WSDL để tạo proxy?
Lưu ý: Tôi đang cố gắng bao gồm các loại xml được xác định trong chính WSDL. [Tôi không cần một tập tin riêng biệt cho schema defenition]
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="GAMEAssociate"
targetNamespace="http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/"
xmlns:tns="http://www.xmlns.mycompany.com/GAME/service/Associate/1.1/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
>
<types>
<xsd:schema>
</xsd:schema>
<xsd:element name="myData">
<xsd:complexType />
</xsd:element>
<xsd:element name="myDataResponse">
<xsd:complexType />
</xsd:element>
</types>
<message name="getAllVicePresidentsRequest">
<part element="tns:myData" name="getAllVicePresidentsRequest"/>
</message>
<message name="getAllVicePresidentsResponse">
<part element="tns:myDataResponse" name="getAllVicePresidentsResponse"/>
</message>
<portType name="GAMEAssociateIntf">
<operation name="getAllVicePresidents">
<input message="tns:getAllVicePresidentsRequest"/>
<output message="tns:getAllVicePresidentsResponse"/>
</operation>
</portType>
<binding name="GAMEAssociateIntfBinding" type="tns:GAMEAssociateIntf">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getAllVicePresidents">
<soap:operation soapAction="http://www.xmlns.mycompany.com/GAME/wsdl/AssociateIntf/1.4/getAllVicePresidentsRequest"
style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="GAMEAssociate">
<port binding="tns:GAMEAssociateIntfBinding" name="GAMEAssociateSOAP">
<soap:address location="http://localhost:8014/associateservice/GAMEAssociate.svc"/>
</port>
</service>
</definitions>
THAM KHẢO:
- WSDL - no input - best practice
- What does this WCF error mean: "Custom tool warning: Cannot import wsdl:portType"
- Writing a WSDL 1.1 Web Service Contract by Hand
- Writing Contract-First Web Services
- generate wcf server code from wsdl files
- How to get wsdl input and output names to appear
- Inline Schema
- Hand rolled SOAP request
Bạn nói không có tham số đầu vào và không có tham số đầu ra. Nhưng, tôi có thể thấy hoạt động của bạn là xác định đầu vào và tham số đầu ra. – IndoKnight
@Indoknight Các tin nhắn này trống. Tôi nghĩ, chúng tôi cần những thông điệp như được giải thích trong http://stackoverflow.com/questions/1108736/wsdl-no-input-best-practice – Lijo
Tôi chưa từng làm việc trên C#, nhưng WSDL có vẻ ổn. Tôi đã kiểm tra SOAPUI. – IndoKnight