Ok, so SOAP is not exactly sexy, nor is it pleasant to work it. And scala doesn't have any 'native' frameworks for SOAP services (that I know of). But, we can still leverage JAX-WS. First, let's write our service class. We will create a service that has an action called "hashing", a method called "test", which takes a string parameter "mystr" and return the SHA256 hash of that string. We'll also enable WS-Addressing for good measure. Code Editor
The above is probably self documenting, especially if you've done web services in java., so I won't spend time on it. Let's now focus on the main class. Couldn't be simpler. Let's test it.. we POST this document, with content set to application/soap+xml: Code Editor
And we get back: Code Editor
Well, yep, it seams like it worked. To route into Akka actors framework, we could do as follows: Create an actor to hold our business rule: Code Editor
And modify our test() method in the service to use the Ask pattern: Code Editor
Our response is now: Code Editor
Hope this helps. Connecting this to akka-streams is now a step away.
0 Comments
|
ArchivesCategories
All
|