可以使用Svcutil.exe生成Web服务和WCF服务的客户端代理接口及配置文件也就是说只要你服务端写好了程序,可以直接生产客户端wcf配置文件如下,使用svcutil.exe指令 svcutil.exe [/n:] /out:D:\>svcutil /n:http://eric.org,eric.org http://127.0.0.1:8988/calculatorservice/metadata /out:d:\client.cs Microsoft (R) Service Model Metadata Tool[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]Copyright (c) Microsoft Corporation. All rights reserved.Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/metadata' using WS-Metadata Exchange or DISCO.Generating files...d:\client.csD:\output.config+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++1) /n /namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)2) url读取WSDL服务定义的链接3)/out:输出文件的路径文件名。
个人觉得要用实体类,拷贝到客户端添加dll用吧。
Microsoft (R) Service Model Metadata Tool[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]Copyright (c) Microsoft Corporation. All rights reserved.Attempting to download metadata from 'http://127.0.0.1:8988/calculatorservice/metadata' using WS-Metadata Exchange or DISCO.Generating files...d:\client.csD:\output.config+++++++++++++++指令解释++++++++++++++++++++++++++++++++++++1) /n /namespace: - A mapping from a WSDL or XML Schema targetNamespace to a CLR namespace. Using the '*' for the targetNamespace maps all targetNamespaces without an explicit mapping to that CLR namespace. Default: derived from the target namespace of the schema document for Data Contracts. The default namespace is used for all other generated types. (Short Form: /n)2) url读取WSDL服务定义的链接3)/out:输出文件的路径文件名。