今年主要做自动化测试技术支持工作,最近一直在做接口自动化这块,前些天在研究将web页面模拟http进行接口自动化,这周杭州那边想测试WCF服务,所以这两天一直在探索。遇到的第一个问题就是服务参数传参序列化的问题,怎么让python这边创建的对象能被WCF识别到。正好在大学的时候也学了WCF,不过一直都没用过,这次算是重温一下,用的都是一些WCF基础。

一、WCF服务准备

1.定义契约Contract

这里IServiceDemo.cs定义了服务契约IServiceDemo,并定义了几个操作契约OperationContract,5个操作契约传的参数不同,用来做测试,同时自定义了两个数据契约DataContract.并在ServiceDemo.svc中实现了上面操作契约。

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.ServiceModel;
  6. using System.ServiceModel.Web;
  7. using System.Text;
  8.  
  9. namespace WcfServiceDemo
  10. {
  11. // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IService1”。
  12. [ServiceContract]
  13. public interface IServiceDemo
  14. {
  15.  
  16. [OperationContract]
  17. string GetSimpleData(string value);
  18.  
  19. [OperationContract]
  20. List<Item> GetListData(List<Item> items);
  21.  
  22. [OperationContract]
  23. Item GetModelData(Item item);
  24.  
  25. [OperationContract]
  26. Dictionary<string,string> GetDicData(Dictionary<string,string> dic);
  27.  
  28. [OperationContract]
  29. Dictionary<string, Dictionary<string,int>[]> GetDicDicData(Dictionary<string, Dictionary<string, int>[]> dic);
  30.  
  31. }
  32. [DataContract]
  33. public class ItemMenu
  34. {
  35. [DataMember]
  36. public string Name { get; set; }
  37. [DataMember]
  38. public string Value { get; set; }
  39. }
  40. [DataContract]
  41. public class Item
  42. {
  43. [DataMember]
  44. public List<ItemMenu> ItemMenus { get; set; }
  45. }
  46.  
  47. }
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Serialization;
  5. using System.ServiceModel;
  6. using System.ServiceModel.Web;
  7. using System.Text;
  8.  
  9. namespace WcfServiceDemo
  10. {
  11. // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“Service1”。
  12. // 注意: 为了启动 WCF 测试客户端以测试此服务,请在解决方案资源管理器中选择 Service1.svc 或 Service1.svc.cs,然后开始调试。
  13. public class ServiceDemo : IServiceDemo
  14. {
  15.  
  16. public string GetSimpleData(string value)
  17. {
  18. return value;
  19. }
  20. public List<Item> GetListData(List<Item> items)
  21. {
  22. return items;
  23. }
  24. public Item GetModelData(Item item)
  25. {
  26. return item;
  27. }
  28. public Dictionary<string, string> GetDicData(Dictionary<string, string> dic)
  29. {
  30. return dic;
  31. }
  32. public Dictionary<string, Dictionary<string, int>[]> GetDicDicData(Dictionary<string, Dictionary<string, int>[]> dic)
  33. {
  34. return dic;
  35. }
  36.  
  37. }
  38. }

2.定义宿主

WCF宿主可以有多种方式,这里用了控制台应用程序来作为宿主,主要是想着做demo,可以发给测试,用控制台不用像iis那样部署了。在控制台应用程序的App.config中配置wcf服务。

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3. <system.serviceModel>
  4. <services>
  5. <service name="WcfServiceDemo.ServiceDemo" behaviorConfiguration="ServiceDemoBehavior" >
  6. <endpoint address="" contract="WcfServiceDemo.IServiceDemo" binding="basicHttpBinding"></endpoint>
  7. <host>
  8. <baseAddresses>
  9. <add baseAddress="http://localhost:8001/ServiceDemo/"></add>
  10. </baseAddresses>
  11. </host>
  12. </service>
  13. </services>
  14. <behaviors>
  15. <serviceBehaviors>
  16. <behavior name="ServiceDemoBehavior">
  17. <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
  18. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
  19. <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
  20. <serviceDebug includeExceptionDetailInFaults="false"/>
  21. </behavior>
  22. </serviceBehaviors>
  23. </behaviors>
  24. <protocolMapping>
  25. <add binding="basicHttpsBinding" scheme="https" />
  26. </protocolMapping>
  27. <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  28. </system.serviceModel>
  29. <startup>
  30. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  31. </startup>
  32. </configuration>

3.启动服务

  1. static void Main(string[] args)
  2. {
  3. using (ServiceHost host = new ServiceHost(typeof(WcfServiceDemo.ServiceDemo)))
  4. {
  5. host.Open();
  6. Console.WriteLine("服务已开启");
  7. Console.Read();
  8. }
  9. }

4.出现的问题

在启动服务的时候,报了:HTTP 无法注册 URL http://+:8001/ServiceDemo/。进程不具有此命名空间的访问权限的错误。解决方法是VS2015用管理员打开就好了。

二.suds.client的使用

1.了解WCF

要调用WCF,首先得知道服务中有哪些参数,每个参数具体是什么类型。可以使用sud.client实例化client,然后打印出来看服务里面的内容。

  1. # -*- coding: utf-8 -*-
  2. import sys
  3. reload(sys)
  4. sys.setdefaultencoding('utf-8')
  5.  
  6. from suds.client import Client
  7.  
  8. if __name__ == '__main__':
  9.  
  10. client=Client('http://localhost:8001/ServiceDemo/?singleWsdl')
  11. print client
  12. # -----------------简单类型---------------------------
  13. result= client.service.GetSimpleData('')
  14. print result
  1. Service ( ServiceDemo ) tns="http://tempuri.org/"
  2. Prefixes (4)
  3. ns0 = "http://schemas.datacontract.org/2004/07/WcfServiceDemo"
  4. ns1 = "http://schemas.microsoft.com/2003/10/Serialization/"
  5. ns2 = "http://schemas.microsoft.com/2003/10/Serialization/Arrays"
  6. ns3 = "http://tempuri.org/"
  7. Ports (1):
  8. (BasicHttpBinding_IServiceDemo)
  9. Methods (5):
  10. GetDicData(ns2:ArrayOfKeyValueOfstringstring dic, )
  11. GetDicDicData(ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 dic, )
  12. GetListData(ns0:ArrayOfItem items, )
  13. GetModelData(ns0:Item item, )
  14. GetSimpleData(xs:string value, )
  15. Types (11):
  16. ns2:ArrayOfArrayOfKeyValueOfstringint
  17. ns0:ArrayOfItem
  18. ns0:ArrayOfItemMenu
  19. ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1
  20. ns2:ArrayOfKeyValueOfstringint
  21. ns2:ArrayOfKeyValueOfstringstring
  22. ns0:Item
  23. ns0:ItemMenu
  24. ns1:char
  25. ns1:duration
  26. ns1:guid

2.参数序列化

对于基础类型的参数可以直接传参,但复杂类型参数就比较麻烦了,怎么样在python定义的参数能在wcf服务端识别出来,也就是序列化反序列化的问题,例如GetDicDicData方法中要传递ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1类型的参数,在python中怎么定义呢,这个类型里面包含哪些属性,怎么实例化这个参数,可以使用client.factory.create('参数类型名')来创建,有时类型下面还有子类,所以在传参数时要弄清楚对象里面子类的数据类型,从根到叶子,而在实例化参数时需要从叶子到根来组装成对象。还有获取结果后获取解析的问题,这个把结果打印出来后可以一层一层的获取值。也可以调用last_received()方法,返回的是xml,然后用xpath解析。

  1. print client.factory.create('ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  2. print client.factory.create('ns2:KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  3. print client.factory.create('ns2:ArrayOfArrayOfKeyValueOfstringint')
  4. print client.factory.create('ns2:ArrayOfKeyValueOfstringint')
  5. print client.factory.create('ns2:KeyValueOfstringint')
  6. KeyValueOfstringint=client.factory.create('ns2:KeyValueOfstringint')
  7. KeyValueOfstringint.Key='cyw'
  8. KeyValueOfstringint.Value = 1
  9. ArrayOfKeyValueOfstringint=client.factory.create('ns2:ArrayOfKeyValueOfstringint')
  10. ArrayOfKeyValueOfstringint.KeyValueOfstringint=[KeyValueOfstringint]
  11. ArrayOfArrayOfKeyValueOfstringint=client.factory.create('ns2:ArrayOfArrayOfKeyValueOfstringint')
  12. ArrayOfArrayOfKeyValueOfstringint.ArrayOfKeyValueOfstringint=[ArrayOfKeyValueOfstringint]
  13. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = client.factory.create('ns2:KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  14. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.Key = 'cuiyw'
  15. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.Value = ArrayOfArrayOfKeyValueOfstringint
  16. ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = client.factory.create('ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  17. ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1

具体实现

  1. # -*- coding: utf-8 -*-
  2. import sys
  3. reload(sys)
  4. sys.setdefaultencoding('utf-8')
  5.  
  6. from suds.client import Client
  7.  
  8. if __name__ == '__main__':
  9.  
  10. client=Client('http://localhost:8001/ServiceDemo/?singleWsdl')
  11. print client
  12. # -----------------简单类型---------------------------
  13. result= client.service.GetSimpleData('')
  14. print result
  15.  
  16. # -----------------自定义类---------------------------
  17. print client.factory.create('ns0:Item')
  18. print client.factory.create('ns0:ArrayOfItemMenu')
  19. print client.factory.create('ns0:ItemMenu')
  20. ItemMenu=client.factory.create('ns0:ItemMenu')
  21. ItemMenu.Name='Cyw'
  22. ItemMenu.Value = 'Cuiyw'
  23. ArrayOfItemMenu= client.factory.create('ns0:ArrayOfItemMenu')
  24. ArrayOfItemMenu.ItemMenu=[ItemMenu,ItemMenu]
  25. Item=client.factory.create('ns0:Item')
  26. Item.ItemMenus=ArrayOfItemMenu
  27. result= client.service.GetModelData(Item)
  28. print result
  29. print result.ItemMenus.ItemMenu[0].Name
  30. print result.ItemMenus.ItemMenu[0].Value
  31.  
  32. # -----------------自定义类列表---------------------------
  33. print client.factory.create('ns0:ArrayOfItem')
  34. ArrayOfItem =client.factory.create('ns0:ArrayOfItem')
  35. ArrayOfItem.Item=[Item,Item]
  36. result= client.service.GetListData(ArrayOfItem)
  37. print result
  38. print result.Item[0].ItemMenus.ItemMenu[0].Name
  39. # -----------------字典类型---------------------------
  40. print client.factory.create('ns2:ArrayOfKeyValueOfstringstring')
  41. print client.factory.create('ns2:KeyValueOfstringstring')
  42. KeyValueOfstringstring= client.factory.create('ns2:KeyValueOfstringstring')
  43. KeyValueOfstringstring.Key=''
  44. KeyValueOfstringstring.Value = 'cyw'
  45. ArrayOfKeyValueOfstringstring=client.factory.create('ns2:ArrayOfKeyValueOfstringstring')
  46. ArrayOfKeyValueOfstringstring.KeyValueOfstringstring=[KeyValueOfstringstring]
  47. result= client.service.GetDicData(ArrayOfKeyValueOfstringstring)
  48. print result.KeyValueOfstringstring[0].Key
  49. print result.KeyValueOfstringstring[0].Value
  50. # print client.last_received()
  51.  
  52. # -----------------字典嵌套---------------------------
  53. print client.factory.create('ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  54. print client.factory.create('ns2:KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  55. print client.factory.create('ns2:ArrayOfArrayOfKeyValueOfstringint')
  56. print client.factory.create('ns2:ArrayOfKeyValueOfstringint')
  57. print client.factory.create('ns2:KeyValueOfstringint')
  58. KeyValueOfstringint=client.factory.create('ns2:KeyValueOfstringint')
  59. KeyValueOfstringint.Key='cyw'
  60. KeyValueOfstringint.Value = 1
  61. ArrayOfKeyValueOfstringint=client.factory.create('ns2:ArrayOfKeyValueOfstringint')
  62. ArrayOfKeyValueOfstringint.KeyValueOfstringint=[KeyValueOfstringint]
  63. ArrayOfArrayOfKeyValueOfstringint=client.factory.create('ns2:ArrayOfArrayOfKeyValueOfstringint')
  64. ArrayOfArrayOfKeyValueOfstringint.ArrayOfKeyValueOfstringint=[ArrayOfKeyValueOfstringint]
  65. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = client.factory.create('ns2:KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  66. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.Key = 'cuiyw'
  67. KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.Value = ArrayOfArrayOfKeyValueOfstringint
  68. ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = client.factory.create('ns2:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  69. ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1.KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1 = KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1
  70. result= client.service.GetDicDicData(ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1)
  71. print result.KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1[0].Key
  72. print result.KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1[0].Value

三、遇到的问题

在上面配置WCF服务时我把终结点配置的绑定配置成wsHttpBinding,导致在python调用时出现下面的错误。当启动新实例启动服务时是可以的,但使用宿主就不行,昨天没找到解决方法,今天把昨天写的在自己电脑上重现了下还是出现这个问题,找了半天没想到还真解决了。

  1. <endpoint address="" contract="WcfServiceDemo.IServiceDemo" binding="wsHttpBinding"></endpoint>
  1. Exception: (415, u"Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.")

四、zeep client库的使用

昨天查Suds不支持wsHttpBinding,今天就尝试用zeep库来尝试。

1、WCF服务配置

首先是配置wsHttpBinding,使用zeep时需要wsHttpBinding配置<security mode="None">。其他与上一博客使用Suds序列化反序列化一样。

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3. <system.serviceModel>
  4. <bindings>
  5. <wsHttpBinding>
  6. <binding name="WSHttpBinding_IWCFService" >
  7. <security mode="None">
  8. </security>
  9. </binding>
  10. </wsHttpBinding>
  11.  
  12. </bindings>
  13. <services>
  14. <service name="WcfServiceDemo.ServiceDemo" behaviorConfiguration="ServiceDemoBehavior" >
  15. <endpoint address="" contract="WcfServiceDemo.IServiceDemo" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWCFService"></endpoint>
  16. <host>
  17. <baseAddresses>
  18. <add baseAddress="http://localhost:8001/ServiceDemo/"></add>
  19. </baseAddresses>
  20. </host>
  21. </service>
  22. </services>
  23. <behaviors>
  24. <serviceBehaviors>
  25. <behavior name="ServiceDemoBehavior">
  26. <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
  27. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
  28. <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
  29. <serviceDebug includeExceptionDetailInFaults="false"/>
  30. </behavior>
  31. </serviceBehaviors>
  32. </behaviors>
  33. <protocolMapping>
  34. <add binding="basicHttpsBinding" scheme="https" />
  35. </protocolMapping>
  36. <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  37. </system.serviceModel>
  38. <startup>
  39. <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  40. </startup>
  41. </configuration>

2、zeep client的使用

参数序列化反序列化,这里传入参数和返回值一样,就是为了验证传入参数正确与否。

  1. # -*- coding: utf-8 -*-
  2. import sys
  3. reload(sys)
  4. sys.setdefaultencoding('utf-8')
  5. from zeep import Client
  6.  
  7. if __name__ == '__main__':
  8. client = Client('http://localhost:8021/ServiceDemo/?singleWsdl')
  9. print client
  10. print client.namespaces
  11. #-------------------基础数据类型---------------
  12. print client.service.GetSimpleData('abc')
  13. # -------------------自定义Model类型---------------
  14. ItemMenuType = client.get_type('ns2:ItemMenu')
  15. itemMenu= ItemMenuType(Name='cyw',Value='abc')
  16. ArrayOfItemMenuType = client.get_type('ns2:ArrayOfItemMenu')
  17. print ArrayOfItemMenuType
  18. itemMenus=ArrayOfItemMenuType(ItemMenu=[itemMenu,itemMenu])
  19. print itemMenus
  20. ItemType= client.get_type('ns2:Item')
  21. print ItemType
  22. item=ItemType(ItemMenus=itemMenus)
  23. print item
  24. print client.service.GetModelData(item)
  25. # -------------------自定义Model List类型---------------
  26. ArrayOfItem = client.get_type('ns2:ArrayOfItem')
  27. items= ArrayOfItem(Item=[item,item])
  28. print client.service.GetListData(items)
  29. # -------------------字典类型---------------
  30. ArrayOfKeyValueOfstringstringType = client.get_type('ns3:ArrayOfKeyValueOfstringstring')
  31. print ArrayOfKeyValueOfstringstringType
  32. dic=ArrayOfKeyValueOfstringstringType(KeyValueOfstringstring=[{'Key':'a','Value':'aaa'},{'Key':'b','Value':'bbb'}])
  33. print dic
  34. # -------------------字典嵌套类型---------------
  35. ArrayOfKeyValueOfstringintType = client.get_type('ns3:ArrayOfKeyValueOfstringint')
  36. print ArrayOfKeyValueOfstringintType
  37. dic=ArrayOfKeyValueOfstringintType(KeyValueOfstringint=[{'Key':'a','Value':1},{'Key':'b','Value':2}])
  38. print dic
  39. ArrayOfArrayOfKeyValueOfstringintType = client.get_type('ns3:ArrayOfArrayOfKeyValueOfstringint')
  40. arrdic= ArrayOfArrayOfKeyValueOfstringintType(ArrayOfKeyValueOfstringint=[dic])
  41. ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1Type = client.get_type('ns3:ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1')
  42. dicdic= ArrayOfKeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1Type(KeyValueOfstringArrayOfArrayOfKeyValueOfstringintty7Ep6D1={'Key':'c','Value':arrdic})
  43. result= client.service.GetDicDicData(dicdic)
  44. print result
  45. print result[0].Value.ArrayOfKeyValueOfstringint[0].KeyValueOfstringint[0].Key

一直没找到怎么打印出wsdl的详细信息,今天算是找到了.

  1. print client.wsdl.dump()

Python之Suds库调用WCF实现复杂参数序列化的更多相关文章

  1. Python之Suds库调用WCF时复杂参数序列化

    今天主要做自动化测技术支持工作,最近一直在做接口自动化这块,前些天在研究将web页面模拟http进行接口自动化,这周杭州那边想测试WCF服务,所以这两天一直在探索.遇到的第一个问题就是服务参数传参序列 ...

  2. python使用suds来调用webservice

    对于python仅作为客户端调用webservice的情况,推荐使用suds库来完成,比起zsi,soapy之类,它可以说是相当轻量级,使用非常方便. 安装suds建议使用easy_insall来做. ...

  3. Python使用suds调用webservice报错解决方法:AttributeError: 'Document' object has no attribute 'set'

    使用python的suds包调用webservice服务接口,报错:AttributeError: 'Document' object has no attribute 'set' 调用服务接口代码: ...

  4. python 各种开源库

    测试开发 来源:https://www.jianshu.com/p/ea6f7fb69501 Web UI测试自动化 splinter - web UI测试工具,基于selnium封装. 链接 sel ...

  5. python使用suds调用webservice接口

    最近做接口对接,遇到了.net开发的webservice接口,因为python第一次与webservice对接,连问带查,最后使用suds库来实现了 1.安装suds mac: sudo pip in ...

  6. python使用SUDS调用webservice

    最近做接口对接,遇到了.net开发的webservice接口,因为python第一次与webservice对接,连问带查,最后使用suds库来实现了 1.安装suds mac: sudo pip in ...

  7. 通过实例简介python使用ctypes模块调用C语言动态库

    看介绍python语言时,说它是胶水语言,可以调用其他语言.通过使用ctypes模块就可以调用C语言的动态库.下面先放上官方文档和几个比较好的博文. 1.官方文档:http://python.net/ ...

  8. VBA/VB6/VBS/VB.NET/C#/Python/PowerShell都能调用的API封装库

    API函数很强大,但是声明的时候比较繁琐. 我开发的封装库,包括窗口.键盘.鼠标.消息等常用功能.用户不需要添加API函数的声明,就可以用到API的功能. 在VBA.VB6的引用对话框中引用API.t ...

  9. 【Win 10应用开发】手动调用WCF服务

    调用服务最简单的方法就是,直接在VS里面添加服务引用,输入服务的地址即可,无论是普通Web服务,还是WCF服务均可.VS会根据获取到的元数据,自动生成客户端代码. 如果服务的调用量很大,应用广泛,可以 ...

随机推荐

  1. COGS 862. 二进制数01串【dp+经典二分+字符串】

    862. 二进制数01串 ★   输入文件:kimbits.in   输出文件:kimbits.out   简单对比 时间限制:1 s   内存限制:128 MB USACO/kimbits(译 by ...

  2. poj_2503(map映射)

    题目链接poj2503 Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 38820   Accepted: ...

  3. Myeclipse xml标签代码提示,引入schema

    以SpringMVC为例 先引入命名空间 需要配置 xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schema ...

  4. JAVA爬虫实践(实践四:webMagic和phantomjs和淘宝爬虫)

    webMagic虽然方便,但是也有它不适用的地方,比如定向的某个单页面爬虫,或者存在大量ajax请求,页面的跳转请求全都混淆在js里. 这时可以用webMagic结合phantomjs来真实模拟页面请 ...

  5. Spring框架学习笔记(4)——配置bean more

    1.配置List属性 <!-- 配置List属性 --> <bean id="person4" class="com.broadtext.beans.c ...

  6. mysql 恢复数据

    前提:保存了需要恢复数据库的文件 .frm 和 .ibd 文件 条件:InnoDB 类型的 恢复表结构1.新建一个数据库--新建一个表,表名和列数和需要恢复数据库相同2.停止mysql服务器 serv ...

  7. [20160711][VS2012配置OpenCV2.4.9]

    相关说明 OpenCV是一套开源机器视觉库,用于简化机器视觉算法的开发与调试. 移植环境 操作系统:Win7 64位 移植软件:Visual Studio 2012 代码下载: https://sou ...

  8. 记录idea maven项目打包部署web项目mapper扫描失败

    最开始以为这里出了问题,后来加上以后还是不能把mapper.xml打包进去 这是报的异常信息 Mybatis启动老是报绑定错误(找不到Mapper对应的 SQL配置),经过一番Google未能解决问题 ...

  9. reduceByKeyLocally

    2017年3月15日, 星期三 reduceByKeyLocally--Transformation类算子 代码示例  

  10. hbase伪分布式安装(单节点安装)

    hbase伪分布式安装(单节点安装) http://hbase.apache.org/book.html#quickstart   1.    前提配置好java,环境java变量     上传jdk ...