Akka Nieuws Scala25 april 2016

After some trial and error i was able to expose a SOAP service with typesafe (scala).

package application

import javax.jws.WebService
import javax.xml.ws.Endpoint

import akka.actor.ActorSystem

@WebService(targetNamespace="io.trivento.test", name="io.trivento.test", portName="test", serviceName="WSTest")
class MySoapServer(system: ActorSystem) {

  def test(value : String) = {
    s"Hello $value"
  }

}

object MySoapServer extends App {
  // Create an Akka system
  implicit val system = ActorSystem("application")

  // Deploy actors and services

  // Create endpoint
  val endpoint = Endpoint.publish("http://localhost:8080/wstest", new MySoapServer(system))
  println("Waiting for requests...")
}

http://localhost:8080/wstest?wsdl

<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="io.trivento.test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="io.trivento.test" name="WSTest">
    <types>
        <xsd:schema>
            <xsd:import namespace="io.trivento.test" schemaLocation="http://localhost:8080/wstest?xsd=1"></xsd:import>
        </xsd:schema>
    </types>
    <message name="test">
        <part name="parameters" element="tns:test"></part>
    </message>
    <message name="testResponse">
        <part name="parameters" element="tns:testResponse"></part>
    </message>
    <portType name="io.trivento.test">
        <operation name="test">
            <input wsam:Action="io.trivento.test/io.trivento.test/testRequest" message="tns:test"></input>
            <output wsam:Action="io.trivento.test/io.trivento.test/testResponse" message="tns:testResponse"></output>
        </operation>
    </portType>
    <binding name="testBinding" type="tns:io.trivento.test">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
        <operation name="test">
            <soap:operation soapAction=""></soap:operation>
            <input>
                <soap:body use="literal"></soap:body>
            </input>
            <output>
                <soap:body use="literal"></soap:body>
            </output>
        </operation>
    </binding>
    <service name="WSTest">
        <port name="test" binding="tns:testBinding">
            <soap:address location="http://localhost:8080/wstest"></soap:address>
        </port>
    </service>
</definitions>