Results 1 to 3 of 3

Thread: RestTemplate and XmlSignatures

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Munich, Germany
    Posts
    89

    Post 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 at 02:33 AM.

  2. #2
    Join Date
    Nov 2005
    Location
    Munich, Germany
    Posts
    89

    Default 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

  3. #3
    Join Date
    Nov 2005
    Location
    Munich, Germany
    Posts
    89

    Default 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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •