Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在WPF中使用web服务_C#_Wpf_Web Services_Soap - Fatal编程技术网

C# 在WPF中使用web服务

C# 在WPF中使用web服务,c#,wpf,web-services,soap,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 Servi

我想在我的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);
servicerence1.WebService\u ISB\u SAB\u接口\u ExtSoapClient soap=
新服务引用1.WebService_ISB_SAB_Interface_ExtSoapClient();
ServiceReference1.RequestRequestObj=新的ServiceReference1.Request();
requestObj.UserID=“1001002_s12345344h”;
requestObj.DomainName=“XXXX”;
requestObj.MessageContent=“”+
"" +
“S1234534H”+
"2015" +
“C”+
"";
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>

它抛出异常作为

mscorlib.dll中发生“System.ServiceModel.EndpointNotFoundException”类型的未处理异常

其他信息:在侦听时没有可以接受消息的终结点。这通常是由于地址或SOAP操作不正确造成的。有关详细信息,请参阅InnerException(如果存在)。”


请帮助解决。

您甚至一次都没有调用web服务。您只是在创建一组新对象。通常,生成的服务引用有一个
…Client
类,该类具有您可以调用的方法。可能是您的
soap
变量。打电话给我,谢谢你,伙计。调用方法am GET后,没有端点侦听,我无法访问服务器。你能解释一下连接服务器的步骤吗?你没有从所述服务器获取WSDL吗?是的,我获取了WSDL并将其添加到应用程序中。要使用web服务,是否需要在本地服务器上安装IIS