锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 1.subst.exe鐒曞彂闈掓槬 gSoap: How to add info to SOAP Header using gSOAP
This article leads you to the right way and can make your program work.
Client needs to pass user name and password to Server Side to get authenticated.
The username and password info should be embeded in SOAP Header.
1. Edit struct SOAP_ENV__Header in soapStub.h file which is generated by gSOAP's soapcpp2 compiler
Add the neccesary info to this struct
For example:
struct SOAP_ENV__Header
{
public:
void *dummy; /* transient */
};
This should be changed to:
struct SOAP_ENV__Header
{
public:
void *dummy; /* transient */
char *username;
char *password;
};
Add statements to serialize those info into SOAP Header.
For example:
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type)
{
soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type);
/* transient dummy skipped */
soap_element_end_out(soap, tag);
return SOAP_OK;
}
{
soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type);
/* transient dummy skipped */
soap_out_string(soap, "headerNS:username", 1, &(a->username), "");
soap_out_string(soap, "headerNS:password", 2, &(a->password), "");
return SOAP_OK;
}
{"headerNS", "http://customeheader.test.com", NULL, NULL},
soap_init(&soap);
...
soap->header = (SOAP_ENV__Header *)soap_malloc(soap, sizeof(SOAP_ENV__Header));
soap->header->username = (char*)malloc(MAX_NAME_SIZE * sizeof(char));
soap->header->password = (char*)malloc(MAX_NAME_SIZE * sizeof(char));
strcpy(soap->header->username, username);
strcpy(soap->header->password, passwd);
soap_call_method(&soap, ...); //the SOAP Header will be in the request
...
6. Run.
The SOAP Message could be
...
<SOAP-ENV:Envelope xmlns:headerNS="http://customeheader.vpamws.com">
<SOAP-ENV:Header>
<headerNS:username>admin</headerNS:username>
<headerNS:password>default</headerNS:password>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
]]>
subst.exe鏄竴涓笉澶父鐢ㄧ殑DOS鍛戒護錛屽畠鐨勪綅緗殣钘忓湪\Windows\Command\涓?閽堝Windows 9X/Me緋葷粺)錛屽鏋滄槸Windows 2000/XP錛屽垯搴旇闅愯棌鍦╘Windows\System32\涓嬶紝鍓嶈呯殑澶у皬涓?7.6KB錛屽悗鑰呯殑澶у皬鏇村皬涓浜涳紝鎵?.0KB鑰屽凡銆?nbsp;
subst.exe鐨勫畬鏁村悕縐版槸“緇欑洰褰曡祴椹卞姩鍣ㄧ鍛戒護”錛屽畠鐨勫姛鑳芥槸浠ョ鐩橀┍鍔ㄥ櫒鍙蜂唬鏇胯礬寰勫悕縐幫紝浠ヤ嬌椹卞姩鍣ㄥ彿涓庢寚瀹氱殑瀛愮洰褰曡礬寰勫叧鑱旓紝鍏跺懡浠ゆ牸寮忓緢綆鍗曪細
subst.exe [Driver1: [Driver2:] Path]
鍏朵腑鐨?#8220;Driver1”鏄寚瀹氭寚媧捐礬寰勭殑铏氭嫙椹卞姩鍣ㄧ洏絎︼紝“Driver2 Path”鍒欐槸鎸囧畾鐗╃悊椹卞姩鍣ㄥ拰瑕佹寚媧劇粰铏氭嫙椹卞姩鍣ㄧ殑璺緞銆?nbsp;
2.鍒╃敤subst.exe铏氭嫙杞┍
渚嬪錛屽湪瀹夎鐟炴槦鏉姣掕蔣浠跺墠錛屼綘鍙互鍏堥氳繃鍏朵粬鏂瑰紡(渚嬪灞鍩熺綉銆侀偖浠躲佸叡浜枃浠?灝咥鐩樼殑鎵鏈夋枃浠跺鍒跺埌鏈満鐨勪竴涓枃浠跺す涓紝渚嬪D:\temp涓嬨傜劧鍚庡湪鍛戒護鎻愮ず絎︾獥鍙d笅閿叆濡備笅鍛戒護“subst A: D:\temp”錛屽鍥?鎵紺猴紝鏈嬪弸浠彲浠ョ湅涓鐪嬭繖閲岀敤“dir A:”鍛戒護鍚庣殑鏂囦歡鍒楄〃錛屽氨鐭ラ亾涓寮犺蔣鐩樹腑鏄粷涓嶅彲鑳芥斁鍏ュ姝や箣澶氱殑涓滀笢鐨勩傝繖鏍鳳紝鎴戜滑灝卞彲浠ユ寜鐓ц繖縐嶆柟娉曞皢D:\temp鏂囦歡澶硅櫄鎷熸垚A鐩橈紝鐟炴槦鏉姣掕蔣浠剁殑瀹夎灝卞彲浠ラ『鍒╁畬鎴愪簡銆?nbsp;
褰撴垜浠櫄鎷熻蔣椹卞悗錛屼綘浼氬彂瑙夎蔣椹辯殑鍥炬爣宸茬粡鍙樻垚浜嗗浘2鎵紺虹殑紜洏鍥炬爣錛屽綋鐒跺弻鍑繪墦寮鍚庡氨鏄疍:\Temp鏂囦歡澶逛腑鐨勫唴瀹廣?nbsp;
3.鍒犻櫎铏氭嫙杞┍
濡傛灉浣犺鍒犻櫎榪欎釜铏氭嫙鍑烘潵鐨凙鐩橈紝鍙鎵ц“subst A:/D”鍛戒護灝辮浜嗭紝鍒囪宸ヤ綔緇撴潫鍚庝竴瀹氳鍙婃椂鍒犻櫎榪欎釜铏氭嫙鍑烘潵鐨凙鐩橈紝鍚﹀垯鏃犳硶姝e父浣跨敤鍘熸潵鐨勭墿鐞咥鐩樺摕銆?nbsp;
鏈変簺杞歡鍙兘鍦ㄨ蔣鐩樹笂榪愯錛岃繖鏄蔣浠跺紑鍙戣呯殑鐗瑰埆璁捐錛屼富瑕佺洰鐨勬槸涓轟簡闃叉闈炴硶鎷瘋礉銆備笉榪囷紝鎴戜滑鍙互鍏堥氳繃HD-COPY宸ュ叿灝嗚蔣鐩樺仛鎴愪竴涓墿灞曞悕涓篿mg鐨勯暅鍍忔枃浠跺瓨鏀懼湪紜洏涓婄殑鏌愪釜鏂囦歡澶逛腑錛岀劧鍚庡埄鐢↖MGDRIVE銆乁NDISK絳夊伐鍏瘋蔣浠跺皢璇ラ暅鍍忔枃浠跺睍寮錛岃繖鏍峰氨鍙互鍦ㄧ‖鐩樹笂鍒涘緩涓涓櫄鎷熻蔣鐩橈紝鑷劧涔熷氨鍙互姝e父榪愯浜嗭紝涓嶈繃濡傛灉鏄姞瀵嗙殑杞歡錛屽垯鏃犳硶閫氳繃榪欑鏂規硶姝e父榪愯銆?/p>
Sector, Boot Sector, Track, Cluster, Bad Sector, Lost Cluster

Sector, Track and Cluster
A Sector in the context of computing refers to a small area of a storage device, for example a hard disk drive.
For more detailed information please see below.![]()
![]()
This page is © Copyright 2001-2008 helpwithpcs.com ![]()
Sector, Track and Cluster continued...
A typical hard disk drive when low-level formatted is split into tracks, sectors and clusters:
In the example on the left in fig 1.1 we have only illustrated one track, one sector and one cluster, but you can see where the other tracks, sectors and clusters would reside.
A typical hard drive may have 30 or more tracks, and 10 or more sectors per track.
The size of a cluster will vary depending on the size of the partition.Bad Sector
A bad sector refers to a single sector that has some physical flaw. Although a disk can operate with a bad sector, any data that was stored in that sector will be lost, further, no data can be written to that sector. Lost Cluster
A lost cluster is a cluster that the operating system has classed as being in use, but actually contains no data. The ScanDisk utility within Windows is designed to search for lost clusters and make them available to the file system again. The Boot Process and the boot sector
Boot sector refers to a single sector (normally the first in the active partition) that contains the code to boot the operating system.
Before the boot sector is read, the computer's bios will call a small program called an MBR (Master Boot Record), which normally resides in the first record of the first disk.
The MBR will query the FAT (File Allocation Table) to establish the primary partition and then pass control over to the boot sector of that partition.
The small program stored in the boot sector is then executed and the operating system will begin to load.![]()
]]>
]]>
]]>
]]>
]]>
]]>
]]>
]]>