Skip to content

Support of SoapHeader #1005

@snajberk

Description

@snajberk

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());

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalProposed Specification or API changewaiting for votesEnhancements or changes proposed that need more support before consideration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions