mirror of
https://github.com/foomo/soap.git
synced 2025-10-16 12:45:36 +00:00
43 lines
642 B
Go
43 lines
642 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/foomo/soap"
|
|
)
|
|
|
|
type FooRequest struct {
|
|
Foo string
|
|
}
|
|
|
|
type FooResponse struct {
|
|
Bar string
|
|
}
|
|
|
|
func RunServer() {
|
|
soapServer := soap.NewServer()
|
|
/*
|
|
soapServer.HandleOperation(
|
|
"operationFoo",
|
|
"FooRequest",
|
|
func() interface{} {
|
|
return &FooRequest{}
|
|
},
|
|
func(request interface{}) (response interface{}, err error) {
|
|
fooRequest := request.(*FooRequest)
|
|
fooResponse := &FooResponse{
|
|
Bar: "Hello " + fooRequest.Foo,
|
|
}
|
|
response = fooResponse
|
|
return
|
|
},
|
|
)
|
|
*/
|
|
err := soapServer.ListenAndServe(":8080")
|
|
fmt.Println(err)
|
|
}
|
|
|
|
func main() {
|
|
RunServer()
|
|
}
|