Action()
{
 char buf[1911]; //¶¨Òå×Ö·ûÊý×飬Ö÷ÒªÓÃÓÚдÈëXML±¨Îĵ½»º³åÇø
 char str_Body[4086]; //³Ð½Ó±¨ÎĵÄ×Ö·ûÊý×é
 char strHeader[4086]; //±¨ÎÄÍ·£¬³õʼΪ16½øÖƵÄ×Ö·û´®
 int offset;
 char * ReturnData;
 int  sendLen=0; //·¢ËÍXMLµÄ³¤¶È
 int len;
 char temp[5];
    /*******¿ª¸öÈË¿Í»§ºÅ*********/
    sprintf(str_Body,"%s", lr_eval_string(
 "<?xml version=\"1.0\" encoding=\"GB18030\"?>"
"<Message>"
"<Head>"
"<_TransactionId>ecif.addPerson</_TransactionId>"
"<requestHeader>"
"<version>1.0</version>"
"<serialNo></serialNo>"
"<requestId>TELLER</requestId>"
"<refSerialNo></refSerialNo>"
"<requestTime>2014-10-15 11:30:42.246</requestTime>"
"<timeOutTime></timeOutTime>"
"<channelId>123010032</channelId>" //¿Í»§¼¶±ð
"<channelSerialNo></channelSerialNo>"
"</requestHeader>"
"<control>"
"<requesterName><dptid></requesterName>"  //ËùÊôÐкÅ
"<requesterRole>123010032</requesterRole>"  //Óû§ËùÊôÓû§×é
"<requesterInsitution><dptid></requesterInsitution>" //ËùÊô»ú¹¹
"<requesterId><oprid></requesterId>"  //¹ñÔ±ºÅ
"<requesterTime>2014-10-15 11:30:42.246</requesterTime>"
"<requesterLanguage>124010002</requesterLanguage>"
"<requesterLocale></requesterLocale>"
"<pageStartIndex></pageStartIndex>"
"<pageEndIndex></pageEndIndex>"
"<availableResultsCount></availableResultsCount>"
"<returnAvailableResultCount></returnAvailableResultCount>"
"<isAuthorize>575001001</isAuthorize>"
"<transCode></transCode>"
"</control>"
"</Head>"
"<Body>"
"<personMain>"
"<contactCode>122010001</contactCode>"    //¿Í»§Àà±ð
"<contactTpCd>162010001</contactTpCd>"    //¿Í»§ÊôÐÔ
"<clientTpCd>101001101</clientTpCd>"
"<contactName><ContactName></contactName>"   //¿Í»§Ãû³Æ
//"<channelId>123010032</channelId>"     //¿Í»§¼¶±ð
"<picId>567564</picId>"    //Ó°Ïñid
"<englishName>lkjjhgj</englishName>"
"<rankTpCd>160010002</rankTpCd>"
"<hasExBizInd>575001001</hasExBizInd>"
"<dwellerInd>575001001</dwellerInd>"
"<idTpCd>109010002</idTpCd>"   //¿ª»§ÖÖÀà  ´ËÀàΪ»§¿Ú±¾
"<refNum><RefNum></refNum>"   //¿ª»§Ö¤¼þºÅ
"<issueDt>1991-12-10</issueDt>"     //¿ª»§Ö¤¼þÇ©·¢ÈÕÆÚ
"<expiryDt>2099-12-31</expiryDt>"    //¿ª»§Ö¤¼þµ½ÆÚÈÕ
"<issueOrg>ÇàÑòÇø¹«°²·Ö¾Ö</issueOrg>"
"<workAddr>ÐÜè»ùµØ</workAddr>"
"<workAddrOneKey>510000000000</workAddrOneKey>"
"<workAddrOneValue>ËÄ´¨Ê¡</workAddrOneValue>"
"<workAddrTwoKey>510100000000</workAddrTwoKey>"
"<workAddrTwoValue>³É¶¼ÊÐ</workAddrTwoValue>"
"<workAddrThreeKey>510105000000</workAddrThreeKey>"
"<workAddrThreeValue>ÇàÑòÇø</workAddrThreeValue>"
"<familyAddr>Ì츮¹ã³¡</familyAddr>"
"<familyAddrOneKey>510000000000</familyAddrOneKey>"
"<familyAddrOneValue>ËÄ´¨Ê¡</familyAddrOneValue>"
"<familyAddrTwoKey>510100000000</familyAddrTwoKey>"
"<familyAddrTwoValue>³É¶¼ÊÐ</familyAddrTwoValue>"
"<familyAddrThreeKey>510105000000</familyAddrThreeKey>"
"<familyAddrThreeValue>ÇàÑòÇø</familyAddrThreeValue>"
"<familyAddrPostalCode>610000</familyAddrPostalCode>"
"<email>adsf@sina.com</email>"
"<phone>13109876789</phone>"
"<mobile>13109876789</mobile>"
"<workPhone>02888889090</workPhone>"
"<fax>02888889900</fax>"
"<bonCountryTpCd>111010045</bonCountryTpCd>"
"<langTpCd>124010002</langTpCd>"
"<incomeSrcScopeTpCd>120010007</incomeSrcScopeTpCd>"
"<maritalTpCd>128010002</maritalTpCd>"
"<farmerInd>575001001</farmerInd>"    //Å©»§±êÖ¾
"<rentRightTpCd>180010001</rentRightTpCd>"
"<nationTpCd>119010001</nationTpCd>"   //Ãñ×å
"<faithTpCd>121010002</faithTpCd>"    //×Ú½ÌÐÅÑö
"<maritalDt>2001-12-12</maritalDt>"
"<investTropism>æØÈý´ó·¨</investTropism>"
"<investRiskTpCd>125010001</investRiskTpCd>"
"<acceptMsgInd>575001001</acceptMsgInd>"
"<investKnowage>¹«Òæ¹ã¸æ</investKnowage>"   //Ͷ×ÊÐËȤ
"<investYears>4</investYears>"
"<workAddrPostalCode>610001</workAddrPostalCode>"
"<preCountryTpCd>111010045</preCountryTpCd>"
"<bankStockholderInd>575001001</bankStockholderInd>"
"<workOrgName>º£ÄÏÊ¡³ÎÂõÏع«Ë¾</workOrgName>"
"<occupationTpCd>116010003</occupationTpCd>"
"<custLvlCd>603000001</custLvlCd>"
"<naecdpName>D01</naecdpName>"
"<creditInd>575001001</creditInd>"
"<creditLines>232</creditLines>"
"<loanBalance>2323</loanBalance>"
"<offBalance>3232</offBalance>"
"<usedLines>2121</usedLines>"
"<agencyInd>575001002</agencyInd>"
"<agcontactName>Ðì½õ</agcontactName>"    //´úÀíÈË¿Í»§Ãû³Æ
"<agidTpCd>109010002</agidTpCd>"   //´úÀíÈËÖ¤¼þÀàÐÍ
"<agrefNum>1000100010002</agrefNum>"  //´úÀíÈËÖ¤¼þºÅ
"<agissueDt>2010-12-21</agissueDt>"     //´úÀíÈËÖ¤¼þÇ©·¢ÈÕÆÚ
"<agexpiryDt>2099-12-31</agexpiryDt>"  //´úÀíÈËÖ¤¼þµ½ÆÚÈÕ
"<agissueOrg>º£ÄÏÊ¡³ÎÂõÏؽð½­Õò</agissueOrg>"
"<agnetworkCheckInd>175010003</agnetworkCheckInd>"
"<agbonCountryTpCd>111010045</agbonCountryTpCd>"
"<agphone>0288888887</agphone>"           //ÁªÏµµç»°
"<agAddr>º£ÄÏÊ¡³ÎÂõÏØ</agAddr>"     //ÁªÏµµØÖ·
"<addrTpCd>567001001</addrTpCd>"    //Óʱà
"<riskLevelTpCd>534001003</riskLevelTpCd>"
"<riskLevelDesc>¿ª»§²âÊÔ..</riskLevelDesc>"
"<riskLevelCreatDt>2014-10-16</riskLevelCreatDt>"
"<industryTpCd>T</industryTpCd>"
"</personMain>"
"</Body>"
"</Message>"
));
 //È¡±¨ÎÄÌåµÄ³¤¶È
 len=strlen(str_Body);
 lr_output_message("%d",len);
 itoa(len,temp,10);
 if (len<10){
  strcpy(strHeader,"0000000");
  strcat(strHeader,temp);
  lr_output_message("%s",strHeader);
 }else if(len>10 &&len<100){
  strcpy(strHeader,"000000");
  strcat(strHeader,temp); 
  lr_output_message("%s",strHeader);
 }else if(len>100 &&len<1000){
  strcpy(strHeader,"00000");
  strcat(strHeader,temp); 
  lr_output_message("%s",strHeader);
 }else if(len>1000 &&len<10000){
  strcpy(strHeader,"0000");
  strcat(strHeader,temp);
  lr_output_message("%s",strHeader);
 }else if(len>10000 &&len<100000){
  strcpy(strHeader,"000");
  strcat(strHeader,temp);
  lr_output_message("%s",strHeader);
 }else{
  lr_output_message("³¤¶ÈΪÆäËüÊý×Ö");
 }
 strcat(strHeader,str_Body);
 lr_output_message("%s",strHeader);
 //±ê¼ÇÊÂÎñ¿ªÊ¼
 lr_start_transaction("¿ª¸öÈË¿Í»§_socket");
 /*½¨Á¢socket£¬ÓÃÓÚ½¨Á¢Á¬½Ó£¬½øÐз¢ËͺͽÓÊÕ±¨ÎÄ*/
    lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=172.32.7.8:18002", LrsLastArg);//ÃŹñ50000  ¿¨ÏµÍ³50003 //ecif 172.32.7.8 :8002//172.32.2.6:19013
   // lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=172.32.2.3:19013", LrsLastArg);//ÃŹñ50000  ¿¨ÏµÍ³50003 //172.32.2.6:19013
 strcpy(buf,strHeader);
 lr_output_message("%s",buf);
 lrs_set_send_buffer("socket0",buf,strlen(buf));
 //·¢Ëͱ¨ÎÄ
 lrs_send("socket0", "buf0",LrsLastArg);
 /*½ÓÊÕ·µ»ØµÄ±¨ÎÄ,Ö¸¶¨»º³åºÍ³¤¶È*/
 lrs_receive("socket0", "buf1",LrsLastArg);
 //lrs_receive("socket0", "buf1","Flags= MSG_PEEK",LrsLastArg);
 //lrs_receive_ex("socket0", "buf1","NumberOfBytesToRecv=4086",LrsLastArg);
 ReturnData=lrs_get_received_buffer("socket0",0,-1,"ascii");
 lr_output_message("·µ»Ø±¨ÎÄ[%s]",ReturnData);
    //if(strstr(ReturnData,"<RetMessage>½»Ò׳ɹ¦</RetMessage>"))
 if(strstr(ReturnData,"<responseCode>000000</responseCode>"))
 { 
  lr_output_message("¿ª¸öÈË¿Í»§³É¹¦");
  lr_end_transaction("¿ª¸öÈË¿Í»§_socket", LR_PASS);
 }
 else
  {
  lr_error_message("¿ª¸öÈË¿Í»§Ê§°Ü:ÐÕÃû[%s],Ö¤¼þºÅ[%s]",lr_eval_string("<ContactName>"),lr_eval_string("<RefNum>"));
  lr_end_transaction("¿ª¸öÈË¿Í»§_socket", LR_FAIL);
  lrs_close_socket("socket0");
  return 0;
  }
 lrs_close_socket("socket0");
 return 0;
 }