Avatar billede havmaage Juniormester
01. december 2016 - 09:43 Der er 1 løsning

VBScript returnere ikke xml ved REST get webservice kald

Hejsa
Jeg kalder en REST wervice der ikke gør andet en starte et worlfow på en anden maskine og returnere status.
Jeg kalder den fra et vbscript på følgende måde

endpoint="http://localhost/oozie/v2/job/"
parameter ="?show=info"
Set objXmlHttpMain = CreateObject("Msxml2.ServerXMLHTTP")
URL = endpoint & resource & parameter
on error resume next
objXmlHttpMain.open "GET",URL, False

objXmlHttpMain.setRequestHeader "Content-Type", "application/xml"


objXmlHttpMain.send
WScript.Echo objXmlHttpMain.responsetext

Den returnere en masse text der ligner en blanding af xml og json.


{"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}


Men når jeg kalder jobbet fra SoapUI for jeg et format tilbage jeg kan parse

<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/</consoleUrl>
        <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>

Er der nogen der kan se hvad jeg kan gøre i mit vbscript for at få bedre responsetext
Avatar billede havmaage Juniormester
06. december 2016 - 11:50 #1
Fandt ud af at det i virkelighedenb er JASON den returnere. Derved kunne jeg finde en jason parser ( vbs klasse ) som jeg kunne bruge.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester