Problem using detergent
goddang opened this issue · 4 comments
Hi,
I'm using detergent as a soap client and have this code:
SoapRes = detergent:call(Wsdl, "GenerateChallenge", [],
[#'p:GenerateChallengeRequest'{provider = Client},
#'p:GenerateChallengeRequest'{transactionID = "1"},
#'p:GenerateChallengeRequest'{policy = "Test"}]),
it gives me this erlsom error which I can't understand:
{error,{error,function_clause,
[{erlsom_write,processAnyAttributes,
[2,[],
[{ns,"http://schemas.xmlsoap.org/soap/envelope/",
"soap"},
{ns,"http://www.w3.org/2001/XMLSchema","xsd"},
{ns,"urn:www.sll.se/wsdl/soap/osif","p"}],
{[{"soap",
"http://schemas.xmlsoap.org/soap/envelope/"}],
0}]},
{erlsom_write,processAlternativeValue,8},
{erlsom_write,processElementValues,7},
{erlsom_write,struct2xml,6},
{erlsom_write,processAlternativeValue,8},
{erlsom_write,processElementValues,7},
{erlsom_write,struct2xml,6},
{erlsom_write,processAlternativeValue,8}]}}
My record looks like this:
-record('p:GenerateChallengeRequest', {'provider', 'transactionID', 'policy'}).
My record used to look like this:
-record('p:GenerateChallengeRequest', {anyAttribs, 'provider', 'transactionID', 'policy'}).
as autogenerated from write_hlr() but erlsom kept complaining about nil values so I changed it.
/dang
Hi,
you cannot change the records in this way, sorry. As it is, the 'anyAttribs' fields have to be there. But you don't have to use them, so they shouldn't bother you. I don't think they are the cause for your original error. Maybe you can say something about the original problem with the nil values, so we can see what is at the root of this issue.
Regards,
Willem
Hi Willem,
If I add anyAttribs back I get this error:
{error,{throw,{error,"No value provided for non-optional element"},
[{erlsom_write,struct2xml,6},
{erlsom_write,processAlternativeValue,8},
{erlsom_write,processElementValues,7},
{erlsom_write,struct2xml,6},
{erlsom_write,processAlternativeValue,8},
{erlsom_write,processElementValues,7},
{erlsom_write,struct2xml,6},
{erlsom_write,processAlternativeValue,8}]}}
The error means that a value is missing in your input.
Actually, your test (as shown in your first question above) looks a bit strange. There are 3 records there, each with only 1 value specified. Maybe you meant to write:
SoapRes = detergent:call(Wsdl, "GenerateChallenge", [],
[#'p:GenerateChallengeRequest'{provider = Client, transactionID = "1", policy = "Test"}]),
?
Regards,
Willem
Ahh, thank you. That was of course the problem. Now I have other problems (not related to erlsom).
I'm very grateful !