简体   繁体   English

将AngularJS App与SoftwareAG webMethods Integration Server集成

[英]Integrate AngularJS App with SoftwareAG webMethods Integration Server

I have been trying to set up a sample AngularJS app with webMethods Integration Server on the backend. 我一直在尝试在后端使用webMethods Integration Server设置示例AngularJS应用。 Using $resource, I can easily pull normal JSON files and manipulate the data within the file. 使用$ resource,我可以轻松提取普通的JSON文件并操纵文件中的数据。 However, the goal is that I want to create services in webMethods Designer and call them from AngularJS using $resource to display the data in my app. 但是,目标是我要在webMethods Designer中创建服务,并使用$ resource从AngularJS调用它们以在我的应用程序中显示数据。 The problem is that from AngularJS I cannot extract the data I need from the service that I'm creating in Designer. 问题是从AngularJS中我无法从我在Designer中创建的服务中提取所需的数据。 In Designer I can use (in WMPublic) documentToJSONString, and output something like: 在Designer中,我可以使用(在WMPublic中)documentToJSONString,并输出如下内容:

jsonString  {"id":"1", "name":"Dan", "quantity":"3"}

But I cannot extract the data because this is not a pure JSON string. 但是我无法提取数据,因为这不是纯JSON字符串。 Does anyone know how to (1) extract the JSON string output data using AnularJS or (2) output a JSON document from Designer? 有谁知道如何(1)使用AnularJS提取JSON字符串输出数据,或(2)从Designer输出JSON文档? I am calling a REST service; 我正在呼叫REST服务; something to the effect of 有影响的东西

http://localhost:2222/rest/Get/getOrderData 

from my services.js file in AngularJS. 从我在AngularJS中的services.js文件中。

Here is my services.js file: 这是我的services.js文件:

/* Services */ /* 服务 */

var orderServices = angular.module('orderServices', ['ngResource']);

orderServices.factory('Order', ['$resource',
  function($resource){
    return $resource('http://localhost:2222/rest/REST/getOrderData', {}, {
       query: {method:'GET', isArray:true}
  });

}]);

Then, in my app, I want to use an ng-repeat to call things like {{order.id}}, {{order.name}} etc. Is anyone good with webMethods and Angular or done this before? 然后,在我的应用程序中,我想使用ng-repeat调用诸如{{order.id}},{{order.name}}等之类的东西。是否有人曾经使用过webMethods和Angular?

To force the response that you want, I would have used the service pub.flow:setResponse mapping the jsonString to it's string parameter and probably hardcoded (eww!) the contentType parameter to 'application/json' 为了强制执行所需的响应,我将使用pub.flow:setResponse服务将jsonString映射到其字符串参数,并且可能将contentType参数硬编码(eww!)到'application / json'

You may also need to use the service pub.flow:setResponseCode to set the response code. 您可能还需要使用服务pub.flow:setResponseCode来设置响应代码。

They would be the last services in getOrderData 它们将是getOrderData中的最后一个服务

I would have invoked it using the below (where namespace is the folder structure in designer) 我将使用以下方法调用它(其中名称空间是设计器中的文件夹结构)

http://localhost:2222/invoke/namespace:getOrderData 

The above applies to Integration Server V8 and it looks like you're using V9 since some of the services that you mention didn't exist in V8. 以上内容适用于Integration Server V8,由于您提到的某些服务在V8中不存在,因此您似乎正在使用V9。 This would also apply to a normal flow service, not a specific REST one (assuming they exist in V9). 这也适用于普通流服务,而不是特定的REST服务(假设它们存在于V9中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM