从哪里开始使用 WCF 和 wsdl 文件?

发布于 2025-01-08 02:12:27 字数 13954 浏览 0 评论 0原文

我需要创建一个服务供客户端使用/消费(我认为消费是正确的术语)。

我是 WCFweb 服务 的新手。

我已经完成了大部分教程并且了解了一些事情是如何运作的。

现在我有了这个 wsdl 文件:

    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                  xmlns:tns="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService" 
                  xmlns:s="http://www.w3.org/2001/XMLSchema" 
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  targetNamespace="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" 
              targetNamespace="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService">
      <s:element name="ChangePassword">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="oldPassword" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="newPassword" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ChangePasswordResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ChangePasswordResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCampaignSchedulePlacements">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCampaignSchedulePlacementsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetCampaignSchedulePlacementsResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ConfirmDownload">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
            <s:element minOccurs="1" maxOccurs="1" name="dateOfLatestRecordRecieved" type="s:dateTime"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ConfirmDownloadResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ConfirmDownloadResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadCampaignSchedulePlacements">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="xml" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadCampaignSchedulePlacementsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UploadCampaignSchedulePlacementsResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="ChangePasswordSoapIn">
    <wsdl:part name="parameters" element="tns:ChangePassword"/>
  </wsdl:message>
  <wsdl:message name="ChangePasswordSoapOut">
    <wsdl:part name="parameters" element="tns:ChangePasswordResponse"/>
  </wsdl:message>
  <wsdl:message name="GetCampaignSchedulePlacementsSoapIn">
    <wsdl:part name="parameters" element="tns:GetCampaignSchedulePlacements"/>
  </wsdl:message>
  <wsdl:message name="GetCampaignSchedulePlacementsSoapOut">
    <wsdl:part name="parameters" element="tns:GetCampaignSchedulePlacementsResponse"/>
  </wsdl:message>
  <wsdl:message name="ConfirmDownloadSoapIn">
    <wsdl:part name="parameters" element="tns:ConfirmDownload"/>
  </wsdl:message>
  <wsdl:message name="ConfirmDownloadSoapOut">
    <wsdl:part name="parameters" element="tns:ConfirmDownloadResponse"/>
  </wsdl:message>
  <wsdl:message name="UploadCampaignSchedulePlacementsSoapIn">
    <wsdl:part name="parameters" element="tns:UploadCampaignSchedulePlacements"/>
  </wsdl:message>
  <wsdl:message name="UploadCampaignSchedulePlacementsSoapOut">
    <wsdl:part name="parameters" element="tns:UploadCampaignSchedulePlacementsResponse"/>
  </wsdl:message>
  <wsdl:portType name="ShopriteIntegrationTestoap">
    <wsdl:operation name="ChangePassword">
      <wsdl:input message="tns:ChangePasswordSoapIn"/>
      <wsdl:output message="tns:ChangePasswordSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <wsdl:input message="tns:GetCampaignSchedulePlacementsSoapIn"/>
      <wsdl:output message="tns:GetCampaignSchedulePlacementsSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <wsdl:input message="tns:ConfirmDownloadSoapIn"/>
      <wsdl:output message="tns:ConfirmDownloadSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <wsdl:input message="tns:UploadCampaignSchedulePlacementsSoapIn"/>
      <wsdl:output message="tns:UploadCampaignSchedulePlacementsSoapOut"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ShopriteIntegrationTestoap" type="tns:ShopriteIntegrationTestoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ChangePassword">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ChangePassword" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/GetCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ConfirmDownload" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/UploadCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ShopriteIntegrationServiceSoap12" type="tns:ShopriteIntegrationServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ChangePassword">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ChangePassword" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/GetCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ConfirmDownload" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/UploadCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ShopriteIntegrationService">
    <wsdl:port name="ShopriteIntegrationServiceSoap" binding="tns:ShopriteIntegrationTestoap">
      <soap:address location="http://jhbweb01/IntegrationTest/ShopriteIntegrationService.asmx"/>
    </wsdl:port>
    <wsdl:port name="ShopriteIntegrationServiceSoap12" binding="tns:ShopriteIntegrationServiceSoap12">
      <soap12:address location="http://jhbweb01/IntegrationTest/ShopriteIntegrationService.asmx"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

这就是我得到的:

[ServiceContract]
public interface IShopriteService
{
    [OperationContract]
    void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

    [OperationContract]
    string ChangePasswordResponse();

    [OperationContract]
    void GetCampaignSchedulePlacements(string serviceProviderGuid, string password);

    [OperationContract]
    string GetCampaignSchedulePlacementsResponse();

    [OperationContract]
    void ConfirmDownload(string serviceProviderGuid, string password, DateTime dateOfLatestRecordRecieved);

    [OperationContract]
    string ConfirmDownloadResponse();

    [OperationContract]
    void UploadCampaignSchedulePlacements(string serviceProviderGuid, string password, string xml);

    [OperationContract]
    string UploadCampaignSchedulePlacementsResponse();
}

实现的方法:

public class ShopriteService : IShopriteService
    {
    public void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword)
    {
        throw new NotImplementedException();
    }

    public string ChangePasswordResponse()
    {
        throw new NotImplementedException();
    }

    public void GetCampaignSchedulePlacements(string serviceProviderGuid, string password)
    {
        throw new NotImplementedException();
    }

    public string GetCampaignSchedulePlacementsResponse()
    {
        throw new NotImplementedException();
    }

    public void ConfirmDownload(string serviceProviderGuid, string password, DateTime dateOfLatestRecordRecieved)
    {
        throw new NotImplementedException();
    }

    public string ConfirmDownloadResponse()
    {
        throw new NotImplementedException();
    }

    public void UploadCampaignSchedulePlacements(string serviceProviderGuid, string password, string xml)
    {
        throw new NotImplementedException();
    }

    public string UploadCampaignSchedulePlacementsResponse()
    {
        throw new NotImplementedException();
    }
}

我不知道我是否走在正确的轨道上...

解释一下,wsdl 文件。

我该去哪里?

我可以使用某种结构吗? (如MVVM结构)

I need to create a service for a client to use/consume(I think consume is the right terminology).

I am a completely newbie to WCF and web services.

I have done most of the tutorials and understand a bit how everything works.

Now i have this wsdl file:

    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                  xmlns:tns="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService" 
                  xmlns:s="http://www.w3.org/2001/XMLSchema" 
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  targetNamespace="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" 
              targetNamespace="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService">
      <s:element name="ChangePassword">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="oldPassword" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="newPassword" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ChangePasswordResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ChangePasswordResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCampaignSchedulePlacements">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetCampaignSchedulePlacementsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetCampaignSchedulePlacementsResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ConfirmDownload">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
            <s:element minOccurs="1" maxOccurs="1" name="dateOfLatestRecordRecieved" type="s:dateTime"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="ConfirmDownloadResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="ConfirmDownloadResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadCampaignSchedulePlacements">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="serviceProviderGuid" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="xml" type="s:string"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadCampaignSchedulePlacementsResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UploadCampaignSchedulePlacementsResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="ChangePasswordSoapIn">
    <wsdl:part name="parameters" element="tns:ChangePassword"/>
  </wsdl:message>
  <wsdl:message name="ChangePasswordSoapOut">
    <wsdl:part name="parameters" element="tns:ChangePasswordResponse"/>
  </wsdl:message>
  <wsdl:message name="GetCampaignSchedulePlacementsSoapIn">
    <wsdl:part name="parameters" element="tns:GetCampaignSchedulePlacements"/>
  </wsdl:message>
  <wsdl:message name="GetCampaignSchedulePlacementsSoapOut">
    <wsdl:part name="parameters" element="tns:GetCampaignSchedulePlacementsResponse"/>
  </wsdl:message>
  <wsdl:message name="ConfirmDownloadSoapIn">
    <wsdl:part name="parameters" element="tns:ConfirmDownload"/>
  </wsdl:message>
  <wsdl:message name="ConfirmDownloadSoapOut">
    <wsdl:part name="parameters" element="tns:ConfirmDownloadResponse"/>
  </wsdl:message>
  <wsdl:message name="UploadCampaignSchedulePlacementsSoapIn">
    <wsdl:part name="parameters" element="tns:UploadCampaignSchedulePlacements"/>
  </wsdl:message>
  <wsdl:message name="UploadCampaignSchedulePlacementsSoapOut">
    <wsdl:part name="parameters" element="tns:UploadCampaignSchedulePlacementsResponse"/>
  </wsdl:message>
  <wsdl:portType name="ShopriteIntegrationTestoap">
    <wsdl:operation name="ChangePassword">
      <wsdl:input message="tns:ChangePasswordSoapIn"/>
      <wsdl:output message="tns:ChangePasswordSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <wsdl:input message="tns:GetCampaignSchedulePlacementsSoapIn"/>
      <wsdl:output message="tns:GetCampaignSchedulePlacementsSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <wsdl:input message="tns:ConfirmDownloadSoapIn"/>
      <wsdl:output message="tns:ConfirmDownloadSoapOut"/>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <wsdl:input message="tns:UploadCampaignSchedulePlacementsSoapIn"/>
      <wsdl:output message="tns:UploadCampaignSchedulePlacementsSoapOut"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ShopriteIntegrationTestoap" type="tns:ShopriteIntegrationTestoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ChangePassword">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ChangePassword" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/GetCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ConfirmDownload" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <soap:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/UploadCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ShopriteIntegrationServiceSoap12" type="tns:ShopriteIntegrationServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="ChangePassword">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ChangePassword" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetCampaignSchedulePlacements">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/GetCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="ConfirmDownload">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/ConfirmDownload" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadCampaignSchedulePlacements">
      <soap12:operation soapAction="http://196.37.139.18/IntegrationTest/ShopriteIntegrationService/UploadCampaignSchedulePlacements" style="document"/>
      <wsdl:input>
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ShopriteIntegrationService">
    <wsdl:port name="ShopriteIntegrationServiceSoap" binding="tns:ShopriteIntegrationTestoap">
      <soap:address location="http://jhbweb01/IntegrationTest/ShopriteIntegrationService.asmx"/>
    </wsdl:port>
    <wsdl:port name="ShopriteIntegrationServiceSoap12" binding="tns:ShopriteIntegrationServiceSoap12">
      <soap12:address location="http://jhbweb01/IntegrationTest/ShopriteIntegrationService.asmx"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

This is what i got so for:

[ServiceContract]
public interface IShopriteService
{
    [OperationContract]
    void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

    [OperationContract]
    string ChangePasswordResponse();

    [OperationContract]
    void GetCampaignSchedulePlacements(string serviceProviderGuid, string password);

    [OperationContract]
    string GetCampaignSchedulePlacementsResponse();

    [OperationContract]
    void ConfirmDownload(string serviceProviderGuid, string password, DateTime dateOfLatestRecordRecieved);

    [OperationContract]
    string ConfirmDownloadResponse();

    [OperationContract]
    void UploadCampaignSchedulePlacements(string serviceProviderGuid, string password, string xml);

    [OperationContract]
    string UploadCampaignSchedulePlacementsResponse();
}

Implemented methods:

public class ShopriteService : IShopriteService
    {
    public void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword)
    {
        throw new NotImplementedException();
    }

    public string ChangePasswordResponse()
    {
        throw new NotImplementedException();
    }

    public void GetCampaignSchedulePlacements(string serviceProviderGuid, string password)
    {
        throw new NotImplementedException();
    }

    public string GetCampaignSchedulePlacementsResponse()
    {
        throw new NotImplementedException();
    }

    public void ConfirmDownload(string serviceProviderGuid, string password, DateTime dateOfLatestRecordRecieved)
    {
        throw new NotImplementedException();
    }

    public string ConfirmDownloadResponse()
    {
        throw new NotImplementedException();
    }

    public void UploadCampaignSchedulePlacements(string serviceProviderGuid, string password, string xml)
    {
        throw new NotImplementedException();
    }

    public string UploadCampaignSchedulePlacementsResponse()
    {
        throw new NotImplementedException();
    }
}

I have no idea if i am even on the right track...

Explain a bit, what is going on in the wsdl file.

Where do i go from here?

Is there a certain structure i can use? (like the MVVM structure)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夏至、离别 2025-01-15 02:12:27

请参阅有关如何创建 WCF 服务并通过客户端应用程序使用它的文章:

  1. 创建并使用WCF服务

  2. < a href="http://msdn.microsoft.com/en-us/library/bb655893%28v=vs.90%29.aspx" rel="nofollow">使用WCF 服务

  3. 托管和使用 WCF 服务

  4. 用于创建和使用 WCF 服务的视频

Please refer to the articlesthat shows on how to create your WCF service and consume it with a client application:

  1. Create and consume WCF service

  2. Consume a WCF Service

  3. Hosting and consuming WCF Service

  4. Video to create and consume WCF Service

夏有森光若流苏 2025-01-15 02:12:27

WSDL 只不过是对服务的描述,它允许客户端将其作为 Web 服务来使用。
所以:wsdl 反映了您的界面 ->你的接口是由一个类实现的。最后一步是编写接口方法的逻辑(即:ChangePassword 方法)。
另外,我觉得 ServiceContract 中有些问题,让我们以 ChangePassword 方法为例:
因为该方法将返回一个字符串,所以您可以只定义以下内容:

[OperationContract]
string ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

而不是

[OperationContract]
void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

[OperationContract]
string ChangePasswordResponse();

所以基本上将您的 WCF(或 Ws)视为传统的类库。它只允许通过 HTTP/SOAP 调用和引用

The WSDL is nothing more than a description of your service and it allow clients to consume it as a web service.
So: the wsdl reflects your interface -> your interface is implemented by a class. Last step will be to write the logic for your interface methods (ie: the ChangePassword method).
Also, I got the impression something is wrong in the ServiceContract, let's take the ChangePassword method for instance:
Because the method will return a string you can just define the following :

[OperationContract]
string ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

instead of

[OperationContract]
void ChangePassword(string serviceProviderGuid, string oldPassword, DateTime newPassword);

[OperationContract]
string ChangePasswordResponse();

So basically think of your WCF (or Ws) as a traditional class library. It only allows to be called and referenced over HTTP/SOAP

青春如此纠结 2025-01-15 02:12:27

我想说你已经在路上了!您可以使用任何您喜欢的设计模式来解决手头的问题。我通常将服务层设置得尽可能薄,并通过某种接口(最常见的是外观)简单地抽象出底层逻辑,但这并不是说在您的情况下这是正确的。

对于 WSDL,它本质上是通过描述与服务公开的类型和端点相关的一组抽象来定义您的服务。您可以在 W3C 阅读更多详细信息。通过 WSDL 客户端可以获得有关使用它所需的服务的信息。

I'd say you are on your way! You can use any design pattern you like the solves the problem at hand. I normally set up my service layer to be as thin as possible and simply abstract away the underlying logic through an interface of some sort, most often a Façade which isn't to say that is the correct thing in your case.

As to the WSDL, it's essentially defining your service by describing a set of abstractions relating to the types and endpoints your service exposes. You can read more details over at W3C. Through the WSDL clients can obtain information about your service needed to use it.

携君以终年 2025-01-15 02:12:27

您可以使用 XML 间谍来了解 WSDL 如何映射到 WCF 服务以及 XSD 如何映射到数据契约
http://www.altova.com/simpledownload2c.html?gclid=CJeFgKGEr64CFSgntAod9m4oSA

You could use XML spy to understand the how WSDL mapped to WCF services and XSDs are mapped to Data Contract
http://www.altova.com/simpledownload2c.html?gclid=CJeFgKGEr64CFSgntAod9m4oSA

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文