Highlighted
New Member.
2512 views

LR 12.55 - PUT method - Error 415 unsupported media type

Hello,

i have got one issue that appeared between version difference.

I prepared script in LR 12.55 and after execution in VuGen it sends me this error message:

Error 575 FO_Create_Case.c(575): Continuing after Error -26616: HTTP Status-Code=415 (Unsupported Media Type) for "https://case-fat.kb.cz/feapi-case-simple/api/simpleCase/65171500-791c-4ed8-9c09-213f7e41a99f/attribute/CLIENT"   [MsgId: MERR-26616] FO_Create_Case.c C:\Users\e_mfiser\Desktop\LR Scripts\9 Fo Create Case\FO_Create_Case FO_Create_Case

 

This is the script what fails:

    web_custom_request("CLIENT", 
        "URL=https://{URL_Adress}/feapi-case-simple/api/simpleCase/{caseId}/attribute/CLIENT", 
        "Method=PUT", 
        "Resource=0", 
        "RecContentType=application/json", 
        "Referer=https://{URL_Adress}/app-simple-case/task-detail/{systemId}::{taskId}", 
        "Snapshot=t49.inf", 
        "Mode=HTTP", 
        "Body={\"taskId\":\"{systemId}::{taskId}\",\"attribute\":{\"dataType\":\"CLIENT\",\"value\":[\"{NaturalPerson_KBID}\"],\"type\":\"cz.kb.pf.feapi.simplecase.dto.BusinessAttributeUpdate\"},\"type\":\"cz.kb.pf.feapi.simplecase.dto.BusinessAttributeUpdateRequest\"}", 
              
        LAST);

If a replay at version 12.02 it works. So i can say that the script is valid.
Can anybody help me to fix this issue please?

Best Regards,
Michal 

0 Likes
6 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: LR 12.55 - PUT method - Error 415 unsupported media type

Hi Michael, 

I've already dealt with this kind of mistake, and fixed it with "RecContentType" and "EncType" arguments of web_custom_request() function. Try to valorize these arguments with the correct type format of the request message (possibilities are text/xml, application/json, application/msword or application/soap+xml), or you can add a web_add_header() function to force a new header in the request message. 

It may also be necessary to add the web_add_header("Accept", "text/xml, text/plain", */*") function, where the second argument represents the acceptance type. 

Lorenzo

Highlighted
New Member.

Re: LR 12.55 - PUT method - Error 415 unsupported media type

Hi Lorenzo,

thank you for your response. It seems good.
Can you send me your script please?

Michal

0 Likes
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: LR 12.55 - PUT method - Error 415 unsupported media type

Hi Michael, 

since the applications we test in our department are discontinued and removed after a period of time, I can't send you a consistent script about this issue, but below there's some evidences from my personal LR manual: the script below was about an HTTP 415 error message and I fixed it with "RecContentType" and "EncType" arguments. 

web_custom_request("JUIB0",
                "URL=http://.../JUIB0/JUIB0MDPJU_01",
                "Method=POST",
                "Snapshot=t1.inf",
                "RecContentType=application/soap+xml",
                "EncType=application/soap+xml; charset=utf-8",
                "Mode=HTML",
                "Body=" ......, LAST);

Obviously, the valuation of those arguments depends on your request format type. 

Lorenzo

 

Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: LR 12.55 - PUT method - Error 415 unsupported media type

Lorenzo, do you have a corresponding web_add_header() for that request? I found I was able to safely comment out 'RecContentType' so long as i had the web_add_header() ... 

EncType attribute is interesting, as 

Any EncType specification silently overrides any web_add_[auto_]header for Content–Type. 

https://admhelp.microfocus.com/vugen/en/12.56-12.57/help/function_reference/Content/FuncRef/web/lrFr_web_custom_request.htm

So perhaps the OP needs to check that one of these is not overriding the other 🙂

Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: LR 12.55 - PUT method - Error 415 unsupported media type

You can try to put a web_add_header("Content-Type", "application/soap+xml; charset=utf-8") function. Whit this method I've solved the HTTP 415 error message problem. 

Tell me if this suggestion can fixed your script's execution. 

Lorenzo

Highlighted
Respected Contributor.
Respected Contributor.

Re: LR 12.55 - PUT method - Error 415 unsupported media type

Adding "EncType" in my script solve my issue

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.