Skip to content

Commit

Permalink
Merge pull request #44 from veewee/binding-style-improvements
Browse files Browse the repository at this point in the history
Detect binding-style from both soap:operation and soap:binding
  • Loading branch information
veewee authored Feb 7, 2025
2 parents 7c84a2a + 9ccc0d3 commit 4a5b325
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function __invoke(Method $method, Binding $binding): Method
return $method->withMeta(
static fn (MethodMeta $meta): MethodMeta => $meta
->withTransport($implementation->transport->value)
->withBindingStyle($implementation->style?->value ?? $meta->bindingStyle()->unwrapOr(null))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __invoke(Method $method, BindingOperation $operation): Method
->withSoapVersion($implementation->version->value)
->withAction($implementation->action)
->withOperationName($operation->name)
->withBindingStyle($implementation->style->value)
->withBindingStyle($implementation->style?->value ?? $meta->bindingStyle()->unwrapOr(null))
->withInputBindingUsage($this->collectBindingUsageForMessage($operation->input))
->withInputNamespace($this->collectMessageNamespace($operation->input))
->withInputEncodingStyle($this->collectMessageEncodingStyle($operation->input))
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Definitions/Implementation/Binding/SoapBinding.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Soap\WsdlReader\Model\Definitions\Implementation\Binding;

use Soap\WsdlReader\Model\Definitions\BindingStyle;
use Soap\WsdlReader\Model\Definitions\SoapVersion;
use Soap\WsdlReader\Model\Definitions\TransportType;

Expand All @@ -11,6 +12,7 @@ final class SoapBinding implements BindingImplementation
public function __construct(
public readonly SoapVersion $version,
public readonly TransportType $transport,
public readonly ?BindingStyle $style,
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class SoapOperation implements OperationImplementation
public function __construct(
public readonly SoapVersion $version,
public readonly string $action,
public readonly BindingStyle $style,
public readonly ?BindingStyle $style,
) {
}
}
5 changes: 3 additions & 2 deletions src/Parser/Strategy/SoapStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function parseBindingImplementation(Document $wsdl, DOMElement $binding):
{
return new SoapBinding(
version: $this->parseVersionFromNode($wsdl, $binding),
transport: TransportType::from($binding->getAttribute('transport'))
transport: TransportType::from($binding->getAttribute('transport')),
style: BindingStyle::tryFromCaseInsensitive($binding->getAttribute('style')),
);
}

Expand All @@ -35,7 +36,7 @@ public function parseOperationImplementation(Document $wsdl, DOMElement $operati
return new SoapOperation(
version: $this->parseVersionFromNode($wsdl, $operation),
action: $operation->getAttribute('soapAction'),
style: BindingStyle::tryFromCaseInsensitive($operation->getAttribute('style')) ?? BindingStyle::DOCUMENT,
style: BindingStyle::tryFromCaseInsensitive($operation->getAttribute('style')),
);
}

Expand Down

0 comments on commit 4a5b325

Please sign in to comment.