[erlang-questions] \bclarify: Exception on erlsom:write_xsd_hrl_file for XMLSchema

Willem de Jong <>
Thu May 21 16:06:56 CEST 2009


Hello Mike,

If I understand correctly, most of your tests are using a WSDL file as input
for the erlsom:write_xsd_hrl_file() function. That doesn't work, because
this function expects an XSD as its input.

If you want to create a .hrl file from a WSDL file, you can try the function
erlsoap_lib:write_hrl(Url, Target). When I tried this, it worked for the
weather forecast example. It didn't work for the Foreclosures example,
because the URL didn't return a WSDL. It also didn't work for the SEMP
example, because the WSDL contains an empty <extension /> tag, which is
illegal (if I understand the XML Schema spec correctly).

I have to say that you are likely to meet with some challenges it you try to
use erlsoap. Not because of erlsom, but rather because erlsoap is not really
ready. I think many people would welcome proper support for SOAP in Erlang,
but it looks like nobody is willing to do the work. Possibly because the
people who are willing and able to do open source software development
dislike SOAP (who can blame them...), and the ones that are more or less
forced to use SOAP don't have the time to do the work.

Regards,
Willem
On Thu, May 21, 2009 at 10:24 AM, Mike Ziebeck <> wrote:

> Willem de Jong schrieb:
>
>> Hello Mike,
>>  ..
>> If you just wanted to test the capabilities of Erlsom, then I suggest you
>> do a couple more tests with more "normal" schema's
>>
>
> Hello Willem,
>
> my aim was to explore the capabilities of erlang to client/serve for SOA.
>
> Starting out with erlsoap (using it, creating the model from WSDL failed),
> I went down the stairs of abstraction stepwise. OTP::xmerl now parses the
> XMLSchema file after ensuring it can find additional schema definition
> files like datatypes.dtd & XMLSchema.dtd. So I tryed to come back to
> erlsom and see, if its working with datatypes.dtd & XMLSchema.dtd in
> its path - before trying erlsoap again.
>
>> (let me know if you encounter more problems..).
>>
> I have tested some more WSDL from the net and they cause erlsom throw
> exceptions too. Examples are:
>
>  %% not working [WebService: USA Weather Forecast]
>  %% not working [WebService: Bank Foreclosures Database]
>  %% not working [WebService: Simple Event Management Protocol Service]
>
> See the attached file for more reproduction code.
>
>> For example, you could do:
>> 15> erlsom:scan_file("BookStore.xsd", erlsom_parseXsd:xsdModel()).
>>
> Ok, I'll check this out.
>
> Thanks,
>  Mike
>
> %% Author: Mike Ziebeck
> %% Created: 20.05.2009
> %% Description: Test case modul for erlsom
> -module(erlsomtest).
>
> %%
> %% Include files
> %%
>
> %%
> %% Exported Functions
> %%
> -export([test/0]).
>
> %%
> %% API Functions
> %%
>
> %%
> %% function:    test/0
> %% description: download + write *.hdr file for www.w3.org/2001/XMLSchema
> %%
> test() ->
>    %% not working [XMLSchema]
>    %% {Prefix,Url}={"xml_schema","http://www.w3.org/2001/XMLSchema.xsd"},
>    %% not working [WebService: USA Weather Forecast]
>        %% {Prefix,Url}={"WeatherForecast","
> http://www.webservicex.net/WeatherForecast.asmx?WSDL"},
>        %% not working [WebService: Bank Foreclosures Database]
>    %% {Prefix,Url}={"BankForeclosures","
> http://www.foreclosuredatabank.com/soapserver.php?wsdl"},
>        %% not working [WebService: Simple Event Management Protocol
> Service]
>    {Prefix,Url}={"SEMP","
> http://service.utilitystatus.com/semp/services/semp?wsdl"},
>        %% working [xmlsoap-envelope]
>    %% {Prefix,Url}={"soap_envelope","
> http://schemas.xmlsoap.org/soap/envelope/"},
>        inets:start(),
>    FileName = filename:join([filename:dirname(code:which(?MODULE)),
> Prefix]),
>        {ok, {{"HTTP/1.1", 200, "OK"}, _HeadRcv, Body}} = http:request(Url),
>        file:write_file(FileName++".xsd", list_to_binary(Body)),
>        erlsom:write_xsd_hrl_file(FileName++".xsd", FileName++".hrl").
>
> %%
> %% Local Functions
> %%
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090521/8eb8b48b/attachment.html>


More information about the erlang-questions mailing list