bet365 / soap

Make it easy to use SOAP from Erlang
Apache License 2.0
200 stars 74 forks source link

Parameter types cannot be reused #43

Closed russagit closed 5 years ago

russagit commented 6 years ago

It looks like here: https://github.com/bet365/soap/blob/856b5c418d8d40a6b5bcbbe3fd390c6a0b8d4f18/src/soap_server_handler.erl#L525

a function name in the server handler module is selected based on the record type of input parameters. But what if the same record type (i.e. same parameter type) is used in different operations (and then the first match is always currently used)? Maybe it would be more correct selecting a function based on soap_action from the request?

willemdj commented 5 years ago

I am not sure... I think what you are calling "input prarameters" are actually messages (in SOAP terminology). It may not be a good idea to have the meaning of a message depend on something else (like the soap_action). In basic profile 1.1 it says: R1127 A RECEIVER MUST NOT rely on the value of the SOAPAction HTTP header to correctly process the message.

Do you have situation where this is actually creating a problem?

russagit commented 5 years ago

I'm attaching an example of wsdl where it could be a problem example.wsdl.zip

willemdj commented 5 years ago

Yes, I understand that such a scenario may occur. Your idea to look at the soap action would solve it, but I don't think it is a good idea in general, considering the basic profile recommendation.

You can solve this case by looking at the soap action header explicitly, using soap_req:soap_action/1.

russagit commented 5 years ago

Ok, I got the idea. Thanks for your time.