OpenFeign / OpenFeign/feign

Support of SoapHeader

Open
#1,005 8 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal waiting for votes
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Hi,

It would be great, if there could be some support of SoapHeaders when you are using Feign for legacy Soap calls. I just recently came to legacy API, where it was mandatory.

And having something like this would be absolutely amazing as headers might be marshalled objects.

@RequestLine("POST /getObject")
@Headers({
  "SOAPAction: getObject",
  "Content-Type: text/xml"
})
MyJaxbObjectResponse getObject(@SoapHeader MyJaxbHeader header, MyJaxbObjectRequest request);

Second best thing would be method annotation where you could define per method interceptor @SoapHeader(MyJaxbHeaderInterceptor.class)

The simplest solution (which I chose as it is the simplest one and it fit my need) would be to add interceptor in builder (to encoder).

I created copy of SoapEncoder SoapEncoderWithHeader(JAXBContextFactory jaxbContextFactory, MyJaxbHeaderInterceptor headerInterceptor) and I only had to add following two lines in encode method:

Marshaller headerMarshaller = jaxbContextFactory.createMarshaller(interceptor.getHeaderClass());
headerMarshaller.marshal(interceptor.createHeader(), soapMessage.getSOAPHeader());

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing SoapEncoder and the Feign builder's encoder configuration, then compare the requested parameter annotation, method annotation, and encoder-interceptor approaches. Done means SOAP headers can be marshalled into the SOAP message while preserving the existing request example's behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.