When using a web service consumer, we’re unable to use a property (defined in a properties file) within WSDL Location field. It complains saying it
should be a valid URL or be a file in the classpath. This suggests that Mule expects only a URL that it parses to pull necessary information and hence populate other fields including service, port and address.
What Mule Says
MuleSoft’s documentation suggests that we can drop WSDL files under
src/main/wsdl folder which will allow Web Service Consumer’s WSDL Location field to let developers choose a specific WSDL that can in turn populate rest of the fields.
Simpler approach, even though a bad one, is to hard code the URL for each environment. Sometimes, it’s best to make long story short
Wait, Isn’t WSDL Same Across Environments
Coming to think of it in a different way, yes WSDL shouldn’t be any different across environments. So what we can do is to use Production WSDL hard coded, but use the service field to ensure it is environment specific. Doing it this way we know the Production is the truth and any inconsistencies between Production and Non-production API will come out as a result (which I would say it’s a nice bi-product of this approach).