Skip to content

feat: support XML? #2188

Open
Open
@fjf2002

Description

@fjf2002

Is there any interest in this project to support creating SOAP endpoints? I don't think it would be hard.

I am building upon #1927, especially:
Uploading raw text to a function. The function must be defined with a single unnamed text param and Content-Type: text/plain must be specified.

My investigation until now with postgrest 9.0: It works with...

  1. I have a function soap_endpoint(text) RETURNS text ...
  2. The HTTP request must contain header "Content-Type: text/plain"
  3. The HTTP request must contain header "Accept: text/plain" (otherwise the body seems to get enclosed in double quotes)
  4. My function currently sets PERFORM set_config('response.headers', '[{"content-type": "text/xml; charset=utf-8"}]', true);
  5. If my function returned data type xml, this would fail with Postgres error "Function string_agg(xml, unknown) does not exist".

But it would be nicer to be able to write a function soap_endpoint(xml) RETURNS xml ... and especially not having to deal with the HTTP header stuff.

Suggested changes:

  • To remedy my point 2, I think we would need (analogous to feat: RPC POST for function w/single unnamed param  #1927):
    Uploading XML to a function. The function must be defined with a single unnamed xml param and Content-Type: text/xml or application/xml or application/soap+xml must be specified.

  • To remedy my points 3 and 4, I think we would need: If function return type is xml, automatically set response content-type to text/xml (or something like that)

  • To remedy my point 5, I think we would need: Allow returning xml data type, i. e. solve the string_agg issue - perhaps use xmlagg, or only allow scalar xml return values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa feature, ready for implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions