yddtlzg 发表于 2006-8-24 17:04:18

关于winsocket的问题

actiion代码如下:
Action()
{      
    char *BufVal;
    int iVal,iLength,i,j;
    lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=lzhg:7001", LrsLastArg);
    lrs_send("socket0", "buf0", LrsLastArg);
    lrs_receive("socket0", "buf1", LrsLastArg);
    lrs_get_last_received_buffer("socket0",&BufVal,&iLength);
    lr_output_message("the buffer is:%s",BufVal);
    lrs_close_socket("socket0");
    lrs_create_socket("socket1", "TCP", "LocalHost=0", "RemoteHost=lzhg:7001", LrsLastArg);
    lrs_send("socket1", "buf2", LrsLastArg);
    lrs_receive("socket1", "buf3", LrsLastArg);
    lrs_close_socket("socket1");
    lrs_create_socket("socket2", "TCP", "LocalHost=0", "RemoteHost=lzhg:7001", LrsLastArg);
    lrs_send("socket2", "buf4", LrsLastArg);
    lrs_receive("socket2", "buf5", LrsLastArg);
    lrs_close_socket("socket2");
    lrs_create_socket("socket3", "TCP", "LocalHost=0", "RemoteHost=lzhg:7001", LrsLastArg);
    lrs_send("socket3", "buf6", LrsLastArg);
    lrs_receive("socket3", "buf7", LrsLastArg);
    lrs_close_socket("socket3");
   return 0;

yddtlzg 发表于 2006-8-24 17:05:35

data.ws代码如下:
;WSRData 2 1

send buf0 573
        "POST /sbzhpt/MainServlet HTTP/1.0\n"
        "Content-type:text/html;charset=GBK\n"
        "Content-length: 457\n"
        "SOAPAction: mainservlet\n"
        "\n"
        "<?xml version=\"1.0\" encoding=\"GBK\"?><soap:Envelope xmlns:soap=\"http:/"
        "/schemas.xmlsoap.org/soap/envelope/\" soap:encodingStyle=\"http://schemas."
        "xmlsoap.org/soap/encoding/\"><soap:Header><in:system xmlns:in=\"http://www"
        ".molss.gov.cn/\"><para usr=\"admin\"/><para pwd=\"admin\"/><para funid=\"F"
        "00.00.00.00|10.10.0.41|lzhg|00-0E-35-B0-2F-04\"/></in:system></soap:Header"
        "><soap:Body><in:business xmlns:in=\"http://www.molss.gov.cn/\"></in:busine"
        "ss></soap:Body></soap:Envelope>\n"
        "\n"

recv buf1 3210
        "HTTP/1.1 200 OK\r\n"
        "Date: Thu, 24 Aug 2006 06:11:30 GMT\r\n"
        "Server: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 \r\n"
        "Content-Length: 2911\r\n"
        "Content-Type: text/html;charset=GBK\r\n"
        "Set-Cookie: JSESSIONID=EtDTtALy8dah1z7q1zwO0QHWVlPJ1yOSQZJKC6isvKpFN71yvY9"
        "9!-317667807; path=/\r\n"
        "Connection: Close\r\n"
        "\r\n"
        "<?xml version=\"1.0\" encoding=\"GBK\"?> <soap:Envelope xmlns:soap=\"http:"
        "//schemas.xmlsoap.org/soap/envelope/\" soap:encodingStyle=\"http://schemas"
        ".xmlsoap.org/soap/encoding/\"><soap:Header><out:system xmlns:out=\"http://"
        "www.molss.gov.cn/\"><result sessionID=\"EtDTtALy8dah1z7q1zwO0QHWVlPJ1yOSQZ"
        "JKC6isvKpFN71yvY99!-317667807!1156399891343\"/><result username=\"管理员\""
        "/><result producttype=\"\"/></out:system></soap:Header><soap:Body><out:bus"
        "iness xmlns:out=\"http://www.molss.gov.cn/\"><result sae115=\"0\" /><resul"
        "t userid=\"40\" /><result login_name=\"admin\" /><result aab300=\"大同市社"
        "会保险机构\" /><result aae140=\"('00','1','2','3','301','302','4','5')\" /"
        "><result sab067=\"shzhpt\" /><result passwd=\"admin\" /><result akb020=\"1"
        "0000003\" /><result akb021=\"武警301医院\" /><result usr=\"admin\" /><resu"
        "lt xx=\"\" /><result logid=\"admin\" /><result operator_name=\"管理员\" />"
        "<result aab034=\"01\" /><result x=\"\" /><result pwd=\"admin\" /><resultse"
        "t name=\"acl\"><row id=\"F00.03\"/><row id=\"F01.01.01\"/><row id=\"F01.01"
        ".02\"/><row id=\"F01.02.01\"/><row id=\"F01.02.02\"/><row id=\"F01.02.03\""
        "/><row id=\"F01.02.04\"/><row id=\"F01.02.05\"/><row id=\"F01.02.06\"/><ro"
        "w id=\"F01.02.07\"/><row id=\"F01.02.08\"/><row id=\"F01.02.09\"/><row id="
        "\"F01.02.10\"/><row id=\"F01.02.11\"/><row id=\"F01.02.12\"/><row id=\"F01"
        ".02.13\"/><row id=\"F01.02.14\"/><row id=\"F01.02.15\"/><row id=\"F01.02.1"
        "6\"/><row id=\"F01.02.17\"/><row id=\"F01.02.18\"/><row id=\"F01.02.19\"/>"
        "<row id=\"F02.01.01\"/><row id=\"F02.01.02\"/><row id=\"F02.01.03\"/><row "
        "id=\"F02.01.04\"/><row id=\"F02.01.05\"/><row id=\"F02.01.06\"/><row id=\""
        "F02.01.07\"/><row id=\"F02.01.08\"/><row id=\"F02.01.09\"/><row id=\"F03.0"
        "1.01\"/><row id=\"F03.01.02\"/><row id=\"F03.01.03\"/><row id=\"F03.01.04\""
        "/><row id=\"F03.01.05\"/><row id=\"F03.01.06\"/><row id=\"F03.01.07\"/><ro"
        "w id=\"F03.01.08\"/><row id=\"F03.01.09\"/><row id=\"F03.01.10\"/><row id="
        "\"F03.01.11\"/><row id=\"F03.01.12\"/><row id=\"F03.01.13\"/><row id=\"F03"
        ".01.14\"/><row id=\"F03.01.15\"/><row id=\"F08.01.01\"/><row id=\"F08.01.0"
        "2\"/><row id=\"F08.01.03\"/><row id=\"F08.01.04\"/><row id=\"F08.01.05\"/>"
        "<row id=\"F08.01.06\"/><row id=\"F08.01.07\"/><row id=\"F08.02.01\"/><row "
        "id=\"F08.02.02\"/><row id=\"F08.02.03\"/><row id=\"F08.02.04\"/><row id=\""
        "F08.03.01\"/><row id=\"F08.03.02\"/><row id=\"F08.03.03\"/><row id=\"F08.0"
        "3.04\"/><row id=\"F08.03.05\"/><row id=\"F08.03.06\"/><row id=\"F08.03.07\""
        "/><row id=\"F08.03.08\"/><row id=\"F08.03.09\"/><row id=\"F08.03.10\"/><ro"
        "w id=\"F08.03.11\"/><row id=\"F08.03.12\"/><row id=\"F08.06.01\"/><row id="
        "\"F08.06.02\"/><row id=\"F08.06.03\"/><row id=\"F08.06.04\"/><row id=\"F08"
        ".07.01\"/><row id=\"F08.07.02\"/><row id=\"F15.01\"/><row id=\"F15.02\"/><"
        "row id=\"F15.20\"/><row id=\"F17.01\"/><row id=\"M00\"/><row id=\"M01\"/><"
        "row id=\"M01.01\"/><row id=\"M01.02\"/><row id=\"M02\"/><row id=\"M02.01\""
        "/><row id=\"M03\"/><row id=\"M03.01\"/><row id=\"M08\"/><row id=\"M08.00\""
        "/><row id=\"M08.01\"/><row id=\"M08.02\"/><row id=\"M08.03\"/><row id=\"M0"
        "8.06\"/><row id=\"M08.07\"/><row id=\"M15\"/><row id=\"M17\"/></resultset>"
        "</out:business></soap:Body></soap:Envelope>\r\n"

yddtlzg 发表于 2006-8-24 17:07:37

问题是这样的,我用的协议是winsocket和oracle,现在每登录一次服务器返回一sessionid,我这样才能取到这个sessionid的值?

yddtlzg 发表于 2006-8-24 17:09:04

关于winsocket的问题(问题在三楼)

大家帮忙看看啊

thefirstred 发表于 2006-8-24 17:32:09

http://bbs.51testing.com/viewthread.php?tid=27749&highlight=ftp%2Bthefirstred
这里面有类似的例子:)

yddtlzg 发表于 2006-8-24 17:39:25

楼上的这篇文章我也看了,我觉得你的代码参数化后通过
lrs_create_socket("socket1", "TCP", hostport,LrsLastArg);
传进去了,可是我的好像不行啊

yddtlzg 发表于 2006-8-25 10:00:20

自己再顶一下

yddtlzg 发表于 2006-8-25 15:01:24

终于搞定了,原来看帮助很重要啊,一定要看帮助,郁闷了好几天。呵呵

langqy 发表于 2006-8-25 16:03:49

楼主是怎么搞定的?

sarah_2008 发表于 2006-8-25 16:37:08

是呀,说一下怎么解决的吧?

yddtlzg 发表于 2006-8-25 19:42:31

问了好多人,都说让看帮助呢,后细看了看帮助,
lrs_save_param("socket0", LRS_LAST_RECEIVED, "param1", 549, 76);
中的"param1"必须的这样写,但在输出时得加{}或[]呢如下:
lr_output_message("参数param1的值为:%s",lr_eval_string("{param1}"));
另"参数param1的值为:%s"中的%s必须的加,否则输不出值来

baishuichen 发表于 2009-8-12 11:19:59

为啥楼主Data.ws文件中的内容能够看得懂呢,我录制到的都是16进制的,是用工具转换过还是其它原因啊

jiali_86 发表于 2009-8-12 14:45:40

偶还没学到这个,先来看看,学习一下!:)
页: [1]
查看完整版本: 关于winsocket的问题