Skip to content

Conversation

@arctarus
Copy link

No description provided.

This fixes a BadMapError crash when using WSDLs (like Siebel) where:
- Operation name differs from input element name (e.g., "GetQuote" vs "GetQuote_Input")
- Elements have inline complexTypes (no type attribute)

Changes:
- handle_action_extractor_result/3: Return empty string instead of crashing
  when no matching complex type is found. Also try matching with _Input suffix.
- build_action_attribute/2: Handle nil namespace lookup gracefully.

Added tests with a new DocumentLiteralService.wsdl fixture that reproduces
the same structure causing the original issue.
Change `{_tag, _attrs, _nested} = param` to `param = {_tag, _attrs, _nested}`
to match the codebase convention for pattern matching parameter names.
- Update credo 1.6.1 -> 1.7.13 for Elixir 1.19 compatibility
- Update bunt 0.2.0 -> 1.0.0
- Update file_system 0.2.10 -> 1.1.1
- Update jason 1.3.0 -> 1.4.4
- Add cli/0 function to fix deprecated preferred_cli_env warning
Replace chained || with cond statement for clearer fallback logic
when searching for complex types by operation name.
The SOAP 1.1 specification requires the SOAPAction HTTP header value
to be enclosed in double quotes. This fixes compatibility with servers
like Siebel that strictly enforce this requirement.

Before: SOAPAction: document/http://example.com:Operation
After:  SOAPAction: "document/http://example.com:Operation"
The library now properly handles custom SOAP headers that are not defined
in the WSDL, such as WS-Security (WSSE) UsernameToken headers.

Changes:
- construct_xml_request_header now handles:
  - nil headers (returns nil instead of converting to string)
  - 3-tuple format {tag, attrs, children} for custom header elements
  - 2-tuple format {tag, {attrs, children}} from map entries
  - 2-tuple attribute format {key, value} (pass-through)
- add_header_part_tag_wrapper returns body as-is when no WSDL-defined
  header wrapper exists (instead of returning nil and losing content)

Example WSSE header usage:
  soap_headers = %{
    "wsse:Security" => {
      [{"xmlns:wsse", "http://schemas.xmlsoap.org/ws/2002/07/secext"}],
      [{"wsse:UsernameToken", [...], [...]}]
    }
  }
  Soap.call(wsdl, operation, {soap_headers, params}, [])
For document/literal WSDLs where input elements have inline complexType
definitions (no type attribute), the library now correctly uses the
element name (e.g., LeadCotizadorOper_Input) as the wrapper instead of
falling back to the operation name (LeadCotizadorOper).

This fixes compatibility with Siebel and similar SOAP servers that
expect the exact input element name from the WSDL.

Changes:
- Added get_action_name_or_type/1 helper that returns the type if
  available, otherwise falls back to the element name
- Updated handle_action_extractor_result/3 to use the new helper
- Updated test fixture to reflect correct wrapper element name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant