DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  MPGW service Content type getting changed automaticaly before reaching Back end

    Posted Fri January 06, 2023 10:22 AM
    Hi Team ,


    We have Implemented simple MPGW service


    This service should works like calling the back end with "post" method and the request content type should be the "application/json" so the input request body is json message

    Here we are calling a Dynamic Back-end (we are implemented xslt just for the URI concatenation Rest all the data we are passing through as it is no changes in the content type in the processing rule)

    But before reaching to the back-end the content type is automatically getting changed to text/html instead of json and it not supported by back end

    Note : It is working when we tried with static back-end

    Please find below error which we are getting as a Response


    HTTP/1.1 200 OK
    X-Backside-Transport: FAIL FAIL
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Cache-Control: no-cache
    Pragma: no-cache
    Content-Type: application/json
    Expires: -1
    Date: Fri, 06 Jan 2023 08:42:48 GMT
    Set-Cookie: SESSION-GOAGD60EKGF=5ccba3d837877882f1754a821a7fb5a1f0fa08fa96070967543e23cc3245d722cb9c9607;expires=Fri, 06-Jan-2023 09:42:49 GMT;path=/;secure;httponly
    X-Client-IP: 10.1.23.30
    X-Global-Transaction-ID: 78261473

    {"Message":"The request entity's media type 'text/html' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'UpdateBagInformationRequest' from content with media type 'text/html'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"}









    ------------------------------
    HARSHAVARDHAN SANTHALA
    ------------------------------


  • 2.  RE: MPGW service Content type getting changed automaticaly before reaching Back end

    Posted Fri January 06, 2023 11:00 AM

    Hi Harshavardhan,

    Please describe your processing rule / actions, specifically your input and output contexts of each action.  By your description, you must have a xform action to execute your xslt.  I would assume it is not doing anything but updating var://service/routing-url by your description, so its output context should be NULL.  I've also seen the DataPower probe do a similar content type header change in some use cases, so is there a difference in behavior with the probe on and off?  Finally, for your static case that is working, is that using the same processing rule as your non working case?  If not, then please describe the processing rule / actions with input/output contexts of each action.

    Best Regards,

    Steve Linn



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: MPGW service Content type getting changed automaticaly before reaching Back end

    Posted Sun January 15, 2023 10:26 AM
    Thanks Steve; I agree the content type is probably getting changed by the xslt xform (transform) action.
    For your usecase it might be using to use a GWS (GatewayScript) action instead to do the uri concatenation & dynamic routing.
    Or you could verify the output context of the xform action is NULL as Steve suggests or even try setting the content type manually in a setvar action after the xform.

    ------------------------------
    Matthias Siebler
    MA
    ------------------------------



  • 4.  RE: MPGW service Content type getting changed automaticaly before reaching Back end

    Posted Wed January 18, 2023 03:15 AM

    Hi,

    1) in general content-type to and from DataPower have no relation in case transformation(s) are involved
    2) you can query original content-type and set for backend requests if you want

    https://www.ibm.com/docs/en/datapower-gateway/2018.4?topic=variables-varserviceoriginal-content-type-servicevarsoriginalcontenttype
    3) regarding what Steve said about Probe, golden rule of DataPower Probe:

    "If behavior with Probe enabled/disabled differs, then always Probe off behavior is the correct one"



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support & Fixpack team lead
    IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
    https://stamm-wilbrandt.de/en/blog/
    ------------------------------