How to call ION API in xtend M3 code through end point?
Need to call web service (IPS) in xtend M3 code.
Is there any way to implement this?
Thanks in advance
Hello,
Here's a example of how you can call IPS API via XtendM3.
public class TestAPI extends ExtendM3Transaction { private final LoggerAPI logger private final IonAPI ion public TestAPI(LoggerAPI logger, IonAPI ion) { this.logger = logger this.ion = ion } /** * Main method * @param * @return */ public void main() { def endpoint = "/M3/ips/service/endpoint" def headers = ["Accept": "application/xml", "Content-Type": "application/xml"] def queryParameters = (Map) null // define as map if there are any query parameters e.g. ["name1": "value1", "name2": "value2"] def formParameters = '''<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="">schemas.xmlsoap.org/.../" xmlns:cred="">lawson.com/.../credentials" xmlns:upd="">schemas.infor.com/.../endpoint"> <SOAP-ENV:Header> <cred:lws> </cred:lws> </SOAP-ENV:Header> <SOAP-ENV:Body> </SOAP-ENV:Body></SOAP-ENV:Envelope>''' IonResponse response = ion.post(endpoint, headers, queryParameters, formParameters) logger.debug(response.toString()) if (response.getError()) { logger.debug("Failed calling ION API, detailed error message: ${response.getErrorMessage()}") return } if (response.getStatusCode() != 200) { logger.debug("Expected status 200 but got ${response.getStatusCode()} instead") return } String content = response.getContent() logger.debug(content) if (content != null) { logger.debug("Expected content from the request but got no content") return } }}You should be able to get the SOAP request in ION API. You can find the Infor documentation here.
Hey, would it be possible to execute TestAPI Transaction via ION API again?
Sure. Here's the request and response of the XtendM3 API call from ION API
Thanks
Hi Ajay, This looks good, I was looking to develop a similar one to use the same in MEC mapper but I came to know about the limitations of using XtendM3 transactions in MEC mapper if it calls IONAPI. So I have never tried, is it possible to use the xtendM3 transaction you created in MEC mapper?
I can answer that, since we are doing just that here, the answer is Yes.
ION Api's should not be used in MEC (EC).
You will receive a "authorization denied" in Runtime.
That was not the question! It was calling ION API in XTendM3, which in turn can be called in IEC.This is NOT a problem!
I managed to call an IPS in an API created by XtendM3.The API works well and triggers my IPS with the parameters I give it. In a Workflow or in a DataFlowI then tried to call my API in a MEC mapping (IEC).The mapping execution is fine, but the IPS is not triggered.Has anyone been able to do this?Thanks.
Christophe H.
Hi christophe, can you sent me example of your XtendM3 API (which calls the IPS) ?
thanks and kind rergards
Ivo