﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-剑父的技术之路-随笔分类-C/C++</title><link>http://www.cppblog.com/huangjianfu/category/10614.html</link><description>网络信息安全</description><language>zh-cn</language><lastBuildDate>Fri, 25 Nov 2011 03:29:05 GMT</lastBuildDate><pubDate>Fri, 25 Nov 2011 03:29:05 GMT</pubDate><ttl>60</ttl><item><title>mysql编译安装</title><link>http://www.cppblog.com/huangjianfu/archive/2011/11/22/160672.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Tue, 22 Nov 2011 00:52:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2011/11/22/160672.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/160672.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2011/11/22/160672.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/160672.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/160672.html</trackback:ping><description><![CDATA[一、tcmalloc<br />1、tcmalloc是什么?<br />2、安装tcmalloc<br /><br />二、mysql<br />1、mysql的编译<br /><br />2、把tcmalloc编译到mysql中<br /><br />三、memcache<br />1、memcache是什么？<br />2、安装memcache<img src ="http://www.cppblog.com/huangjianfu/aggbug/160672.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2011-11-22 08:52 <a href="http://www.cppblog.com/huangjianfu/archive/2011/11/22/160672.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>printf格式控制符的完整格式</title><link>http://www.cppblog.com/huangjianfu/archive/2011/04/26/145063.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Tue, 26 Apr 2011 08:18:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2011/04/26/145063.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/145063.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2011/04/26/145063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/145063.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/145063.html</trackback:ping><description><![CDATA[<p>printf的格式控制的完整格式：<br>%&nbsp; -&nbsp; 0&nbsp; m.n&nbsp; l或h&nbsp; 格式字符<br>下面对组成格式说明的各项加以说明：<br>①%：表示格式说明的起始符号，不可缺少。<br>②-：有-表示左对齐输出，如省略表示右对齐输出。<br>③0：有0表示指定空位填0,如省略表示指定空位不填。<br>④m.n：m指域宽，即对应的输出项在输出设备上所占的字符数。N指精度。用于说明输出的实型数的小数位数。为指定n时，隐含的精度为n=6位。<br>⑤l或h:l对整型指long型，对实型指double型。h用于将整型的格式字符修正为short型。<br><br>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br><strong>格式字符</strong><br>格式字符用以指定输出项的数据类型和输出格式。<br>&nbsp;①d格式：用来输出十进制整数。有以下几种用法：<br>%d：按整型数据的实际长度输出。<br>%md：m为指定的输出字段的宽度。如果数据的位数小于m，则左端补以空格，若大于m，则按实际位数输出。<br>%ld：输出长整型数据。<br>②o格式：以无符号八进制形式输出整数。对长整型可以用"%lo"格式输出。同样也可以指定字段宽度用&#8220;%mo&#8221;格式输出。<br>例：<br>&nbsp;&nbsp; main()<br>&nbsp;&nbsp; { int a = -1;<br>&nbsp;&nbsp;&nbsp;&nbsp; printf("%d, %o", a, a);<br>&nbsp;&nbsp; }<br>&nbsp; 运行结果：-1,177777<br>&nbsp; 程序解析：-1在内存单元中（以补码形式存放）为(1111111111111111)2，转换为八进制数为(177777)8。<br>③x格式：以无符号十六进制形式输出整数。对长整型可以用"%lx"格式输出。同样也可以指定字段宽度用"%mx"格式输出。<br>④u格式：以无符号十进制形式输出整数。对长整型可以用"%lu"格式输出。同样也可以指定字段宽度用&#8220;%mu&#8221;格式输出。<br>⑤c格式：输出一个字符。<br>⑥s格式：用来输出一个串。有几中用法<br>%s：例如:printf("%s", "CHINA")输出"CHINA"字符串（不包括双引号）。<br>%ms：输出的字符串占m列，如字符串本身长度大于m，则突破获m的限制,将字符串全部输出。若串长小于m，则左补空格。<br>%-ms：如果串长小于m，则在m列范围内，字符串向左靠，右补空格。<br>%m.ns：输出占m列，但只取字符串中左端n个字符。这n个字符输出在m列的右侧，左补空格。<br>%-m.ns：其中m、n含义同上，n个字符输出在m列范围的左侧，右补空格。如果n&gt;m，则自动取n值，即保证n个字符正常输出。<br>⑦f格式：用来输出实数（包括单、双精度），以小数形式输出。有以下几种用法：<br>%f：不指定宽度，整数部分全部输出并输出6位小数。<br>%m.nf：输出共占m列，其中有n位小数，如数值宽度小于m左端补空格。&nbsp;<br>%-m.nf：输出共占n列，其中有n位小数，如数值宽度小于m右端补空格。<br>⑧e格式：以指数形式输出实数。可用以下形式：<br>%e：数字部分（又称尾数）输出6位小数，指数部分占5位或4位。<br>%m.ne和%-m.ne：m、n和&#8221;-&#8221;字符含义与前相同。此处n指数据的数字部分的小数位数，m表示整个输出数据所占的宽度。<br>⑨g格式：自动选f格式或e格式中较短的一种输出，且不输出无意义的零。<br><br>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br>关于printf函数的进一步说明：<br>如果想输出字符"%",则应该在&#8220;格式控制&#8221;字符串中用连续两个%表示，如:<br>printf("%f%%", 1.0/3);<br>输出0.333333%。<br><br>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<br>对于单精度数，使用%f格式符输出时，仅前7位是有效数字，小数6位．<br>对于双精度数，使用%lf格式符输出时，前16位是有效数字，小数6位．</p>
<p><font color=#ff3300>######################################<font color=#0000ff>拾遗</font>########################################<br></font><font color=#000000>由高手指点<br>对于m.n的格式还可以用如下方法表示（例）<br>char&nbsp;ch[20];<br>printf("%*.*s\n",m,n,ch);<br>前边的*定义的是总的宽度，后边的定义的是输出的个数。分别对应外面的参数m和n 。我想这种方法的好处是可以在语句之外对参数m和n赋值，从而控制输出格式。 </font></p>
<hr>
<font color=#000000>今天(06.6.9)又看到一种输出格式 %n 可以将所输出字符串的长度值赋绐一个变量, 见下例:<br><br>int slen;<br><br>printf("hello world%n", &amp;slen);<br><br>执行后变量被赋值为11。<br><br>又查了一下, 看到一篇文章(<a href="http://www.programfan.com/article/showarticle.asp?id=2968" target=_blank><font color=#8f9966><u>查看</u></font></a>)说这种格式输出已经确认为一个安全隐患，并且已禁用。再搜搜果然这种用法都被用来搞什么溢出、漏洞之类的，随便找了一个：格式化字符串攻击笔记。</font>
<img src ="http://www.cppblog.com/huangjianfu/aggbug/145063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2011-04-26 16:18 <a href="http://www.cppblog.com/huangjianfu/archive/2011/04/26/145063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Creating Simple ISAPI Extensions</title><link>http://www.cppblog.com/huangjianfu/archive/2010/01/12/105465.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Tue, 12 Jan 2010 01:15:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2010/01/12/105465.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/105465.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2010/01/12/105465.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/105465.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/105465.html</trackback:ping><description><![CDATA[<p>source:http://msdn.microsoft.com/en-us/library/ms524352.aspx<br>For an ISAPI extension to be used by IIS, it must provide a standard interface. To provide a standard interface, each ISAPI extension DLL must implement and export two primary functions, <a id=ctl00_MTCS_main_ctl01 onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl01',this);" href="http://msdn.microsoft.com/en-us/library/ms525283.aspx"><font color=#0033cc>GetExtensionVersion</font></a> and <a id=ctl00_MTCS_main_ctl02 onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl02',this);" href="http://msdn.microsoft.com/en-us/library/ms525010.aspx"><font color=#0033cc>HttpExtensionProc</font></a>. A third function, <a id=ctl00_MTCS_main_ctl03 onclick="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl03',this);" href="http://msdn.microsoft.com/en-us/library/ms524470.aspx"><font color=#0033cc>TerminateExtension</font></a>, is optional and is commonly used by extensions to perform cleanup operations. <br><br>Initialization Using GetExtensionVersion <br>Initialization is handled by the entry-point function <a id=ctl00_MTCS_main_ctl22_ctl00_ctl00 onclick="javascript:Track('ctl00_MTCS_main_ctl22_ctl00_contenthere|ctl00_MTCS_main_ctl22_ctl00_ctl00',this);" href="http://msdn.microsoft.com/en-us/library/ms525283.aspx"><font color=#0033cc>GetExtensionVersion</font></a>. This function's role is to perform all initialization, including the creation of worker threads, synchronization objects, and database connections, and to establish the version of ISAPI that was used to build the DLL.<br><br>Adding Functionality Using HttpExtensionProc</p>
In general, an extension's functionality is exposed through the <a id=ctl00_MTCS_main_ctl23_ctl00_ctl00 onclick="javascript:Track('ctl00_MTCS_main_ctl23_ctl00_contenthere|ctl00_MTCS_main_ctl23_ctl00_ctl00',this);" href="http://msdn.microsoft.com/en-us/library/ms525010.aspx"><font color=#0033cc>HttpExtensionProc</font></a> entry-point function. This function receives a pointer to an <a id=ctl00_MTCS_main_ctl23_ctl00_ctl01 onclick="javascript:Track('ctl00_MTCS_main_ctl23_ctl00_contenthere|ctl00_MTCS_main_ctl23_ctl00_ctl01',this);" href="http://msdn.microsoft.com/en-us/library/ms525658.aspx"><font color=#0033cc>EXTENSION_CONTROL_BLOCK</font></a> structure, which contains data used for the required processing and is also used by the extension to communicate with IIS.<br>When <a id=ctl00_MTCS_main_ctl23_ctl00_ctl02 onclick="javascript:Track('ctl00_MTCS_main_ctl23_ctl00_contenthere|ctl00_MTCS_main_ctl23_ctl00_ctl02',this);" href="http://msdn.microsoft.com/en-us/library/ms525010.aspx"><font color=#0033cc>HttpExtensionProc</font></a> in employed, it should first <a id=ctl00_MTCS_main_ctl23_ctl00_ctl03 onclick="javascript:Track('ctl00_MTCS_main_ctl23_ctl00_contenthere|ctl00_MTCS_main_ctl23_ctl00_ctl03',this);" href="http://msdn.microsoft.com/en-us/library/ms524895.aspx"><font color=#800080>send a response header</font></a> to the client. The header provides the client with information, such as the content type that is returned. After the header is sent, any other processing can be performed through the various callback functions provided in the <strong>EXTENSION_CONTROL_BLOCK</strong>.<br><br>Termination Using TerminateExtension<br>
<p>When an extension is no longer needed, IIS removes it from memory. If the extension provides the <a id=ctl00_MTCS_main_ctl24_ctl00_ctl00 onclick="javascript:Track('ctl00_MTCS_main_ctl24_ctl00_contenthere|ctl00_MTCS_main_ctl24_ctl00_ctl00',this);" href="http://msdn.microsoft.com/en-us/library/ms524470.aspx"><font color=#0033cc>TerminateExtension</font></a> function, IIS calls it before removing the extension. Use of <a id=ctl00_MTCS_main_ctl24_ctl00_ctl01 onclick="javascript:Track('ctl00_MTCS_main_ctl24_ctl00_contenthere|ctl00_MTCS_main_ctl24_ctl00_ctl01',this);" href="http://msdn.microsoft.com/en-us/library/ms524470.aspx"><font color=#0033cc>TerminateExtension</font></a> is recommended to close down any threads that an extension initialized during processing.</p>
<p>After IIS finishes processing a request for an ISAPI extension, the connection can either be closed or kept open. A request can specify that the connection remain open by specifying the Connection: Keep-Alive header. If an ISAPI extension is designed to support Keep-Alive requests, this should be indicated to the client by calling the <a id=ctl00_MTCS_main_ctl24_ctl00_ctl02 onclick="javascript:Track('ctl00_MTCS_main_ctl24_ctl00_contenthere|ctl00_MTCS_main_ctl24_ctl00_ctl02',this);" href="http://msdn.microsoft.com/en-us/library/ms525533.aspx"><font color=#0033cc>HSE_REQ_SEND_RESPONSE_HEADER</font></a> server support function. The specified response header should contain Connection: Keep-Alive.</p>
<img src ="http://www.cppblog.com/huangjianfu/aggbug/105465.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2010-01-12 09:15 <a href="http://www.cppblog.com/huangjianfu/archive/2010/01/12/105465.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebService WSDL结构分析</title><link>http://www.cppblog.com/huangjianfu/archive/2009/11/05/100194.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Thu, 05 Nov 2009 04:24:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/11/05/100194.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/100194.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/11/05/100194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/100194.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/100194.html</trackback:ping><description><![CDATA[<p>WSDL (Web Services Description Language,Web服务描述语言)是一种XML Application，他将Web服务描述定义为一组服务访问点，客户端可以通过这些服务访问点对包含面向文档信息或面向过程调用的服务进行访问(类似远程过程调用)。WSDL首先对访问的操作和访问时使用的请求/响应消息进行抽象描述，然后将其绑定到具体的传输协议和消息格式上以最终定义具体部署的服务访问点。相关的具体部署的服务访问点通过组合就成为抽象的Web服务。 本文将详细讲解WSDL文档的结构，并分析每个元素的作用。 <br>一：WSDL定义</p>
<p>&nbsp;&nbsp;&nbsp; WSDL是一个用于精确描述Web服务的文档，WSDL文档是一个遵循WSDL XML模式的XML文档。WSDL 文档将Web服务定义为服务访问点或端口的集合。在 WSDL 中，由于服务访问点和消息的抽象定义已从具体的服务部署或数据格式绑定中分离出来，因此可以对抽象定义进行再次使用：消息，指对交换数据的抽象描述；而端口类型，指操作的抽象集合。用于特定端口类型的具体协议和数据格式规范构成了可以再次使用的绑定。将Web访问地址与可再次使用的绑定相关联，可以定义一个端口，而端口的集合则定义为服务。</p>
<p>&nbsp;&nbsp; 一个WSDL文档通常包含7个重要的元素，即types、import、message、portType、operation、binding、 service元素。这些元素嵌套在definitions元素中，definitions是WSDL文档的根元素。文章的下一部分将会详细介绍WSDL 的基本结构。</p>
<p>二：WSDL的基本结构--概述</p>
<p>如第一部分最后描述的那样，一个基本的WSDL文档包含7个重要的元素。下面将分别介绍这几个元素以及他们的作用。</p>
<p>WSDL 文档在Web服务的定义中使用下列元素：</p>
<p>Types - 数据类型定义的容器，它使用某种类型系统(一般地使用XML Schema中的类型系统)。 <br>Message - 通信消息的数据结构的抽象类型化定义。使用Types所定义的类型来定义整个消息的数据结构。 <br>Operation - 对服务中所支持的操作的抽象描述，一般单个Operation描述了一个访问入口的请求/响应消息对。 <br>PortType - 对于某个访问入口点类型所支持的操作的抽象集合，这些操作可以由一个或多个服务访问点来支持。 <br>Binding - 特定端口类型的具体协议和数据格式规范的绑定。 <br>Port - 定义为协议/数据格式绑定与具体Web访问地址组合的单个服务访问点。 <br>Service- 相关服务访问点的集合。 <br>&nbsp; 可以参考下图来理解一下WSDL的文档结构图：</p>
<p>WSDL的xml schema可以参照如下网址：<a href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</a></p>
<p>三：WSDL的基本结构--详述</p>
<p>本节将通过一个例子详细描述WSDL文档每个元素的作用。下面一个例子是一个简单的WSDL文档的内容，该文档的产生可以参见我的另外一篇文章：xfire开发实例--HelloWorld篇 。</p>
<p>一个简单的Web Service的WSDL文档，该服务支持名为sayHello的唯一操作，该操作通过在http上运行SOAP协议来实现的。该请求接受一个字符串name，经过处理后返回一个简单的字符串。文档如下：</p>
<p>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;<br>&lt;wsdl:definitions<br>&nbsp;&nbsp;&nbsp; targetNamespace="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:tns="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:wsdlsoap="<a href="http://schemas.xmlsoap.org/wsdl/soap/">http://schemas.xmlsoap.org/wsdl/soap/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soap12="<a href="http://www.w3.org/2003/05/soap-envelope">http://www.w3.org/2003/05/soap-envelope</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soapenc11="<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soapenc12="<a href="http://www.w3.org/2003/05/soap-encoding">http://www.w3.org/2003/05/soap-encoding</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soap11="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:wsdl="<a href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</a>"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:types&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attributeFormDefault="qualified" elementFormDefault="qualified"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetNamespace="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="1" minOccurs="1"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="name" nillable="true" type="xsd:string" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="1" minOccurs="1"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="out" nillable="true" type="xsd:string" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:schema&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:types&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:message name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:part name="parameters" element="tns:sayHelloResponse" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:message&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:message name="sayHelloRequest"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:part name="parameters" element="tns:sayHello" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:message&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:portType name="HelloServicePortType"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:operation name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:input name="sayHelloRequest"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message="tns:sayHelloRequest" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:output name="sayHelloResponse"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message="tns:sayHelloResponse" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:operation&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:portType&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:binding name="HelloServiceHttpBinding"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="tns:HelloServicePortType"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:binding style="document"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transport="<a href="http://schemas.xmlsoap.org/soap/http">http://schemas.xmlsoap.org/soap/http</a>" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:operation name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:operation soapAction="" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:input name="sayHelloRequest"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:body use="literal" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:input&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:output name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:body use="literal" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:output&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:operation&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:binding&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:service name="HelloService"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:port name="HelloServiceHttpPort"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; binding="tns:HelloServiceHttpBinding"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:address<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location="<a href="http://localhost:8080/xfire/services/HelloService">http://localhost:8080/xfire/services/HelloService</a>" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:port&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:service&gt;<br>&lt;/wsdl:definitions&gt;<br>&#9830; types元素使用XML模式语言声明在WSDL文档中的其他位置使用的复杂数据类型与元素；</p>
<p>&#9830; import元素类似于XML模式文档中的import元素，用于从其他WSDL文档中导入WSDL定义；</p>
<p>&#9830; message元素使用在WSDL文档的type元素中定义或在import元素引用的外部WSDL文档中定义的XML模式的内置类型、复杂类型或元素描述了消息的有效负载；</p>
<p>&#9830; portType元素和operation元素描述了Web服务的接口并定义了他的方法。portType元素和operation元素类似于 java接口和接口中定义的方法声明。operation元素使用一个或者多个message类型来定义他的输入和输出的有效负载；</p>
<p>&#9830; Binding元素将portType元素和operation元素赋给一个特殊的协议和编码样式；</p>
<p>&#9830; service元素负责将Internet地址赋给一个具体的绑定；</p>
<p>1、definitions元素</p>
<p>所有的WSDL文档的根元素均是definitions元素。该元素封装了整个文档，同时通过其name提供了一个WSDL文档。除了提供一个命名空间外，该元素没有其他作用，故不作详细描述。</p>
<p>下面的代码是一个definitions元素的结构：</p>
<p>&lt;wsdl:definitions<br>&nbsp;&nbsp;&nbsp; targetNamespace="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:tns="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:wsdlsoap="<a href="http://schemas.xmlsoap.org/wsdl/soap/">http://schemas.xmlsoap.org/wsdl/soap/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soap12="<a href="http://www.w3.org/2003/05/soap-envelope">http://www.w3.org/2003/05/soap-envelope</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soapenc11="<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soapenc12="<a href="http://www.w3.org/2003/05/soap-encoding">http://www.w3.org/2003/05/soap-encoding</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:soap11="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"<br>&nbsp;&nbsp;&nbsp; xmlns:wsdl="<a href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</a>"&gt;<br>&lt;/wsdl:definitions&gt;<br>2、types元素</p>
<p>&nbsp;WSDL采用了W3C XML模式内置类型作为其基本类型系统。types元素用作一个容器，用于定义XML模式内置类型中没有描述的各种数据类型。当声明消息部分的有效负载时，消息定义使用了在types元素中定义的数据类型和元素。在本文的WSDL文档中的types定义：</p>
<p>&nbsp;</p>
<p>&lt;wsdl:types&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attributeFormDefault="qualified" elementFormDefault="qualified"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; targetNamespace="<a href="http://com.liuxiang.xfiredemo/HelloService">http://com.liuxiang.xfireDemo/HelloService</a>"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="1" minOccurs="1"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="name" nillable="true" type="xsd:string" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsd:element maxOccurs="1" minOccurs="1"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name="out" nillable="true" type="xsd:string" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:sequence&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:complexType&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:element&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsd:schema&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:types&gt;<br>上面是数据定义部分，该部分定义了两个元素，一个是sayHello，一个是sayHelloResponse：</p>
<p>sayHello：定义了一个复杂类型，仅仅包含一个简单的字符串，将来用来描述操作的参入传入部分；</p>
<p>sayHelloResponse：定义了一个复杂类型，仅仅包含一个简单的字符串，将来用来描述操作的返回值；</p>
<p>3、import元素</p>
<p>import元素使得可以在当前的WSDL文档中使用其他WSDL文档中指定的命名空间中的定义元素。本例子中没有使用import元素。通常在用户希望模块化WSDL文档的时候，该功能是非常有效果的。</p>
<p>import的格式如下：</p>
<p>&lt;wsdl:import namespace="<a href="http://xxx.xxx.xxx/xxx/xxx">http://xxx.xxx.xxx/xxx/xxx</a>" location="<a href='http://xxx.xxx.xxx/xxx/xxx.wsdl"/'>http://xxx.xxx.xxx/xxx/xxx.wsdl"/</a>&gt;<br>必须有namespace属性和location属性：</p>
<p>namespace属性：值必须与正导入的WSDL文档中声明的targetNamespace相匹配；</p>
<p>location属性：必须指向一个实际的WSDL文档，并且该文档不能为空。</p>
<p>4、message元素</p>
<p>message元素描述了Web服务使用消息的有效负载。message元素可以描述输出或者接受消息的有效负载；还可以描述SOAP文件头和错误detail元素的内容。定义message元素的方式取决于使用RPC样式还是文档样式的消息传递。在本文中的message元素的定义，本文档使用了采用文档样式的消息传递：</p>
<p>&lt;wsdl:message name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:part name="parameters" element="tns:sayHelloResponse" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:message&gt;<br>&nbsp;&nbsp;&nbsp; &lt;wsdl:message name="sayHelloRequest"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:part name="parameters" element="tns:sayHello" /&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:message&gt;<br>该部分是消息格式的抽象定义：定义了两个消息sayHelloResponse和sayHelloRequest：</p>
<p>sayHelloRequest：sayHello操作的请求消息格式，由一个消息片断组成，名字为parameters,元素是我们前面定义的types中的元素；</p>
<p>sayHelloResponse：sayHello操作的响应消息格式，由一个消息片断组成，名字为parameters,元素是我们前面定义的types中的元素；</p>
<p>&nbsp;如果采用RPC样式的消息传递，只需要将文档中的element元素应以修改为type即可。</p>
<p>5、portType元素</p>
<p>portType元素定义了Web服务的抽象接口。该接口有点类似Java的接口，都是定义了一个抽象类型和方法，没有定义实现。在WSDL中， portType元素是由binding和service元素来实现的，这两个元素用来说明Web服务实现使用的Internet协议、编码方案以及 Internet地址。</p>
<p>一个portType中可以定义多个operation，一个operation可以看作是一个方法，本文中WSDL文档的定义：</p>
<p>&nbsp;&nbsp;&nbsp; &lt;wsdl:portType name="HelloServicePortType"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:operation name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:input name="sayHelloRequest"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message="tns:sayHelloRequest" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:output name="sayHelloResponse"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message="tns:sayHelloResponse" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:operation&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:portType&gt;<br>portType定义了服务的调用模式的类型，这里包含一个操作sayHello方法，同时包含input和output表明该操作是一个请求／响应模式，请求消息是前面定义的sayHelloRequest，响应消息是前面定义的sayHelloResponse。input表示传递到Web服务的有效负载，output消息表示传递给客户的有效负载。</p>
<p>６、binding</p>
<p>binding元素将一个抽象portType映射到一组具体协议(SOAO和HTTP)、消息传递样式、编码样式。通常binding元素与协议专有的元素和在一起使用，本文中的例子：</p>
<p>&nbsp;&nbsp;&nbsp; &lt;wsdl:binding name="HelloServiceHttpBinding"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="tns:HelloServicePortType"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:binding style="document"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transport="<a href="http://schemas.xmlsoap.org/soap/http">http://schemas.xmlsoap.org/soap/http</a>" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:operation name="sayHello"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:operation soapAction="" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:input name="sayHelloRequest"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:body use="literal" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:input&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:output name="sayHelloResponse"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:body use="literal" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:output&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:operation&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:binding&gt;<br>这部分将服务访问点的抽象定义与SOAP HTTP绑定，描述如何通过SOAP/HTTP来访问按照前面描述的访问入口点类型部署的访问入口。其中规定了在具体SOAP调用时，应当使用的soapAction是""。</p>
<p>具体的使用需要参考特定协议定义的元素。</p>
<p>７、service元素和port元素</p>
<p>service元素包含一个或者多个port元素，其中每个port元素表示一个不同的Web服务。port元素将URL赋给一个特定的binding，甚至可以使两个或者多个port元素将不同的URL赋值给相同的binding。文档中的例子：</p>
<p>&nbsp;&nbsp;&nbsp; &lt;wsdl:service name="HelloService"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:port name="HelloServiceHttpPort"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; binding="tns:HelloServiceHttpBinding"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdlsoap:address<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; location="<a href="http://localhost:8080/xfire/services/HelloService">http://localhost:8080/xfire/services/HelloService</a>" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:port&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/wsdl:service&gt;<br>这部分是具体的Web服务的定义，在这个名为HelloService的Web服务中，提供了一个服务访问入口，访问地址是<a href="http://localhost:8080/xfire/services/HelloService">http://localhost:8080/xfire/services/HelloService</a>，使用的消息模式是由前面的binding所定义的。</p>
<p>　　本文简单介绍了WSDL规范的用途，基本结构和使用方法，希望对大家学习WSDL有帮助。</p>
<p><br>本文来自CSDN博客，转载请标明出处：<a href="http://blog.csdn.net/sunchaohuang/archive/2008/10/14/3076375.aspx">http://blog.csdn.net/sunchaohuang/archive/2008/10/14/3076375.aspx</a></p>
<img src ="http://www.cppblog.com/huangjianfu/aggbug/100194.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-11-05 12:24 <a href="http://www.cppblog.com/huangjianfu/archive/2009/11/05/100194.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TCP中的keep-alive机制</title><link>http://www.cppblog.com/huangjianfu/archive/2009/11/04/100120.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Wed, 04 Nov 2009 06:20:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/11/04/100120.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/100120.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/11/04/100120.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/100120.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/100120.html</trackback:ping><description><![CDATA[如题
<img src ="http://www.cppblog.com/huangjianfu/aggbug/100120.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-11-04 14:20 <a href="http://www.cppblog.com/huangjianfu/archive/2009/11/04/100120.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>windows sockets网络编程</title><link>http://www.cppblog.com/huangjianfu/archive/2009/10/13/98527.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Tue, 13 Oct 2009 14:14:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/10/13/98527.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/98527.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/10/13/98527.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/98527.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/98527.html</trackback:ping><description><![CDATA[今天偶然在公司看到一本书《精通windows sockets网络编程--基于Visual C++实现》。本人对于此类标着精通两个字的书名比较反感，但还是看了一下目录，看了一下目录觉得在编排上还比较是在，再翻了一章讲完成端口的看了下，觉得还比较实在，然后看了一下讲基础知识部分，虽然很多东西都是一笔带过，但在实践中遇到过的一些问题，确实还是讲到了。<br>比如说从容关闭，今天在做一个文件下载的服务器时就遇到此问题，不知道为什么最后的一些字节客户端接收不到，其实就是从容关闭的问题。<br>还有讲sockets套接字，到底是个什么东西时，也有讲到，但还是讲得简单了些，只是描述了一下，套接字，在tcp/ip中就是属于应用层与传输层的一个接口，概念上虽然说明了是个什么东西，但原理和如何做的又一点都未介绍，这个又让我有点失望。<br>今天也就看了下，没仔细看，今晚又把此书的代码从网站上down下来了，编译了一下完成端口那个程序，还行，能一次编译通过，说明作者不是在忽悠。<br>以后有时间还是有温习，系统的看看网络编程，此书不失为一本比较好的参考。<br>这也算是今天的收获吧。
<img src ="http://www.cppblog.com/huangjianfu/aggbug/98527.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-10-13 22:14 <a href="http://www.cppblog.com/huangjianfu/archive/2009/10/13/98527.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>QoS</title><link>http://www.cppblog.com/huangjianfu/archive/2009/06/01/86410.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Mon, 01 Jun 2009 06:41:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/06/01/86410.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/86410.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/06/01/86410.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/86410.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/86410.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QoS的英文全称为"Quality of Service"，中文名为"服务质量"。QoS是网络的一种安全机制, 是用来解决网络延迟和阻塞等问题的一种技术。 <br>　　在正常情况下，如果网络只用于特定的无时间限制的应用系统，并不需要QoS，比如Web应用，或E-mail设置等。但是对关键应用和多媒体应用就十分必要。当网络过载或拥塞时，QoS 能确保重要业务量不受延迟或丢弃，同时保证网络的高效运行。<br>资料来源：<a href="http://baike.baidu.com/view/20897.htm">http://baike.baidu.com/view/20897.htm</a>
<img src ="http://www.cppblog.com/huangjianfu/aggbug/86410.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-06-01 14:41 <a href="http://www.cppblog.com/huangjianfu/archive/2009/06/01/86410.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>物理地址与逻辑地址</title><link>http://www.cppblog.com/huangjianfu/archive/2009/05/31/86275.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Sun, 31 May 2009 08:05:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/05/31/86275.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/86275.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/05/31/86275.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/86275.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/86275.html</trackback:ping><description><![CDATA[<p style="TEXT-INDENT: 2em"><font color=#0000ff><strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>是外部连接使用的、唯一的，<font color=#000000>它是&#8220;与地址总线相对应&#8221;</font>；而<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>是内部和编程使用的、并不唯一。</font> 在内存中的实际地址就是所谓的&#8220;<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>&#8221;，而<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>就是逻辑段管理内存而形成的。 <font color=#333333>例如，你在进行C语言指针编程中，可以读取指针变量本身值(&amp;操作)，实际上这个值就是<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>，它是<font color=#0000ff>相对于你当前进程数据段的地址（偏移地址）</font>，不和绝对<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>相干。只有在<font color=#0000ff>Intel实模式</font>下，<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>才和<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>相等（因为实模式没有分段或分页机制,Cpu不进行自动地址转换），<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>也就是<font color=#333333>在<font color=#0000ff>Intel 保护模式</font>下程序执行代码段限长内的偏移地址（假定代码段、数据段如果完全一样）。<font color=#000000>8086体系的CPU一开始是<font color=#0000ff>20根地址线, 寻址寄存器是16位</font>, 16位的寄存器可以访问64K的地址空间, 如果程序要想访问大于64K的内存, 就要把内存分段, 每段64K, 用段地址+偏移量的方法来访问 <wbr>。386CPU出来之后, 采用了<font color=#0000ff>32条地址线, 地址寄存器也扩为32位</font>, 这样就可以不用分段了, 直接用一个地址寄存器来线性访问4G的内存了. 这就叫平面模式.</font></font></font></p>
<p style="TEXT-INDENT: 2em">将<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>中的段地址左移4位，加上偏移地址就得到20位<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>。<font color=#0000ff>这里左移的4位是二进制位</font>；<font color=#0000ff>如果用十六进制表达地址就是左移一位</font>。左移4位还可以表达为乘以16，即：段地址&#215;16＋偏移地址。<br>同一个<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>可以对应多个<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>形式。所以<strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong>转换为<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>，需要明确段基地址或偏移地址，然后同上原则确定另一个地址。<br><strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong> 1460H : 0100H 或1380H : 0900H<br><strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong> 14700H<br>于是，对于主存14700H单元，我们可以描述为在1460H（或1380H）段的0100H（或0900H）单元，或者说主存1460H : 0100H（或1380H : 0900H）单元。</p>
<p style="TEXT-INDENT: 2em"><a href="http://define.cnki.net/WebForms/WebDefines.aspx?searchword=%e5%ad%98%e5%82%a8%e5%8d%95%e5%85%83"><font color=#0c4468><u>存储单元</u></font></a>的地址可以用<font color=#0000ff><u>段基值和段内</u></font><a href="http://define.cnki.net/WebForms/WebDefines.aspx?searchword=%e5%81%8f%e7%a7%bb%e9%87%8f"><font color=#0000ff><u>偏移量</u></font></a>来表示,段基值确定它所在的段居于整个存储空间的位置,偏移量确定它在段内的位置,这种地址表示方式称为<strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong>。</p>
<p><wbr><wbr><wbr><wbr><wbr><wbr>8086对外连接使用一个20位的线性地址唯一确定一个存储单元，也就是说：对于每个存储器单元都有的一个唯一的20位地址，我们称为该单元的<strong><u><font color=#0000ff><strong style="COLOR: black; BACKGROUND-COLOR: rgb(153,255,153)">物理地址</strong></font></u></strong>或<font color=#0000ff><strong><u>绝对地址</u></strong></font>。</p>
<p><wbr><wbr><wbr><wbr><wbr><wbr><wbr>8086在内部结构中和程序设计时采用逻辑段管理内存，就形成了<strong><u><font color=#0000ff><strong style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">逻辑地址</strong></font></u></strong>。它的表达形式为&#8220;段基地址 <wbr>: <wbr>偏移地址&#8221;。</p>
<img src ="http://www.cppblog.com/huangjianfu/aggbug/86275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-05-31 16:05 <a href="http://www.cppblog.com/huangjianfu/archive/2009/05/31/86275.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ACE的构建（VC++6.0环境）</title><link>http://www.cppblog.com/huangjianfu/archive/2009/05/20/83496.html</link><dc:creator>黄剑父</dc:creator><author>黄剑父</author><pubDate>Wed, 20 May 2009 09:15:00 GMT</pubDate><guid>http://www.cppblog.com/huangjianfu/archive/2009/05/20/83496.html</guid><wfw:comment>http://www.cppblog.com/huangjianfu/comments/83496.html</wfw:comment><comments>http://www.cppblog.com/huangjianfu/archive/2009/05/20/83496.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/huangjianfu/comments/commentRss/83496.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/huangjianfu/services/trackbacks/83496.html</trackback:ping><description><![CDATA[<div id="blog_text" class="cnt">
<div style="font-size: 12px;">ACE的构建（VC++6.0环境）<br>
Windows下ACE的构建<br>
1.        将ACE-5.5.zip解压到所需的安装目录，此处以E:\为例，解压后形成ACE_wrappers文件夹，因此ACE将会存在于ACE_wrappers\ace目录中。ACE_ROOT=E:\ACE_wrappers。<br>
2.        在系统中新建ACE_ROOT环境变量，值设为 E:\ACE_wrappers。具体设置为：我的电脑-&gt;属性-&gt;高级-&gt;环境变量-&gt;新建<br>
3.        在E:\ACE_wrappers\ace目录中创建一个头文件，命名为config.h，其内容为：<br>
#include "ace/config-win32.h"（必选项）<br>
#define ACE_HAS_STANDARD_CPP_LIBRARY 1 （MSVC自带的标准C++头文件）<br>
#define ACE_HAS_MFC 1（与MFC一起使用）<br>
#define ACE_NO_INLINE（取消函数内联从而减小静态库和运行码的大小）<br>
#define ACE_AS_STATIC_LIBS（构建ACE的静态版本）<br>
#define ACE_HAS_WINNT4 0（在Windows 9x/me上构建所需，在ACE中移掉一些WinNT/Win2K中特有的代码）<br>
以上只需要添加前两项就可以了。<br>
4. 在VC++中加载ACE的工程文件（ACE_ROOT
\ace\ace.dsw），在release和debug两种编译方式下进行编译，得到相应的库文件(ACE.dll、ACE.lib 和
ACEd.dll、ACEd.lib)，其中ACE.dll
、ACE.lib是由release版生成的，ACEd.dll、ACEd.lib是由debug版生成的。具体操作方法：运行VC++，选择Build
-&gt;Batch Build&#8230;，将ACE-Win32 Debug和ACE-Win32 Release全部选中，Rebuild
All即可。如下图所示：<br>
<br>
按照上面的方法可能只编译出ACE.dll
、ACE.lib库文件，具体原因还不详。按照下面的操作方法进行编译可以成功生成全部库文件。具体操作方法：Build-&gt;Set
Active Configuration&#8230;分别选中ACE-Win32 Release进行编译即可。如下图所示<br>
<br>
同样打开ace_static.dsw编译生成ACEs.lib、 ACEsd.lib、ACE_RMCasts.lib、ACE_RMCastsd.lib、TMCasts.lib、TMCastsd.lib<br>
<br>
5.        配置ACE环境。 打开VC++6.0，选择Tools-&gt;Options-&gt;Directories 加入以下内容：<br>
1)        Executable File：E:\ACE_wrappers\bin<br>
2)        Include File：E:\ACE_wrappers<br>
3)        Library Files：E:\ACE_wrappers\lib<br>
4)        Source Files：E:\ACE_wrappers<br>
在编写程序时要在Project-&gt;Settings菜单中进行如下设置： <br>
C/C++选项卡：<br>
Code Generation：选择多线程版运行时库（Multithreaded DLL）。<br>
Preprocessor：在&#8220;Additional include directories&#8221;域中加入$ACE_ROOT。　　<br>
Link选项卡：<br>
Input：在&#8220;Object/library modules&#8221;域中包含适当的ACE库文件，在&#8220;Additional library <br>
path&#8221;域中包含ACE库链接文件的路径。这通常是ACE_ROOT/ace。<br>
其中 DLL debug对应ACEd.lib<br>
&nbsp;&nbsp;&nbsp; DLL release对应ACE.lib<br>
&nbsp;&nbsp;&nbsp; Static library debug对应ACEsd.lib<br>
&nbsp;&nbsp;&nbsp; Static library release对应ACEs.lib<br>
&nbsp;&nbsp;&nbsp; MFC DLL debug对应ACEmfcd.lib<br>
&nbsp;&nbsp;&nbsp; MFC DLL release对应ACEmfc.lib<br>
&nbsp;&nbsp;   主要用到以上两个库。<br>
<br>
6.        在系统环境的变量 path中加入E:\ACE_wrappers\bin，否则在运行程序的时候碰到寻找ace.dll或者aced.dll的问题。<br>
7.        在MFC程序中使用时，应该在InitInstance()中添加：<br>
WSDATA wsData;<br>
WORD VerRequested = MAKEWORD (2, 2);<br>
WSAStarup (VerRequested, &amp;wsData)<br>
注：可以在头文件中加入如下代码就不用再手动填加lib库文件<br>
#ifdef _DEBUG<br>
#pragma comment (lib,"aced.lib")<br>
#else<br>
#pragma comment (lib,"ace.lib")<br>
#endif<br>
8.        在windows下release时有可能报错，错误如下：<br>
error C2039: 'TryEnterCriticalSection' : is not a member of '`global<br>
error C2065: 'TryEnterCriticalSection' : undeclared identifier<br>
解决办法：<br>
工程 Project--&gt;setting--&gt;C/C++&nbsp;&nbsp; 写入:_WIN32_WINNT=0x0500<br>
Linux 下ACE的构建<br>
1.        设置环境变量ACE_ROOT，命令如下：<br>
&#8220;vi /etc/profile&#8221; ，在&#8220;export PATH USER&#8230;.&#8221;后加入4行 <br>
        ACE_ROOT=/opt/ACE <br>
        export ACE_ROOT<br>
        LD_LIBRARY_PATH=$ACE_ROOT/ace<img src="http://www.ace-tao.org/bbs/images/smilies/shy.gif" smilieid="8" border="0">LD_LIBRARY_PATH<br>
        export LD_LIBRARY_PATH<br>
完 成后将/etc/profile执行一次，命令：&#8220;chmod 555
/etc/profile&#8221;，&#8220;/etc/profile&#8221;。这样我们的ACE_ROOT就设置好了，可以用如下命令查看ACE_ROOT是否设置好了：
&#8220;echo $ACE_ROOT&#8221; ，这个时候最好reboot启动一次linux。<br>
2.        解压ACE.tar.gz包：<br>
不
要自己手工将ACE.tar.gz包完全解开，特别强调不要完全解开，后面可以看到安装脚本会给我们解开它的；如果你手工解开全部，安装脚本将会将你的解
压缩目录删除的！我们要做的事就只是将ACE.tar.gz包中的ACE-install.sh安装脚本单独解出来，并对其修改。我们只要这一个文件就可
以。用mkdir建目录，如/home/my/ACE，然后将你的ACE.tar.gz放在此目录下（用cp命令拷贝或mv命令移动到此目录）。注意这个
目录将是你的一个存放ACE.tar.gz的目录，安装脚本会来这个目录找这个文件的，这个目录和ACE_ROOT是不一样的，且ACE-
install.sh也提示不要将这两个目录设置成同一个目录。ACE_ROOT将是我们的安装目标目录。<br>
3.        从ACE.tar.gz解压出单个文件ACE-install.sh，命令如下：<br>
&#8220;tar &#8211;zxvf ACE+TAO+CIAO.tar.gz ACE_wrappers/ACE-install.sh&#8221;<br>
解 好后，会出来一个新的子目录&#8220;ACE_wrappers&#8221;。此时可以先将ACE-install.sh移到外面的目录来：&#8220;mv
/ACE_wrappers/ACE-install.sh .&#8221;
&#8220;.&#8221;代表当前目录。当然ACE-install.sh在什么路径下是没什么影响的，因为我们要对ACE-install.sh的内容进行修改的，里面有
很多路径要修改。现在在/home/my/ACE就有了ACE-install.sh，我们现在用vi对其进行修改，修改前自己可以先备份一个。命令：
&#8220;cp ACE-install.sh ACE-install.sh.bak&#8221;，&#8220;vi
ACE-install.sh&#8221;先找到&#8220;MY_ACEDIR=${HOME}/aceconfig&#8221;，将其改成&#8220;MY_ACEDIR=
/home/my/ACE&#8221;，就是改成我们自己建的、放有ACE.tar.gz文件的目录，之后去掉前面的注释&#8220;#&#8221;号。接着在下面一点，找到
&#8220;MY_ACE_CONFIG=config-sunos5.4-sunc++-4.x.h&#8221;，将其修改成&#8220;MY_ACE_CONFIG=config-
linux.h&#8221;，即改成linux下的配置文件。继续改，找到&#8220;MY_ACE_GNU_MACROS=platform_sunos5_sunc++.
GNU&#8221;，将其改成&#8220;MY_ACE_GNU_MACROS=platform_linux.GNU&#8221;。这个是各种操作系统平台下的GNU宏文件设置。文件
修改完毕，保存退出&#8220;:wq&#8221;。<br>
4.        安装ACE：<br>
此时应该是在/home/my/ACE目录下，我们执行： h./ACE-install.sh <br>
此 后将是较长时间的解包、编译等待时间。这个过程将不会出现任何错误，因为安装脚本将为我们做很多事情，如：生成config.h，生成
platform_macros.GNU。我们不需要按ACE-install.html中说的手工改东西：不用做连接&#8220;ln -s
config-sunos5-sunc++-4.x.h
config.h&#8221;，安装脚本会给我们做好；(题外话：Windows中没有文件连接这一说，所以要自己生成一个config.h文件，再在它的里面加一
句话&#8220;#include "ace/config-win32.h"&#8221;。) <br>
如果编译中出现错误，如&#8220;../apps/gperf&#8221;等，请编辑$ACE_ROOT/apps下的Makefile，将其中的有关&#8220;gperf&#8221;的部分注释掉，这个东西只是一个例子，可以不去编译它。 <br>
强调一下，用ACE-install.sh来安装，会编译ACE、tests、apps等。最后会生成libACE.so及tests、apps下也会出来很多经过编译的文件。 <br>
当然如果你只是下载了ACE.tar.gz这样的单个包来安装，你可以手工改文件，再make，因为只编译ACE，工作就少了很多，手工做还可以接受。<br>
ACE学习资料<br>
1. ACE 程序员指南:网络与系统编程的实用设计模式 网络与系统编程的实用设计模式&nbsp;&nbsp; ACE Programmer's Guide
practical Design Patterns for Network and Systems Programming<br>
(美)Stephen D. Huston,(美)James CE Johnson,(美)Umar Syyid著 <br>
马维达 译 中国电力出版社<br>
2.        C++网络编程 卷1：运用ACE和模式消除复杂性 <br>
C++ Network Programming Volume 1 Mastering Complexity with ACE and Patterns <br>
[美]Douglas C.Schmidt,Stephen D.Huston /著 [美]Douglas C.Schmidt，Stephen D.Huston 著，於春景 译&nbsp;&nbsp; 华中科技大学出版社<br>
3.        C++网络编程,卷2 基于ACE和框架的系统化复用 <br>
C++ network Programming, Volume 2 Systematic Reuse with ACE and Frameworks <br>
Douglas C.Schmidt, Stephn D.Huston /著&nbsp;&nbsp; | 马维达 译 电子工业出版社<br>
4.        ACE的官方网站&nbsp;&nbsp;<a href="http://www.cs.wustl.edu/%7Eschmidt/ACE.html" target="_blank">http://www.cs.wustl.edu/~schmidt/ACE.html</a> <br>
5.        马维达的主页    <a href="http://www.flyingdonkey.com/" target="_blank">http://www.flyingdonkey.com/</a><br>
6.        RIVERACE公司 <a href="http://www.riverace.com/" target="_blank">http://www.riverace.com</a><br>
7.        灰狐  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;   <a href="http://www.huihoo.com/" target="_blank">http://www.huihoo.com/</a> <br>
8.      &nbsp;&nbsp;&nbsp; ACE类库  &nbsp;&nbsp;   <a href="http://dev.csdn.net/article/40/40700.shtm" target="_blank">http://dev.csdn.net/article/40/40700.shtm</a><br>
<br>
<br>
常见错误<br>
错误1：<br>
&#8220;Cannot open include file: ace/SOCK_Acceptor.h: No such file  &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp; or directory&#8221;<br>
解决方法：<br>
Project-&gt;settings-&gt;C/C++: Preprocessor的Additional include directories中加入$ACE_ROOT，如E:/ACE_wrappers   <br>
错误2：<br>
&#8220;You must link against multi-threaded libraries when using ACE (check your project settings)&#8221;<br>
解决方法：<br>
Project-&gt;settings-&gt;C/C++: Code Generation 的Use run-time library : Debug Multithreaded Dll<br>
错误3：<br>
&#8220;error C2065: ACE_ERROR : undeclared identifier&#8221;<br>
&#8220;error C2065: ACE_DEBUG : undeclared identifier&#8221;<br>
解决方法：<br>
在原马中加入#include ace/Log_Msg.h<br>
错误4：&#8220;error C4716: ace_main_i : must return a value&#8221;<br>
解决方法：<br>
在main中加入return 0;<br>
错误5：<br>
&#8220;error LNK2001: unresolved external symbol __declspec(dllimport) int __cdecl&#8221;<br>
解决方法：<br>
Project-&gt;settings-&gt;Link-&gt;Input: Object/library
Modules加入aced.lib ，Additional Library
Path中加入$ACE_ROOT\ace，如E:\ACE_wrappers\ace <br>
编译client中遇到的问题:<br>
错误6：<br>
error C2039: sprintf : is not a member of ACE_OS<br>
解决方法：#include ace/OS_NS_stdio.h<br>
错误7：error C2039: strlen : is not a member of ACE_OS<br>
解决方法：#include ace/OS_NS_string.h<br>
错误8：无法找到动态链接库aced.dll于指定的路径<br>
解决方法：为系统变量PATH加上D:\ACE_wrappers\bin <br>
静态包含：<br>
&nbsp;&nbsp;    工程-设置-C/C++-预处理程序定义中加入 ,ACE_AS_STATIC_LIBS<br>
&nbsp;&nbsp;    <br>
&nbsp;&nbsp;    <br>
例１server编译后生成<br>
server.exe 16K&nbsp;&nbsp; serverd.exe 97K  &nbsp;&nbsp;&nbsp; servers.exe 124K serversd.exe 669K<br>
（servers.exe较适合发布）<br>
<br>
例2 client编译后生成<br>
client.exe 16K&nbsp;&nbsp; clientd.exe 97K  &nbsp;&nbsp;&nbsp; clients.exe 124K clientsd.exe 669K<br>
（clients.exe较适合发布）<br>
<br>
测试 clients 127.0.0.1 1919<br>
&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp; servers 1919<br>
<br>
<br>
如果编译器支持64位，通过什么宏定义来区分64位还是32位阿？<br>
答：#define ver ((2&gt;&gt;31)&gt;0?64:32)</div>
<div style="font-size: 12px;">-------------------------------------------------------</div>
<div style="font-size: 12px;">给ACE初哥初妹的话<br>
<br>
<div style="font-size: 12px;">给ACE初哥初妹的话<br>
<br>
version 0.1.0    Stone jIang 2006-11-6<br>
<br>
下面列出了初学ACE必要的基础知识，希望能给初学ACE的朋友们一点帮助。特加上版本号，这是为了欢迎批判，补充和修订。<br>
<br>
1. C++/OOP　（有一部分高手是C语言背景根深蒂固的，思考问题不是面向对象，这类人学ACE需要先补补OOP思想)<br>
<br>
2. Design Pattern (ACE不仅仅是类库，而是通过模式协同在一起的一系列相关的类，如果对设计模式熟悉，那么会用助于学习ACE)<br>
<br>
3. Framework
(Framework应该还不正式，相似的词还可以是architecture,不管用啥词语，所要指出的是，ACE不仅仅是类库，更是通过模式组合在一
起相互协作的类形成的半成品。框架有别于类库，后者通常是被动的被程序员写的代码调用，而框架则往往主动地调用用户实现的接口，即著名的好莱坞原则——
Don't call me , I will call you)<br>
<br>
4.Linux(我是Linux初不者，但自从我开始进入Linux 编程的时候，我就发现,ACE许多精华源自Linux，以前对ACE理解有限，不知道为什么这样，其实在Linux中能找到答案，ACE里闪烁着Linux的智慧。)<br>
<br>
5. Richard Stevens. (英年早逝的Richard,应该是Douglas的良师益友，他的著作影响了Douglas,也就影响着ACE,这里要说的是TCP/IP Illustrated ，其实Richard其他著作，像APUE都是大滋大补的）<br>
<br>
6. 没有6了。如果你认为有，一定告诉我。</div>
</div>
</div>
<br><img src ="http://www.cppblog.com/huangjianfu/aggbug/83496.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/huangjianfu/" target="_blank">黄剑父</a> 2009-05-20 17:15 <a href="http://www.cppblog.com/huangjianfu/archive/2009/05/20/83496.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>