本文介绍了如何将请求发送到共享文件夹中的wsdl? (ASP.NET C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先我构建了一个客户端应用程序。



我已经使用wsdl链接添加了服务引用。



现在,如何创建对象并发送请求?



我尝试了什么:



我必须使用2个字符串作为输入从WINDOWS CONSOLE APP向wsdl发送请求



任何帮助都会感谢

First I have built a client application.

I've added a service reference by using the wsdl link.

Now, how to create the object and send request ??

What I have tried:

I have to send a request to the wsdl from an WINDOWS CONSOLE APP using 2 strings as input

any help would be appreciated

推荐答案

[ServiceContract(Namespace = "http:://company.url/area/concern/year/month/day")]
public interface IHWService {
    [OperationContract]
    string GetMessage();
}

public class HelloWorldService : IHWService{
    public string GetMessage(){
         return "Hello";
    }
}

//... in other assembly, for development self host console application
class Program{
    static void Main(string[] args){
       using(var host = new ServiceHost(typeof(HelloWorldService))){
         host.Open();
            Console.ReadLine();
        }
    }
}



为了实现这一目标,该主机的配置文件将指定类似
$的内容b $ b


To get that working, your config file of that host will specify something like

<system.serviceModel>
    <services>
        <service name="HWService" behviourConfiguration="yourservicebehaviour">
            <endpoint address="" contrac="IHWService" binding="basicHttpVinding" />
            <host>
                <baseAddresses>
                    <add baseAddress="http://localhost:3000/" />
    // ...





现在新建代理并使用它就像
$ b一样简单$ b



Now newing up the proxy and using it is as simple as

using(var proxy = new HWService.WhatYouCalledYourReferenceClient()){
     Console.WriteLine(proxy.GetMessage());
}





因为你的那个地方的配置需要有它的版本system.servicemodel thingies abc(Address,Binding ,配置)镜像主机。



of cause your config of that place needs to have it's version of system.servicemodel thingies abc (Address, Binding, Configuration) to mirror the host.


这篇关于如何将请求发送到共享文件夹中的wsdl? (ASP.NET C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:37