Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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# 连接到未知的SOAP Web服务_C#_Web Services_Soap_Axis - Fatal编程技术网

C# 连接到未知的SOAP Web服务

C# 连接到未知的SOAP Web服务,c#,web-services,soap,axis,C#,Web Services,Soap,Axis,我想在C#中构建一个应用程序,它连接到Apache AXIS web服务,并通过SOAP执行以下操作 登录到服务器 将字符串数据发布到服务器 接收并显示服务器响应 这是最难的部分。我无权访问服务器,也不知道.JWS文件在服务器上的位置。我能够在web浏览器中访问WSDL文件,因此我知道存在“登录”操作以及接收数据的操作 我已尝试通过URL访问web服务,但始终收到以下消息: 你好,这里是AXIS服务 也许会有一个 正在此处调用服务 总之,当我只有WSDL文件的URL时,我是否可以连接到此web服

我想在C#中构建一个应用程序,它连接到Apache AXIS web服务,并通过SOAP执行以下操作

  • 登录到服务器
  • 将字符串数据发布到服务器
  • 接收并显示服务器响应
  • 这是最难的部分。我无权访问服务器,也不知道.JWS文件在服务器上的位置。我能够在web浏览器中访问WSDL文件,因此我知道存在“登录”操作以及接收数据的操作

    我已尝试通过URL访问web服务,但始终收到以下消息:

    你好,这里是AXIS服务

    也许会有一个 正在此处调用服务

    总之,当我只有WSDL文件的URL时,我是否可以连接到此web服务?是否可以通过URL访问web服务

    感谢您

    请参阅以获取起点

    使用该工具,并生成web服务的客户端代理

    正在运行
    svcutil.exehttp://url.to/webservice?WSDL _wsdl.wsdl/language:C#
    应该生成可以在C#项目中使用的代理类,您可以调用该服务,例如

      BasicHttpBinding myBinding = new BasicHttpBinding(); //might not even need these
                        // 2 lines if you ran svcutil.exe directly on the web service URL
      EndpointAddress myEndpoint = new EndpointAddress("http://url.to/webservice");
      TestClient client = new TestClient(myBinding,myEndpoint); //the generated classes
                                                                // svcutil.exe created
      client.SomeOperation(42); // call an SomeOperation of the web service 
    

    谢谢大家的帮助。回顾这个问题,我可以看出我是多么的困惑。以下是我遵循的解决方案

    假设您知道希望连接到的服务的WSDL文件的URL,那么只需执行以下操作

  • 启动Visual Studio
  • 在顶部工具栏上导航到数据->添加新数据源,然后在新建对话框中选择服务
  • 在地址栏中,输入wsdl文件的URL(示例:)
  • 在对话框底部附近,将名称空间更改为与项目相关的内容(例如:sampleService)
  • 现在VisualStudio应该为您编译客户端代理,您可以使用这些代理访问服务器上的web服务。要访问其中一个服务,只需从类中创建一个新对象

        //Example
        sampleService.ClassName test = new sampleService.ClassName();
    
           test.displayName("Jack");