我们可以在 Apigee 的 Javascipt 中将对象转换为 XML

问题描述

我在一个场景中工作,我从 httpCLient 的 getResponse().content 获取 xml 对象。我需要处理响应中存在的值。但它不允许我提取这些值

注意:我不能在我的用例中使用 XML-to-JSON 之类的策略,我只能使用 javascript。因为我正在根据输入中存在的 ID 调用多个 HTTP 请求。

var url = properties.endpoint + '?billingId=' + billingIds[index];
var myRequest = new Request(url,"GET");

context.setvariable("myRequesttest",myRequest);
var exchange = httpClient.send(myRequest);
exchange.waitForComplete();

if (exchange.isSuccess()) {
    var responSEObj = exchange.getResponse().content;
    context.setvariable("response.content",responSEObj);
    context.setvariable("myResponse",responSEObj);
} else if (exchange.isError()) {
     context.setvariable("myResponseError",exchange.getError());
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)