0

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.

Bahaa
  • 1,309
  • 16
  • 28
  • If the previous client worked with the same WSDL then it would seem the problem lies with the new generated client. How was it created? – MickyD Oct 12 '19 at 22:11
  • There is something wrong with your service anyway. What’s with all the spaces around and in `listin` WSDL and both generated clients? I’d be fixing that first – MickyD Oct 12 '19 at 22:16
  • The new client was generated using the "add connected service" wizard in visual studio. As for the service and its weird spaces: as usual, it is NOT my service. I'm merely consuming it. Unfortunately, this is how the WSDL looks like. You can check it out here (https://ec.europa.eu/cefdigital/code/projects/EDELIVERY/repos/bdmsl/browse/bdmsl-api/src/main/resources/ManageBusinessIdentifierService-1.0.wsdl#256-258) – Bahaa Oct 12 '19 at 22:20
  • Hmm...I'd probably run a clean-up tool on the WSDL to remove the whitespace **before** using it. Then using **Add service reference**, add the reference from the cleaned-up WSDL on your harddrive https://stackoverflow.com/a/12731330/585968 – MickyD Oct 13 '19 at 01:37
  • Update: There's an open issue in this regard here (https://github.com/dotnet/wcf/issues/3966) – Bahaa Nov 03 '19 at 09:08

0 Answers0