Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
Absent Member.. ketan_mistry Absent Member..
Absent Member..
314 views

EUM API: help needed to upload a new script

Jump to solution

I am trying to use the EUM_API in BSM 9.25 to upload a new script into the script repository. I am using Chrome and the POSTMAN app to make a POST, so far I have:

General:
POST 
/topaz/eumopenapi/sr/script/upload?script_name=test1&parent_folder_id=11

Request Headers:
Authorization: Basic <my base64 encoding>
Content-Type: multipart/form-data

Request Payload:
Content-Disposition: form-data; name="script_name"; filename="Fictitious Mineral Buying App.zip" Content-Type: application/x-zip-compressed

However, I get back a HTTP response code of 415 (Unsupported Media Type). What mime type should I be using in the request?

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: EUM API: help needed to upload a new script

Jump to solution

Hi ketan_mistry,

it works fine with Mozilla and the Poster Add-On.
When I use Chrome and the Postman Add-On (and first managed to find my way around in PostMan), I also get the error you get

Fehler beim Fertigstellen des erforderlichen Vorgangs aufgrund eines internen Serverfehlers.
(german for "Failed to complete the requested operatiion due to a server internal error."

I found this entry in the log (<GW>>\log\jboss-as.log, same in <GW>>\log\ma-app.log)

2016-05-11 14:23:02,441 [ajp-/127.0.0.1:8009-5] (SrScriptResource.java:113) ERROR - createScript- failed to create new script in CRS.
com.mercury.am.eum.shared.management.exceptions.EumErrorException: Failed to create script. You selected an incorrect type of script. Select a different script.

###-------------SR failed exceptions ---------####
server.FileSetTypeAutoDetector.autodetect.ERROR=You selected an incorrect type of script. Select a different script.

When you add a script manually via the GUI, you need to specify a type, usually it's "AUTO-DETECT", but you might also specify for example "VUGEN".

I had a look at the source code (SrScriptResource.java)

@PatH("eumopenapi/sr/script")

@POST
@PatH("/upload")
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_XML)
public SrScriptBean uploadScript( @context HttpServletRequest httpServletRequest,
@QueryParam(SCRIPT_NAME_PARAM) String scriptName,
@QueryParam(PARENT_FOLDER_ID_PARAM) String parentFolderId,
InputStream is) throws WebApplicationException {

Here I found at least what Content-Type has to be used for the individual API calls (I guess I'll write a KCS document for it).
but this doesn't help ...

We fail here:

private void setScriptType(SRScriptModifiable requestScript, SRScriptType scriptType) throws EumErrorException {
if (scriptType == null) {
throw new EumErrorException(getType(), EumOperationsConstans.TYPE_NOT_FOUND);

for whatever reason, it seems Chrome with PostMan does something different from Mizilla Firefox with Poster.
Ah, here we go!

It simply cannot open the script file, and thus cannot identify the script type.

After changing Body -> form-data to Body -> binary and then specifying the script file name,
all works like a charm:

screenshot.jpg

Greetings
Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
7 Replies
Micro Focus Expert
Micro Focus Expert

Re: EUM API: help needed to upload a new script

Jump to solution

Hi Ketan_Misty,

give it a try with

Request Headers:
 Content-Type: application/xml

Greetings
Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
Absent Member.. ketan_mistry Absent Member..
Absent Member..

Re: EUM API: help needed to upload a new script

Jump to solution

No does not work - same 415 error code.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: EUM API: help needed to upload a new script

Jump to solution

Hi ketan_mistry,

After testing for several hours and not getting further at all, I finally found a service request (covering a totally different issue) but it shows what needs to be done,
Content-Type has to be of type "application/octet-stream", then it works
(tested successfully on both BSM 9.25 IP1 and BSM 9.26 IP1 with Mozilla Firefox and Poster Add-On)

screenshot.jpg

Greetings
Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
Absent Member.. ketan_mistry Absent Member..
Absent Member..

Re: EUM API: help needed to upload a new script

Jump to solution

Getting a 500 (internal error), here is how it looks in Google's Postman:

eumapi_screenshot1.png

Is there anything different to what you are doing? I am successfully using the same Basic authentication header to create (POST) script folders under the root parent, so I don't believe its security. Also the parent_folder_id has been changed with no luck. I can upload the same script by hand via the UI.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: EUM API: help needed to upload a new script

Jump to solution

Hi ketan_mistry,

it works fine with Mozilla and the Poster Add-On.
When I use Chrome and the Postman Add-On (and first managed to find my way around in PostMan), I also get the error you get

Fehler beim Fertigstellen des erforderlichen Vorgangs aufgrund eines internen Serverfehlers.
(german for "Failed to complete the requested operatiion due to a server internal error."

I found this entry in the log (<GW>>\log\jboss-as.log, same in <GW>>\log\ma-app.log)

2016-05-11 14:23:02,441 [ajp-/127.0.0.1:8009-5] (SrScriptResource.java:113) ERROR - createScript- failed to create new script in CRS.
com.mercury.am.eum.shared.management.exceptions.EumErrorException: Failed to create script. You selected an incorrect type of script. Select a different script.

###-------------SR failed exceptions ---------####
server.FileSetTypeAutoDetector.autodetect.ERROR=You selected an incorrect type of script. Select a different script.

When you add a script manually via the GUI, you need to specify a type, usually it's "AUTO-DETECT", but you might also specify for example "VUGEN".

I had a look at the source code (SrScriptResource.java)

@PatH("eumopenapi/sr/script")

@POST
@PatH("/upload")
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@Produces(MediaType.APPLICATION_XML)
public SrScriptBean uploadScript( @context HttpServletRequest httpServletRequest,
@QueryParam(SCRIPT_NAME_PARAM) String scriptName,
@QueryParam(PARENT_FOLDER_ID_PARAM) String parentFolderId,
InputStream is) throws WebApplicationException {

Here I found at least what Content-Type has to be used for the individual API calls (I guess I'll write a KCS document for it).
but this doesn't help ...

We fail here:

private void setScriptType(SRScriptModifiable requestScript, SRScriptType scriptType) throws EumErrorException {
if (scriptType == null) {
throw new EumErrorException(getType(), EumOperationsConstans.TYPE_NOT_FOUND);

for whatever reason, it seems Chrome with PostMan does something different from Mizilla Firefox with Poster.
Ah, here we go!

It simply cannot open the script file, and thus cannot identify the script type.

After changing Body -> form-data to Body -> binary and then specifying the script file name,
all works like a charm:

screenshot.jpg

Greetings
Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
Absent Member.. ketan_mistry Absent Member..
Absent Member..

Re: EUM API: help needed to upload a new script

Jump to solution

Yes that works! Thanks for the great help.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: EUM API: help needed to upload a new script

Jump to solution

You are very welcome!

Greetings
Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.