在WPF中使用Web服务

时间:2015-04-09 06:45:24

标签: c# wpf web-services soap

我想在我的WPF应用程序中使用Web服务(WSDL)。

我已将其作为服务参考添加到我的应用中。

调用它的代码如下:

ServiceReference1.WebService_ISB_SAB_Interface_ExtSoapClient soap = 
    new ServiceReference1.WebService_ISB_SAB_Interface_ExtSoapClient();

ServiceReference1.Request requestObj = new ServiceReference1.Request();
requestObj.UserID = "1001002_S1234534H";
requestObj.DomainName = "XXXX";
requestObj.MessageContent = "<PcpsChronicBalanceEnquiry>" +
                            "<Request>" +
                            "<PatientNric>S1234534H</PatientNric>" +
                            "<Year>2015</Year>" +
                            "<BillType>C</BillType>" +
                            "</PcpsChronicBalanceEnquiry>";

var ss = soap.Operation_1(requestObj);

但我得到任何回应。

App.Config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="WebService_ISB_SAB_Interface_ExtSoap">
                <security mode="Transport">
                    <transport clientCredentialType="Windows" />
                </security>
            </binding>
            <binding name="WebService_ISB_SAB_Interface_ExtSoap1" />
            <binding      name="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap" />
        </basicHttpBinding>
    </bindings>

    <client>
        <endpoint address="https://u103-vw-bzap01.tst.cleo.sg:9320/ws/ISB_SAB_Interface_Ext_Proxy/ISB_SAB_Interface_Ext.asmx"
            binding="basicHttpBinding" bindingConfiguration="WebService_ISB_SAB_Interface_ExtSoap"
            contract="ServiceReference1.WebService_ISB_SAB_Interface_ExtSoap"
            name="WebService_ISB_SAB_Interface_ExtSoap" />
        <endpoint address="http://192.168.9.34/ISB_SAB_Interface_Proxy/ISB_SAB_Orchestration_Orchestration_1_Port_SAB_Request.asmx"
            binding="basicHttpBinding" bindingConfiguration="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap"
            contract="ServiceReference2.ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap"
            name="ISB_SAB_Orchestration_Orchestration_1_Port_SAB_RequestSoap" />
    </client>
</system.serviceModel>

它会抛出异常

  

&#34;未处理的类型&#39; System.ServiceModel.EndpointNotFoundException&#39;发生在mscorlib.dll

     

其他信息:https://u103-vw-bzap01.tst.cleo.sg:9320/ws/ISB_SAB_Interface_Ext_Proxy/ISB_SAB_Interface_Ext.asmx没有可以接受该消息的端点。这通常是由错误的地址或SOAP操作引起的。有关详细信息,请参阅InnerException(如果存在)。&#34;

请帮忙解决。

0 个答案:

没有答案