Announcement Announcement Module
Collapse
No announcement yet.
RestTemplate and XmlSignatures Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RestTemplate and XmlSignatures

    Hi,

    after searching the forum and the web, I didn't find any hints concerning my problem. I've got a question concerning RestTemplate. Currently, I am implementing a (rest)client that needs to:
    a) sign its xml payload
    b) verify the signature on the response

    Is there any support for this in RestTemplate? Can I (re-)use XWSS and the beans from spring-ws?

    Thanks,
    Tom
    Last edited by de_tom; Feb 2nd, 2012, 02:33 AM.

  • #2
    Update

    Here's what I tried so far:
    • ClientHttpRequestInterceptor: Intercepting the message before it was sent, accessing the raw byte[] of the body. Result: Not really nice, all headers have been set already - content-length needs to be updated after body was modified.
    • messageConverters: I have extended a Jaxb2Marshaller and added signing-functionality. Also a bit messy but seems to get the job done.

    If you have any feedback, I'd love to hear it.

    Regards,
    Tom

    Comment


    • #3
      Update #2

      In case anybody has the same requirement, here's what I ended up doing.

      - Implement custom marshaller/unmarshaller
      - inject jaxb2marshaller as delegate
      - for signing: use jaxb2marshaller to marshall into an intermediate result, then apply signature
      - for validation: read xml, validate signature then pass the validated document to jaxb2marshaller for unmarshalling

      In my opinion, it's not a really nice solution. I'd rather have reused the classes from spring-ws. When I have some spare time, I'll start investigating in this direction.

      Regards,
      Tom

      Comment

      Working...
      X