[erlang-questions] use erlSoap package in Erlang

Willem de Jong w.a.de.jong@REDACTED
Tue Jun 3 08:19:43 CEST 2008


Hi Thilani,

Do you need to implement a client (sending a request and receiving a
response) or a server (receiving a request and sending a response)?

For a server the code could look something like this:

-module(minimal_soap_server).
-compile(export_all).

-include("sms.hrl").  % .hrl file generated by erlsom

start() ->
 mod_soap:start(),
 ok = mod_soap:add_callback("/parlay_sms",
               "parlayx_sms_send_service_3_1.wsdl",
               fun(_I, _Header, Body) -> handler(Body) end).

handler([#'p:sendSms'{addresses = To,
                     message = Text}]) ->
    {ok, send(To, Text)}.

send(To, Text) ->
  [#'p:sendSmsResponse'{'result' = "sending " ++ Text ++ " to: " ++ To}].
As you can see, you need to have a WSDL.

You need to install erlsoap and erlsom. That should be relatively easy:
download the files, put them in the right place and compile them. I think
you also need to provide a simple configuration file for erlsoap. Let me
know if you need more information.

A simple client might look like this:

-module(minimal_client).
-export([sms/2]).

-include("sms.hrl").
sms(To, Text) ->
  Wsdl = yaws_soap_lib:initModel("file://parlayx_sms_send_service_3_1.wsdl
"),
  Sms = #'p:sendSms'{addresses = [To],
                     senderName = "Sender",
                     message = Text},
  yaws_soap_lib:call(Wsdl, "sendSms", [], [Sms]).

This uses the soap client code provided with yaws, but the erlsoap client is
essentially the same. Again you will need a WSDL, and erlsom has to be
installed.

Good luck,
Willem

On 6/2/08, Thilani Abeysinghe <a.thilani@REDACTED> wrote:
>
>  Hi All
>    I want to use ErlSoap package for sending SOAP messages using Erlang.
>    Can you please tell me how to configure the  Erlsoap package.I use
> windows
>    platform
>    Thanks in Advance
>
>    Regards
>    Thilani
>
>    Computer Science and Engineering
>    University of Moratuwa
>    Sri Lanka
>    http://www.thilani.blogspot.com
>    http://www.cgmax.blogspot.com
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080603/4cde0745/attachment.htm>


More information about the erlang-questions mailing list