%% 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
%%