Skip to content


Calling SmartConnect Rest Service getmpxml and runmapxml

Anthony Sale asked 3 years ago
I have a map that takes an xml document and transforms it. I would like to call this map from the rest service. I can use the getmapxml endpoint which correctly returns the data, but does not accept an XML document as input. I can call runmapxml will allows me to post the XML input but does not return the XML output. I’m obviously missing something any help greatly appreciated.
Ethan Sorenson Staff answered 3 years ago
The SmartConnect web service will take the source you provided as the XML document and use that as the source, regardless of the defined data source. This means it will not apply any logic the map was setup to use in the data source query. All the service is doing is taking the columns and writing them to the destination. 
You will need to do any querying or transformation necessary in the external application before sending it to the SmartConnect web service.
I’m not familiar with your particular scenario, but another option could be to have the application create the XML document and save it as a file in a location that SmartConnect can access. Then set that location as the data source for the map, and simply use the /runmap/{mapid} command to run the map with the most recent file in the specified location. With this approach SmartConnect will run the map and use your transformation just as if you were running it manually. 
*Note, SmartConnect will run the map on the web server, so the file location will need to be accessible on that machine.
Patrick Roth Staff answered 3 years ago
The purpose of GetMapXML is to call a destination Map ID and return all of the data from its data source.
The purpose of RunMapXML is to execute a destination Map ID and pass the data to process it with.  The output of that map goes wherever the map output is – GP, Salesforce, CRM, BC etc.
Because the destination can be “non text files”, there isn’t a built-in method that allows you to run a map and then return back the output from that map which is what I believe you are looking to do.
The only way you are going to get close to what you want is to use two maps.
The first is to use RunMapXML which executes the map with the data you want.  After that executes, the output would then be in the output XML files (if I understand what your destination is when you said “transforms it”).
Next, you’d have another map that you use GetMapXML on that would then read the documents you just created and then return the xml for those files.
Lastly, you would maybe need a final “dummy” map that has a dummy output to another text file perhaps.  And that map would have an after map task to move the files to another folder if you need that functionality.
Anthony Sale answered 3 years ago
Actually I’ve found the answer to my own question, you need to call getmapxml/xml/{mapid}. This will allow you post an XML document to the getmapxml request.

If you would like to submit an answer or comment, please sign in to the eOne portal.