Json VBScript rest webservice调用返回的格式与SoapUI不同
我正在使用VBScript在数据流中调用REST Web服务。 当我使用soapUI测试webservice时,它返回我可以使用VBScript分离的xml。 但是,当我在VBScript中使用Msxml2.ServerXMLHTTP.6.0 witn时,它以我无法解析的不同格式返回数据 我的VBScriptJson VBScript rest webservice调用返回的格式与SoapUI不同,json,ajax,vbscript,asp-classic,Json,Ajax,Vbscript,Asp Classic,我正在使用VBScript在数据流中调用REST Web服务。 当我使用soapUI测试webservice时,它返回我可以使用VBScript分离的xml。 但是,当我在VBScript中使用Msxml2.ServerXMLHTTP.6.0 witn时,它以我无法解析的不同格式返回数据 我的VBScript endpoint="http://localhost/oozie/v2/job/" parameter ="?show=info" Set objXmlHttpMain = Create
endpoint="http://localhost/oozie/v2/job/"
parameter ="?show=info"
Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP.6.0")
URL = endpoint & resource & parameter
on error resume next
objXmlHttpMain.open "GET",URL, False
objXmlHttpMain.setRequestHeader "Content-Type", "application/xml"
objXmlHttpMain.send
response = objXmlHttpMain.responsetext
WScript.Echo response
当我试着转换时
objXmlHttpMain.responsetext to objXmlHttpMain.responseXML
我一点输出都没有
首先,这是SoapUI调用samme服务的输出,这个输出就是我在vbscript中寻找的
<Response xmlns="localhost/oozie/v2/job/0000140-161115133330924-oozie-oozi-W">
<acl null="true"/>
<actions>
<e>
<conf/>
<consoleUrl>-</consoleUrl>
<cred null="true"/>
<data null="true"/>
<endTime>Wed, 30 Nov 2016 13:56:51 GMT</endTime>
<errorCode null="true"/>
<errorMessage null="true"/>
<externalChildIDs null="true"/>
<externalId>-</externalId>
<externalStatus>OK</externalStatus>
<id>0000140-161115133330924-oozie-oozi-W@:start:</id>
<name>:start:</name>
<retries>0</retries>
<startTime>Wed, 30 Nov 2016 13:56:51 GMT</startTime>
<stats null="true"/>
<status>OK</status>
<toString>Action name[:start:] status[OK]</toString>
<trackerUri>-</trackerUri>
<transition>run_hive_script</transition>
<type>:START:</type>
<userRetryCount>0</userRetryCount>
<userRetryInterval>10</userRetryInterval>
<userRetryMax>0</userRetryMax>
</e>
<e>
<conf><![CDATA[<hive xmlns="uri:oozie:hive-action:0.4">
<job-tracker>localhost:80</job-tracker>
<name-node>hdfs://localhost:8020</name-node>
<script>/tmp/scripts/ingest/hivetest2.hql</script>
<configuration />
</hive>]]></conf>
<consoleUrl>http://localhost:8088/proxy/application_1479975743615_0124/</console Url >
<cred null="true"/>
<data null="true"/>
<endTime>Wed, 30 Nov 2016 14:12:20 GMT</endTime>
<errorCode>JA018</errorCode>
<errorMessage>java.lang.ClassNotFoundException: Class org.apache.oozie.action.hadoop.HiveMain not found</errorMessage>
<externalChildIDs null="true"/>
<externalId>job_1479975743615_0124</externalId>
<externalStatus>FAILED/KILLED</externalStatus>
<id>0000140-161115133330924-oozie-oozi-W@run_hive_script</id>
<name>run_hive_script</name>
<retries>0</retries>
<startTime>Wed, 30 Nov 2016 13:56:52 GMT</startTime>
<stats null="true"/>
<status>ERROR</status>
<toString>Action name[run_hive_script] status[ERROR]</toString>
<trackerUri>localhost:8050</trackerUri>
<transition>kill_job</transition>
<type>hive</type>
<userRetryCount>0</userRetryCount>
<userRetryInterval>10</userRetryInterval>
<userRetryMax>0</userRetryMax>
</e>
<e>
<conf>Job failed</conf>
<consoleUrl>-</consoleUrl>
<cred null="true"/>
<data null="true"/>
<endTime>Wed, 30 Nov 2016 14:12:20 GMT</endTime>
<errorCode>E0729</errorCode>
<errorMessage>Job failed</errorMessage>
<externalChildIDs null="true"/>
<externalId>-</externalId>
<externalStatus>OK</externalStatus>
<id>0000140-161115133330924-oozie-oozi-W@kill_job</id>
<name>kill_job</name>
<retries>0</retries>
<startTime>Wed, 30 Nov 2016 14:12:20 GMT</startTime>
<stats null="true"/>
<status>OK</status>
<toString>Action name[kill_job] status[OK]</toString>
<trackerUri>-</trackerUri>
<transition null="true"/>
<type>:KILL:</type>
<userRetryCount>0</userRetryCount>
<userRetryInterval>10</userRetryInterval>
<userRetryMax>0</userRetryMax>
</e>
</actions>
<appName>simple-Workflow</appName>
<appPath>hdfs://localhost/tmp/scripts/ingest/oozie-test-wf- params.xml</appPath>
<conf><![CDATA[<configuration>
<property>
<name>oozie.wf.application.path</name>
<value>hdfs:localhost/tmp/scripts/ingest/oozie-test-wf-params.xml</value>
</property>
<property>
<name>user.name</name>
<value>username</value>
</property>
<property>
<name>jobTracker</name>
<value>localhost:80</value>
</property>
<property>
<name>mapreduce.job.user.name</name>
<value>username</value>
</property>
<property>
<name>nameNode</name>
<value>hdfs://sktttst01hdp01.ccta.dk:8020</value>
</property>
</configuration>]]></conf>
<consoleUrl>http://localhost:11000/oozie?job=0000140-161115133330924-oozie-oozi-W</consoleUrl>
<createdTime>Wed, 30 Nov 2016 13:56:50 GMT</createdTime>
<endTime>Wed, 30 Nov 2016 14:12:20 GMT</endTime>
<externalId null="true"/>
<group null="true"/>
<id>0000140-161115133330924-oozie-oozi-W</id>
<lastModTime>Wed, 30 Nov 2016 14:12:20 GMT</lastModTime>
<parentId null="true"/>
<run>0</run>
<startTime>Wed, 30 Nov 2016 13:56:51 GMT</startTime>
<status>KILLED</status>
<toString>Workflow id[0000140-161115133330924-oozie-oozi-W] status[KILLED] </toString>
<user>username</user>
</Response>
-
2016年11月30日星期三13:56:51 GMT
-
好啊
0000140-161115133330924-oozie-oozi-W@:开始:
:开始:
0
2016年11月30日星期三13:56:51 GMT
好啊
操作名称[:开始:]状态[确定]
-
运行配置单元脚本
:开始:
0
10
0
本地主机:80
hdfs://localhost:8020
/tmp/scripts/inset/hivetest2.hql
]]>
http://localhost:8088/proxy/application_1479975743615_0124/
2016年11月30日星期三14:12:20 GMT
JA018
java.lang.ClassNotFoundException:找不到类org.apache.oozie.action.hadoop.HiveMain
作业号1479975743615
失败/终止
0000140-161115133330924-oozie-oozi-W@run_hive_script
运行配置单元脚本
0
2016年11月30日星期三13:56:52 GMT
错误
操作名称[运行配置单元脚本]状态[错误]
本地主机:8050
干掉你的工作
蜂箱
0
10
0
作业失败
-
2016年11月30日星期三14:12:20 GMT
E0729
作业失败
-
好啊
0000140-161115133330924-oozie-oozi-W@kill_job
干掉你的工作
0
2016年11月30日星期三14:12:20 GMT
好啊
动作名称[kill_job]状态[OK]
-
:杀死:
0
10
0
简单工作流
hdfs://localhost/tmp/scripts/ingest/oozie-test-wf- params.xml
oozie.wf.application.path
hdfs:localhost/tmp/scripts/inset/oozie-test-wf-params.xml
用户名
用户名
求职者
本地主机:80
mapreduce.job.user.name
用户名
名称节点
hdfs://sktttst01hdp01.ccta.dk:8020
]]>
http://localhost:11000/oozie?job=0000140-16111513330924-oozie-oozi-W
2016年11月30日星期三13:56:50 GMT
2016年11月30日星期三14:12:20 GMT
0000140-161115133330924-oozie-oozi-W
2016年11月30日星期三14:12:20 GMT
0
2016年11月30日星期三13:56:51 GMT
被杀死的
工作流id[0000140-16111513330924-oozie-oozi-W]状态[已终止]
用户名
这是脚本response.text的输出
{"appName":"simple-Workflow","externalId":null,"conf":"<configuration>\r\n <property>\r\n <name>oozie.wf.application.path<\/name>\r\n <value>hd
fs:\/\/localhost\/tmp\/scripts\/ingest\/oozie-test-wf-params.xml<\/value>\r\n <\/property>\r\n <property>\r\n <name>user.name<\/name
>\r\n <value>username<\/value>\r\n <\/property>\r\n <property>\r\n <name>jobTracker<\/name>\r\n <value>localhost:80<\/value
>\r\n <\/property>\r\n <property>\r\n <name>mapreduce.job.user.name<\/name>\r\n <value>username<\/value>\r\n <\/property>\r\n <property>\r\
n <name>nameNode<\/name>\r\n <value>hdfs:\/\/localhost:8020<\/value>\r\n <\/property>\r\n<\/configuration>","run":0,"acl":null,"ap
pPath":"hdfs:\/\/localhost\/tmp\/scripts\/ingest\/oozie-test-wf-params.xml","parentId":null,"lastModTime":"Wed, 30 Nov 2016 14:12:20 GMT"
,"consoleUrl":"http:\/\/localhost:11000\/oozie?job=0000140-161115133330924-oozie-oozi-W","createdTime":"Wed, 30 Nov 2016 13:56:50 GMT","s
tartTime":"Wed, 30 Nov 2016 13:56:51 GMT","toString":"Workflow id[0000140-161115133330924-oozie-oozi-W] status[KILLED]","id":"0000140-161115133330924-
oozie-oozi-W","endTime":"Wed, 30 Nov 2016 14:12:20 GMT","user":"username","actions":[{"cred":null,"userRetryMax":0,"trackerUri":"-","data":null,"erro
rMessage":null,"userRetryCount":0,"externalChildIDs":null,"externalId":"-","errorCode":null,"conf":"","type":":START:","transition":"run_hive_script",
"retries":0,"consoleUrl":"-","stats":null,"userRetryInterval":10,"name":":start:","startTime":"Wed, 30 Nov 2016 13:56:51 GMT","toString":"Action name[
:start:] status[OK]","id":"0000140-161115133330924-oozie-oozi-W@:start:","endTime":"Wed, 30 Nov 2016 13:56:51 GMT","externalStatus":"OK","status":"OK"
},{"cred":null,"userRetryMax":0,"trackerUri":"localhost:80","data":null,"errorMessage":"java.lang.ClassNotFoundException: Class org.apa
che.oozie.action.hadoop.HiveMain not found","userRetryCount":0,"externalChildIDs":null,"externalId":"job_1479975743615_0124","errorCode":"JA018","conf
":"<hive xmlns=\"uri:oozie:hive-action:0.4\">\r\n <job-tracker>localhost:80<\/job-tracker>\r\n <name-node>hdfs:\/\/sktttst01hdp01.cct
a.dk:8020<\/name-node>\r\n <script>\/tmp\/scripts\/ingest\/hivetest2.hql<\/script>\r\n <configuration \/>\r\n<\/hive>","type":"hive","transition":"k
ill_job","retries":0,"consoleUrl":"http:\/\/localhost:80\/proxy\/application_1479975743615_0124\/","stats":null,"userRetryInterval":10,
"name":"run_hive_script","startTime":"Wed, 30 Nov 2016 13:56:52 GMT","toString":"Action name[run_hive_script] status[ERROR]","id":"0000140-16111513333
0924-oozie-oozi-W@run_hive_script","endTime":"Wed, 30 Nov 2016 14:12:20 GMT","externalStatus":"FAILED\/KILLED","status":"ERROR"},{"cred":null,"userRet
ryMax":0,"trackerUri":"-","data":null,"errorMessage":"Job failed","userRetryCount":0,"externalChildIDs":null,"externalId":"-","errorCode":"E0729","con
f":"Job failed","type":":KILL:","transition":null,"retries":0,"consoleUrl":"-","stats":null,"userRetryInterval":10,"name":"kill_job","startTime":"Wed,
30 Nov 2016 14:12:20 GMT","toString":"Action name[kill_job] status[OK]","id":"0000140-161115133330924-oozie-oozi-W@kill_job","endTime":"Wed, 30 Nov 2
016 14:12:20 GMT","externalStatus":"OK","status":"OK"}],"status":"KILLED","group":null}
{“appName”:“简单工作流”,“externalId”:null,“conf”:“\r\n\r\n oozie.wf.application.path\r\n
fs:\/\/localhost\/tmp\/scripts\/ingest\/oozie test wf params.xml\r\n\r\n\r\n user.name\r\n username\r\n\r\n\r\n jobTracker\r\n localhost:80\r\n\r\n\r\n\r\n mapreduce.job.user.name\r\n username\r\n\r\n\r\n\r\n\
n nameNode\r\n hdfs:\/\/localhost:8020\r\n\r\n,“运行”:0,“acl”:null,“ap”
pPath:“hdfs:\/\/localhost\/tmp\/scripts\/insect\/oozie test wf params.xml”,“parentId”:null,“lastModTime:“Wed,2016年11月30日14:12:20 GMT”
,consoleUrl:“http:\/\/localhost:11000\/oozie?job=0000140-16111513330924-oozie-oozi-W”,“createdTime:“2016年11月30日星期三13:56:50 GMT”,“s”
tartTime:“2016年11月30日星期三13:56:51 GMT”,“toString:“工作流id[0000140-16111513330924-oozie-oozi-W]状态[已终止],“id:“0000140-16111513330924”-
oozie-oozi-W,“结束时间”:“Wed,2016年11月30日14:12:20 GMT”,“用户”:“用户名”,“操作”:[{“cred”:null,“userRetryMax”:0,“trackerUri”:“-”,“数据”:null,”erro
rMessage“:null,“userRetryCount”:0,“ExternalChildId”:null,“externalId:”,“errorCode”:null,“conf:”,“type:”:START:“,“transition:“run_hive_script”,
“重试次数”:0,“consoleUrl:”,“stats:”null,“userRetryInterval:”10,“name:”:start:”,“startTime:“Wed,Nov 2016 13:56:51 GMT”,“toString:”操作名称[
:开始:]状态[OK],“id”:“0000140-161115133330924-oozie-oozi-W@:开始:,“结束时间”:“Wed,Nov 2016 13:56:51 GMT”,“外部状态”:“OK”,“状态”:“OK”
},{“cred”:null,“userRetryMax”:0,“trackerri”:“localhost:80”,“data”:null,“errorMessage”:“java.lang.ClassNotFoundException:Class org.apa”
未找到che.oozie.action.hadoop.HiveMain,“userRetryCount”:0,“ExternalChildId”:null,“externalId”:“job_1479975743615_0124”,“errorCode”:“JA018”,“conf”
“:”\r\n本地主机:80\r\n hdfs:\/\/sktttst01hdp01.cct
a、 dk:8020\r\n\/tmp\/scripts\/inset\/hivetest2.hql\r\n\r\n,“类型”:“蜂巢”,“转换”:“k
ill\u job,“retries”:0,“consoleUrl”:“http:\/\/localhost:80\/proxy\/application\u 1479975743615\u 0124\/”,“stats”:null,“userRetryInterval”:10,
“名称”:“运行配置单元脚本”,“开始时间”:“2016年11月30日星期三13:56:52 GMT”,“toString”:“操作名称[运行配置单元脚本]状态[错误],“id”:“0000140-16111513333”
0924欧齐欧齐-W@run_hive_script“,”结束时间“:”2016年11月30日星期三14:12:20 GMT“,”外部状态“:”失败\/KILLED“,”状态“:”ERROR”},{“cred”:null,“userRet”
ryMax“:0,“trackerUri:”,“data”:null,“errorMessage:“作业失败”,“userRetryCount”:0,“ExternalChildId”:null,“externalId:”,“errorCode:“E0729”,“con”
f:“作业失败”、“类型”:“终止”:“转换”:null、“重试”:0、“控制台”:“-”、“统计”:null、“userRetryInterval”:10、“名称”:“终止作业”、“开始时间”:“Wed,
2016年11月30日格林尼治标准时间14:12:20,“toString:“动作名称[杀死作业]状态[确定],“id:”0000140-16111513330924-oozie-oozi-W@kill_job,“结束时间”:“11月30日,星期三”
格林尼治时间016 14:12:20,“外部状态”:“确定”,“状态”:“确定”}],“状态”:“已终止”,“组”:null}
由于API支持多种响应格式,您必须告诉它要使用何种响应格式,这是通过HTTP头接受来完成的
从
Accept request header字段可用于指定响应可接受的某些媒体类型
区别在于SoapUI将自动设置Accept
头,因为它总是处理SOAP XML
所以只需更改setRequestHeader
objXmlHttpMain.setRequestHeader "Accept", "application/xml"