本文介绍了在javascript中处理来自soap wsdl的JSON响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理来自soap wsdl.i的以下json响应需要特别是PERSON_ID从此打印在我的HTML FILE中。实际上我有一个javascript代码,我正在研究IBM mobiefirst.any身体帮助请问?

how to handle the below json response from soap wsdl.i need particularly PERSON_ID from this to be printed in my HTML FILE.actually i have a javascript code for this and am working on IBM mobiefirst.any body help pls??

var str= result;
        alert(str);
        var ID = str.Envelope.Body.processResponse.PERSON_ID;
	    alert(ID);
{
   "Envelope": {
      "Body": {
         "processResponse": {
            "ERROR_CODE": "S",
            "ERROR_MSG": "Login Successful",
            "GROUPS_ID": "76721",
            "PERSON_ID": "309236",
            "PERSON_LOGIN": "Y",
            "PERSON_NAME": "Welcome! ashanka",
            "PERSON_ROLE": "Y",
            "PERSON_UID": "1014336",
            "client": "http:\/\/xmlns.oracle.com\/InternetMobile\/AbsManagement\/BPELProcessUserLogin",
            "xmlns": "http:\/\/xmlns.oracle.com\/InternetMobile\/AbsManagement\/BPELProcessUserLogin"
         }
      },
      "Header": {
         "FaultTo": {
            "Address": "http:\/\/www.w3.org\/2005\/08\/addressing\/anonymous"
         },
         "MessageID": "urn:C9C4DB207D5211E5BF9B25E60F40847D",
         "ReplyTo": {
            "Address": "http:\/\/www.w3.org\/2005\/08\/addressing\/anonymous"
         }
      },
      "env": "http:\/\/schemas.xmlsoap.org\/soap\/envelope\/",
      "wsa": "http:\/\/www.w3.org\/2005\/08\/addressing"
   },
   "errors": [
   ],
   "info": [
   ],
   "isSuccessful": true,
   "responseHeaders": {
      "Content-Length": "1017",
      "Content-Type": "text\/xml; charset=utf-8",
      "Date": "Wed, 28 Oct 2015 09:03:42 GMT",
      "SOAPAction": "\"\"",
      "X-ORACLE-DMS-ECID": "9e10a9dcf92c80fa:-8e91c30:150a34b187a:-8000-0000000000053e79",
      "X-Powered-By": "Servlet\/2.5 JSP\/2.1"
   },
   "responseTime": 106,
   "statusCode": 200,
   "statusReason": "OK",
   "totalTime": 122,
   "warnings": [
   ]
}

推荐答案

您可以执行以下操作:

var str = //您的JSON响应...
var ID = str.Envelope.Body.processResponse.PERSON_ID;

var str = //your JSON response...var ID = str.Envelope.Body.processResponse.PERSON_ID;

//如果你使用jQuery

//if you use jQuery

jQuery (#htmlelementid)。html(ID);

jQuery("#htmlelementid").html(ID);

// else

document.querySelectorAll( #htmlelementid)。innerHTML = ID;

document.querySelectorAll("#htmlelementid").innerHTML = ID;

这篇关于在javascript中处理来自soap wsdl的JSON响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 07:06