Support for WS-Security -- digitally-signed messages?

334 views
Skip to first unread message

br...@blumenfeld-maso.com

unread,
Dec 18, 2012, 9:12:19 AM12/18/12
to sca...@googlegroups.com
Hi All,

How would I go about adding WS-Security digital sigs to outbound SOAP messages with scalaxb? I'm thinking I would need to add a layer to my scalaxb cake. Being pretty new to scalaxb, I'm not really sure where would be the smart place to add that. Basically I need to add a header the to SOAP:Header section of all outbound requests of a service. Any and all advice gladly received!

Brian Maso

eugene yokota

unread,
Dec 18, 2012, 10:20:19 AM12/18/12
to sca...@googlegroups.com
Hi Brian,

There are three "slices" of Cake (each with 2 layers) involved:
slice 1: generated bindings for the given wsdl.
slice 2: Soap11Clients or Soap12Clients module.
slice 3: a subtype of HttpClients module, which is usually DispatchHttpClients.

To inject your own soap header, you should be able to extend the soap client and override the requestResponse method:

trait CustomSoap11Clients extends scalaxb.Soap11Clients {
  override lazy val soapClient: scalaxb.Soap11Client = new CustomSoap11Client {}

  trait CustomSoap11Client extends scalaxb.Soap11Client {
    override def requestResponse(body: scala.xml.NodeSeq, headers: scala.xml.NodeSeq, scope: scala.xml.NamespaceBinding,
                        address: java.net.URI, webMethod: String, action: Option[java.net.URI]) = 
    super.requestResponse(body, headers.toSeq ++ yourstuff, scope, address, webMethod, action)
  }
}

-eugene

Brian Maso

unread,
Dec 18, 2012, 12:27:39 PM12/18/12
to sca...@googlegroups.com
I was hoping it was something that easy :) Thanks Eugene!
--
Best regards,
Brian Maso
(949) 395-8551
Follow me: @bmaso
br...@blumenfeld-maso.com

Jeremy Stowell

unread,
Mar 5, 2013, 12:56:49 PM3/5/13
to sca...@googlegroups.com
Do you have an example of what you put in for the yourstuff part?

I need to send in the username and password.

Thanks

eugene yokota

unread,
Mar 9, 2013, 4:18:25 AM3/9/13
to sca...@googlegroups.com
Take a look at:

The doc mentions examples like:

<wsse:UsernameToken>
    <wsse:Username>scott</wsse:Username>
    <wsse:Password Type="wsse:PasswordText">password</wsse:Password>
</wsse:UsernameToken>

and

<wsse:UsernameToken>
    <wsse:Username>scott</wsse:Username>
    <wsse:Password Type="wsse:PasswordDigest">
        KE6QugOpkPyT3Eo0SEgT30W4Keg=</wsse:Password>
    <wsse:Nonce>5uW4ABku/m6/S5rnE+L7vg==</wsse:Nonce>
    <wsu:Created xmlns:wsu=
        "http://schemas.xmlsoap.org/ws/2002/07/utility">
            2002-08-19T00:44:02Z
    </wsu:Created>
</wsse:UsernameToken>

-eugene

--
You received this message because you are subscribed to the Google Groups "scalaxb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalaxb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages