문제

My question may first of all seem to have a duplicate but i have hit something that has suprised me. Yaws Webserver comes with a complete set SOAP example, but when i tried running it as is, this is what i get: enter image description here

In text form, this is what i see in the shell:

1> inets:start().
ok
2> yaws_soap_lib:call("http://www.webservicex.net/WeatherForecast.asmx?WSDL","GetWeatherByPlaceName",["Boston"]).
=ERROR REPORT==== 15-Apr-2013::20:32:11 === Call to tuple fun {erlsom_parse,xml2StructCallback}. Tuple funs are deprecated and will be removed in R16. Use "fun M:F/A" instead, for example "fun erlsom_parse:xml2StructCallback/2". (This warning will only be shown the first time a tuple fun is called.) {error,{decoding,"Malformed: Illegal character in prolog"}}
3> yaws_soap_lib:call("http://www.webservicex.net/WeatherForecast.asmx?WSDL","GetWeatherByPlaceName",["Boston"]). {error,{decoding,"Malformed: Illegal character in prolog"}} 4>


You could try the yaws example following this page.
Another problem, is that i have tried other SOAP libraries like detergent and erlsoap and they are either too old or completely un-usable. Most of the solutions, even yaws, mentions his dependency on erlsom i pretty think for the XML parsing. But, i can hardly use erlsom single-handedly to offer soap services.

Somebody provide some information on how i can work with soap services (both a sa client and server) in erlang, and please explain the error i am getting with yaws. I am using the latest yaws version and erlang 15B.

도움이 되었습니까?

해결책

This is an ugly hack, but here's how I deal with SOAP requests:

Write a function/module that wraps the following:

  1. Set up some request templates (static XMLs) and fill them up with erlydtl
  2. Make a HTTP POST request (using your client of choice) with SoapAction header set.
  3. Take off the important stuff from the response using erlsom

다른 팁

From the official documentation we can read the following:

Tuple funs (a two-element tuple with a module name and a function) are now officially deprecated and will be removed in R16. Use 'fun M:F/A' instead.

So, Yaws should be updated. As a workaround, you have at least two options:

  1. the Detergent library
  2. Or, if you don't mind using the (not so) older Erlang R15, I believe it should work, as other users reported.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top