Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot change soap address #1074

Closed
lucamorelli opened this issue Jul 3, 2024 · 4 comments
Closed

cannot change soap address #1074

lucamorelli opened this issue Jul 3, 2024 · 4 comments
Labels

Comments

@lucamorelli
Copy link

lucamorelli commented Jul 3, 2024

Hi, I'm deploying my application in a kubernet pod and I'm facing a problem, because the service works locally but not deplyed. I checked the generated wsdl and I found this

image

the address here is incorrect, because there is some url rewriting, and we think the problem we have is the client fails to get metadata for this reason.
looking to the sources of the middleware I find this

image

so looks like it can't be changed, am I wrong? I see there is a https://learn.microsoft.com/en-us/dotnet/api/system.web.services.description.soapaddressbinding?view=netframework-4.8.1 but has not been implemented

@andersjonsson
Copy link
Collaborator

Looks like it, yes.

private async Task ProcessMeta(HttpContext httpContext, bool showDocumentation)
{
var baseUrl = httpContext.Request.Scheme + "://" + httpContext.Request.Host + httpContext.Request.PathBase + httpContext.Request.Path;
var xmlNamespaceManager = GetXmlNamespaceManager(null);
var bindingName = !string.IsNullOrWhiteSpace(_options.EncoderOptions[0].BindingName) ? _options.EncoderOptions[0].BindingName : "BasicHttpBinding_" + _service.GeneralContract.Name;
var bodyWriter = _options.SoapSerializer == SoapSerializer.XmlSerializer
? new MetaBodyWriter(_service, baseUrl, xmlNamespaceManager, bindingName, _messageEncoders.Select(me => new SoapBindingInfo(me.MessageVersion, me.BindingName, me.PortName)).ToArray(), _options.UseMicrosoftGuid, _options.WsdlOperationNameGenerator)
: (BodyWriter)new MetaWCFBodyWriter(_service, baseUrl, bindingName, _options.UseBasicAuthentication, _messageEncoders.Select(me => new SoapBindingInfo(me.MessageVersion, me.BindingName, me.PortName)).ToArray(), _options.WsdlOperationNameGenerator);

If you feel like submitting a PR it should be fairly easy to add a baseUrlOverride property to the options-class, so you can override the default behavior

@lucamorelli
Copy link
Author

I was checking and I noticed that looks like there is always something similar in https://github.com/DigDes/SoapCore/blob/develop/src/SoapCore/WSDLFileOptions.cs
but it's used while processing the request. I wonder if we can use directly this value

Copy link

github-actions bot commented Aug 3, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Aug 3, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants