web_custom_request实现文件上传的问题(已解决)
功能实现:通过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 编辑 ] 直接打开可以正常上传,没有出错,我抓下来的包是这样子的:
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 编辑 ] 回放后报错如下:
fileupload.c(270): web_custom_request("FileService_2") started
fileupload.c(270): t=21015ms: Already connected to 10.168.188.213:8080
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"
fileupload.c(270): t=21042ms: Closing connection to server 10.168.188.213 because server indicated that the connection should be closed
fileupload.c(270): t=21043ms: Closed connection to 10.168.188.213:8080 after completing 76 requests
fileupload.c(270): t=21043ms: Request done "http://10.168.188.213:8080/fileservice/servlet/FileService"
fileupload.c(270): web_custom_request("FileService_2") highest severity level was "ERROR", 1725 body bytes, 182 header bytes
[ 本帖最后由 5555 于 2008-5-23 10:27 编辑 ] 加头文件后搞定,谢谢关注!:)
关于web_custom_request和web_submit_data,急求大家帮忙
这两个函数有什么区别另外为什么我录制的时候之前都是web_submit_data
今天同样的东西录制出来变成了web_custom_request
是我的录制方式变了还是由于代码的问题?
web_custom_request用的很少,不知道怎么参数化了
谢谢大家帮忙 !!! 回复 5# xxyyzzz
文件路径中存在中文时录制出来就是web_custome_request,包含文件内容;
反之,就是另一个函数,不包含文件内容。 回复 4# 5555
加了什么啊?加在哪里了?能否说的详细点。谢谢! globals中的头文件在哪里打开查看
页:
[1]