51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 9564|回复: 7
打印 上一主题 下一主题

[求助] web_custom_request实现文件上传的问题(已解决)

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-5-23 10:21:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
功能实现:通过HTTP方式上传一个Tif图片文件到服务器。

求助:web_custom_request 这个函数在实现文件上传时,是不是需要添加其它的属性? 请高手指点~

LR录制的脚本内容如下:

web_submit_data("createscan.do_11",
        "Action=http://10.168.188.213:8080/ECIMC/jsp/action/fund/imagescan/createscan.do?action=submitScanFileInfo&SERVICE_STYLE=11&FILE_PKG_ID={FILE_PKG_ID}&SOURCE_FILE_NAME=C:%255CECIMC%255CCreateScan%255CScanFile%255CZJKH%255C2008-05-20%255C5.tif&FILE_TYPE=.tif&FILE_SIZE=90&FILE_PAGES=1&CRC_VALUE=&TITLE=&THEME=&KEY_WORD=&CREATER=&MODIFY_NO=&OPEN_MODE=&CREATE_DATE=&CREATE_TIME=&LAST_MOD_DATE=&LAST_MOD_TIME=&FILE_CHECK=&NOTE=&SOURCE_NO=19&redirectFlag=1",
        "Method=POST",
        "RecContentType=text/xml",
        "Referer=http://10.168.188.213:8080/ECIMC/jsp/action/fund/imagescan/createscan.do?redirectFlag=1",
        "Snapshot=t17.inf",
        "Mode=HTML",
        ITEMDATA,
        LAST);

web_url("FileService",
        "URL=http://10.168.188.213:8080/fileservice/servlet/FileService?randNum=41",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t18.inf",
        "Mode=HTML",
         LAST);

web_custom_request("FileService_2",
        "URL=http://10.168.188.213:8080/fileservice/servlet/FileService",
        "Method=POST",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t19.inf",
        "Mode=HTML",
        "EncType=",
        body_variable_1,    //上传的图片文件的 Body部分。BodyBinary=II*\x00 ……
    LAST);()

[ 本帖最后由 5555 于 2008-5-23 14:20 编辑 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2008-5-23 10:21:27 | 只看该作者
直接打开可以正常上传,没有出错,我抓下来的包是这样子的:
POST /fileservice/servlet/FileService HTTP/1.1
Accept: */*
Accept-Language: zh-cn
optype: upload
offset: 0
path: IMAGE%5CZJZH%5C2008%5C05%5C20080522%5C
request-type: filetransfer
filedomain: ECIMC_FS
transfer_file: true
filename: #111111111_4567891230_00000000000870.tif
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: 10.168.188.213:8080
Content-Length: 89021
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=D87FC05706CD5A17B3E06959158124E6

II*……(后面是图片文件内容)

[ 本帖最后由 5555 于 2008-5-23 10:25 编辑 ]
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2008-5-23 10:22:10 | 只看该作者
回放后报错如下:
fileupload.c(270): web_custom_request("FileService_2") started          [MsgId: MMSG-26355]
fileupload.c(270): t=21015ms: Already connected to 10.168.188.213:8080          [MsgId: MMSG-26000]
fileupload.c(270): t=21015ms: 380-byte request headers for "http://10.168.188.213:8080/fileservice/servlet/FileService" (RelFrameId=1)
fileupload.c(270):     POST /fileservice/servlet/FileService HTTP/1.1\r\n
fileupload.c(270):     Cache-Control: no-cache\r\n
fileupload.c(270):     User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR
fileupload.c(270):      2.0.50727)\r\n
fileupload.c(270):     Accept-Encoding: gzip, deflate\r\n
fileupload.c(270):     Accept-Language: zh-cn\r\n
fileupload.c(270):     Accept: */*\r\n
fileupload.c(270):     Connection: Keep-Alive\r\n
fileupload.c(270):     Host: 10.168.188.213:8080\r\n
fileupload.c(270):     Cookie: APP_ID=7; JSESSIONID=885CFC64346ACE25A168B04835F06659\r\n
fileupload.c(270):     Content-Length: 3\r\n
fileupload.c(270):     \r\n
fileupload.c(270): t=21019ms: 3-byte request body for "http://10.168.188.213:8080/fileservice/servlet/FileService" (RelFrameId=1)
fileupload.c(270):     II*
fileupload.c(270): t=21022ms: 182-byte response headers for "http://10.168.188.213:8080/fileservice/servlet/FileService" (RelFrameId=1)
fileupload.c(270):     HTTP/1.1 500 Internal Server Error\r\n
fileupload.c(270):     Server: Apache-Coyote/1.1\r\n
fileupload.c(270):     Content-Type: text/html;charset=utf-8\r\n
fileupload.c(270):     Content-Length: 1725\r\n
fileupload.c(270):     Date: Fri, 23 May 2008 02:10:04 GMT\r\n
fileupload.c(270):     Connection: close\r\n
fileupload.c(270):     \r\n
fileupload.c(270): t=21032ms: 1725-byte response body for "http://10.168.188.213:8080/fileservice/servlet/FileService" (RelFrameId=1)
fileupload.c(270):     <html><head><title>JBossWeb/2.0.0.GA_CP05 - Error report</title><style><!--H1 {font-family
fileupload.c(270):     :Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-fa
fileupload.c(270):     mily:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {fon
fileupload.c(270):     t-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BOD
fileupload.c(270):     Y {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family
fileupload.c(270):     :Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Aria
fileupload.c(270):     l,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color
fileupload.c(270):     : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size
fileupload.c(270):     ="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p>
fileupload.c(270):     <b>description</b> <u>The server encountered an internal error () that prevented it from f
fileupload.c(270):     ulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException\n
fileupload.c(270):     \tcom.shine.fs.DomainInfo.getPath(DomainInfo.java:22)\n
fileupload.c(270):     \tcom.shine.fs.servlet.FileService.doPost(FileService.java:84)\n
fileupload.c(270):     \tjavax.servlet.http.HttpServlet.service(HttpServlet.java:710)\n
fileupload.c(270):     \tjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)\n
fileupload.c(270):     \tcom.shine.filter.LoginFilter.doFilter(LoginFilter.java:100)\n
fileupload.c(270):     \tedu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:218)\n
fileupload.c(270):     \tcom.shine.esim.struts.webutil.SetEncodeFilter.doFilter(SetEncodeFilter.java:51)\n
fileupload.c(270):     \torg.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)\n
fileupload.c(270):     </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBo
fileupload.c(270):     ssWeb/2.0.0.GA_CP05 logs.</u></p><HR size="1" noshade="noshade"><h3>JBossWeb/2.0.0.GA_CP05
fileupload.c(270):     </h3></body></html>
fileupload.c(270): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://10.168.188.213:8080/fileservice/servlet/FileService"          [MsgId: MERR-26612]
fileupload.c(270): t=21042ms: Closing connection to server 10.168.188.213 because server indicated that the connection should be closed          [MsgId: MMSG-26000]
fileupload.c(270): t=21043ms: Closed connection to 10.168.188.213:8080 after completing 76 requests          [MsgId: MMSG-26000]
fileupload.c(270): t=21043ms: Request done "http://10.168.188.213:8080/fileservice/servlet/FileService"          [MsgId: MMSG-26000]
fileupload.c(270): web_custom_request("FileService_2") highest severity level was "ERROR", 1725 body bytes, 182 header bytes          [MsgId: MMSG-26388]

[ 本帖最后由 5555 于 2008-5-23 10:27 编辑 ]
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2008-5-23 14:20:03 | 只看该作者
加头文件后搞定,谢谢关注!
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2009-11-5 17:41:29 | 只看该作者

关于web_custom_request和web_submit_data,急求大家帮忙

这两个函数有什么区别
另外为什么我录制的时候之前都是web_submit_data
今天同样的东西录制出来变成了web_custom_request
是我的录制方式变了还是由于代码的问题?

web_custom_request用的很少,不知道怎么参数化了
谢谢大家帮忙 !!!
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2011-8-12 14:02:36 | 只看该作者
回复 5# xxyyzzz


文件路径中存在中文时录制出来就是web_custome_request,包含文件内容;
反之,就是另一个函数,不包含文件内容。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2011-8-12 14:03:17 | 只看该作者
回复 4# 5555


    加了什么啊?加在哪里了?能否说的详细点。谢谢!
回复 支持 反对

使用道具 举报

该用户从未签到

8#
发表于 2012-9-17 09:53:34 | 只看该作者
globals中的头文件在哪里打开查看
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-9 10:42 , Processed in 0.071417 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表