CoreWCF / CoreWCF

Main repository for the Core WCF project
MIT License
1.66k stars 292 forks source link

WSDL types not generated when Operation includes Action and ReplyAction with CoreWCF ver 1.3.1 #996

Open JohnLeyva opened 1 year ago

JohnLeyva commented 1 year ago

When there is a contract with only 1 operation annotated with OperationContractAttribute(Action = "/GetData", ReplyAction

Types in the wsdl won't be generated

    [ServiceContract]
    public interface IService
    {
        //[OperationContract]
        // If uncommented (Action = "/GetData", ReplyAction = "*") will be generated in the wsdl
        //string GetData(int value); 

        //[OperationContract] // Works
        //[OperationContractAttribute(Action="/GetData")]  // Works

        // Does not work if is the only operation
        [OperationContractAttribute(Action = "/GetData", ReplyAction = "*")]  
        CompositeType GetDataUsingDataContract(CompositeType composite);
    }
image
mconnew commented 1 year ago

Does this do what you are expecting in WCF?

JohnLeyva commented 1 year ago

Not tested with WCF.

The WSDL was generated in platform that is not dotnet related.

So the proxy was generated correctly in CoreWCF and works as expected with current clients. But now that we are trying to generated the WSDL from the new service implementation to ensure that is keep consistent in case the schema evolves.. Then we realize that was not generated correctly.

b1tzer0 commented 1 year ago

I am also finding this to be true, if it only has the [OperationContractAttribute(Action = "/GetData", ReplyAction = "*")] the wsdl does not generate properly.

Example: image

Only the first operation shows up in the "Add Service Dialog"

image
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://tempuri.org/" xmlns:i0="http://htng.org/2014B" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="HtngService" targetNamespace="http://tempuri.org/">
<wsdl:import namespace="http://htng.org/2014B" location="http://localhost:5238/Htng?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="BasicHttpBinding_ARIAndReservationPush" type="i0:ARIAndReservationPush">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="OTA_HotelAvailNotifRQ">
<soap:operation soapAction="http://htng.org/2014B/ARIAndReservationPush/OTA_HotelAvailNotifRQ" style="document"/>
<wsdl:input name="OTA_HotelAvailNotifRQRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="OTA_HotelAvailNotifRQResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HtngService">
<wsdl:port name="BasicHttpBinding_ARIAndReservationPush" binding="tns:BasicHttpBinding_ARIAndReservationPush">
<soap:address location="http://localhost:5238/Htng"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

As a work-around, I can go through and put the [OperationContract] on each one, but that only works until a change is made, then I would have to modify each one again.

rsrokosz-bravurasolutions commented 6 months ago

I'm using CoreWCF 1.5.2 and this is still an issue. In my case I have a service written originally in .Net Framework 4.7.2 where operation methods on the interfaces are decorated with OperationContract attribute with both Action and ReplyAction specified.

Is there a plan to fix this gap?

mconnew commented 6 months ago

To clarify, this is a problem where the client is generated without the [OperationContract] attribute on the generated method? If so, what happens if you either use Add Service Reference in a .NET Framework app, or use the .NET Framework SDK svcutil to generate the contract? It's possible this is actually a problem with the WCF Connected Services/dotnet-svcutil tooling and not CoreWCF.

rsrokosz-bravurasolutions commented 6 months ago

Hi, No, in my case there is an OperationContractAttribute, on every method, however when there is ReplyAction specified the CoreWCF silently ignores it, without any trace of error/exception, which I don't really like. I'm happy to open another issue if needed ;)

mconnew commented 6 months ago

Another issue would be helpful to keep the scope down. Is the issue that the ReplyAction isn't being emitted in the WSDL?