Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/soap.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
in_type :: [{string(), atom()}] | atom(), %% the list type is only used
%% during construction of the
%% interface
out_type :: [{string(), atom()}] | undefined | atom(), %% see above
fault_types :: [atom()]}).
out_type :: [{string(), atom()}] | undefined | atom() %% see above
}).
-type op() :: #op{}.

-record(interface, {
Expand Down
20 changes: 11 additions & 9 deletions src/soap_client_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
soap_ns :: string(),
state :: atom(),
parser :: fun(),
header_parser :: fun(),
header_parser :: fun() | undefined,
fault_parser :: fun(),
parser_state :: any(),
soap_headers = [] :: [string() | tuple()],
soap_body :: string() | tuple(),
soap_body :: string() | tuple() | undefined,
is_fault = false :: boolean(),
namespaces = [] :: [{prefix(), uri()}]
}).
Expand Down Expand Up @@ -259,7 +259,9 @@ parse_xml(Message, Model, Http_status, Http_headers,
try erlsom:parse_sax(Message,
#p_state{model = Model, version = Version,
soap_ns = Ns, state = start,
handler = Handler},
handler = Handler,
parser = fun erlsom_parse:xml2StructCallback/2,
fault_parser = fun soap_fault:parse_fault/3},
fun xml_parser_cb_wrapped/2, []) of
{ok, #p_state{is_fault = true,
soap_headers = Decoded_headers,
Expand Down Expand Up @@ -355,27 +357,27 @@ xml_parser_cb({startElement, Ns, "Body", _Prfx, _Attrs},
xml_parser_cb({startElement, Ns, "Fault", _Prfx, _Attrs} = Event,
#p_state{state = body,
version = Version,
fault_parser = Fault_parser,
namespaces = Namespaces,
soap_ns = Ns} = S) ->
Start_state = soap_fault:parse_fault_start(Version),
Fault_parser = fun soap_fault:parse_fault/3,
S1 = parse_event(Fault_parser, startDocument, Namespaces, Start_state),
%% the event that we just received from the sax parser is recycled
S2 = parse_event(Fault_parser, Event, Namespaces, S1),
S#p_state{state = parsing_fault, is_fault = true,
fault_parser = Fault_parser, parser_state = S2};
parser_state = S2};

%% parsing the body
xml_parser_cb({startElement, _Namespace, _LocalName, _Prfx, _Attrs} = Event,
#p_state{state = body,
model = Model,
parser = Parser,
namespaces = N_spaces} = S) ->
Callback_state = erlsom_parse:new_state(Model, N_spaces),
%% a new "startDocument" event is injected to get the body parser going.
S1 = erlsom_parse:xml2StructCallback(startDocument, Callback_state),
S2 = erlsom_parse:xml2StructCallback(Event, S1),
S#p_state{state = parsing_body, parser_state = S2,
parser = fun erlsom_parse:xml2StructCallback/2};
S1 = Parser(startDocument, Callback_state),
S2 = Parser(Event, S1),
S#p_state{state = parsing_body, parser_state = S2};
xml_parser_cb({endElement, Ns, "Body", _Prfx},
#p_state{state = body,
soap_ns = Ns} = S) ->
Expand Down
8 changes: 4 additions & 4 deletions src/soap_fault.erl
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
version :: atom(),
state :: atom(),
characters = "" :: string(),
code :: fault_code_object(),
fault_string :: fault_string(),
code :: fault_code_object() | undefined,
fault_string :: fault_string() | undefined,
actor :: fault_actor(),
reasons = [] :: [fault_reason()],
language :: string(),
detail_tag :: {tag(), uri()},
language :: string() | undefined,
detail_tag :: {tag(), uri()} | undefined,
details = [] :: [{tag(), uri(), string()}]
}).

Expand Down
4 changes: 2 additions & 2 deletions src/soap_fault.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
tag :: string(),
text :: string()}).

-record(faultcode, {uri :: string(),
-record(faultcode, {uri :: string() | undefined,
code :: string() | atom(),
subcode :: #faultcode{} % only v. 1.2
subcode :: #faultcode{} | undefined % only v. 1.2
}).

-record(faultreason, {text :: string(),
Expand Down