I have a project, which consumes an XML SOAP web service. Following is a snippet of the service's WSDL file (notice the newline in the soapAction value):
<!-- omitted for brevity -->
<wsdl:operation name="List">
<soap11:operation soapAction=
"http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/
:listIn"
style="document" />
<wsdl:input>
<soap11:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap11:body use="literal" />
</wsdl:output>
<wsdl:fault name="NotFoundFault">
<soap:fault name="NotFoundFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="UnauthorizedFault">
<soap:fault name="UnauthorizedFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="InternalErrorFault">
<soap:fault name="InternalErrorFault" use="literal"/>
</wsdl:fault>
<wsdl:fault name="BadRequestFault">
<soap:fault name="BadRequestFault" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<!-- omitted for brevity -->
After having successfully consumed the service using a generated client, which inherits from SoapHttpClientProtocol, I wanted I to upgrade the library to netstandard. So, I recently switched to a WCF client (via connected services in Visual Studio), which inherits from System.ServiceModel.ClientBase<>. Now calls to the above SOAP method fail to match with the following exception message:
The given SOAPAction http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/%20%20%20%20%20%20%20%20%20:listIn does not match an operation.
With the previous client, they worked just fine. Can someone help with an explanation?
Here are both versions of the generated C# stub in the service client:
/// Using SoapHttpClientProtocol
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("ParticipantIdentifierPage", Namespace="http://busdox.org/serviceMetadata/locator/1.0/")]
public ParticipantIdentifierPageType List([System.Xml.Serialization.XmlElementAttribute(Namespace="http://busdox.org/serviceMetadata/locator/1.0/")] PageRequestType PageRequest) {
object[] results = this.Invoke("List", new object[] {PageRequest});
return ((ParticipantIdentifierPageType)(results[0]));
}
and
/// Using the WCF client
// CODEGEN: Generating message contract since the operation List is neither RPC nor document wrapped.
[System.ServiceModel.OperationContractAttribute(Action="http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", ReplyAction="*")]
[System.ServiceModel.FaultContractAttribute(typeof(FaultType), Action="http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", Name="NotFoundFault", Namespace="http://busdox.org/serviceMetadata/locator/1.0/")]
[System.ServiceModel.FaultContractAttribute(typeof(FaultType), Action="http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", Name="UnauthorizedFault", Namespace="http://busdox.org/serviceMetadata/locator/1.0/")]
[System.ServiceModel.FaultContractAttribute(typeof(FaultType), Action="http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", Name="InternalErrorFault", Namespace="http://busdox.org/serviceMetadata/locator/1.0/")]
[System.ServiceModel.FaultContractAttribute(typeof(FaultType), Action="http://busdox.org/serviceMetadata/ManageBusinessIdentifierService/1.0/ :l" +
"istIn", Name="BadRequestFault", Namespace="http://busdox.org/serviceMetadata/locator/1.0/")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
ListResponse List(ListRequest request);
Only stubs addressing soapAction with spaces are failing. Other soapActions from the same WSDL, without newlines, thus without spaces in generated stubs work fine.
I suspect the spaces in the soapAction are causing the problem.