Svcutil, WSDL, and created interfaces are not sufficient for implementation

I have a WSDL file defining a service that I have to implement in WCF. I read that I can generate a proxy server using svcutil from the WSDL file, and that I could use the created interfaces to implement the service.

Unfortunately, I cannot find a way for the interfaces to contain the correct attributes for contract expansions.

All operations have the attribute "OperationContractAttribute", but it seems that in order for the service to be open, I need an "OperationContract" for each of them. Same thing with "ServiceContractAttribute" and "ServiceContract", and I am introducing a DataContract, but I still haven't reached it.

I could manually make these changes, but I would prefer a technique in which existing code could be easily used, or better code could be created for my purposes. Is there any way to do this?

Thank.

EDIT:

Problem in Microsoft Connect

Used command:

svcutil ObjectManagerService.wsdl /n:*,Sample  /o:ObjectManagerServiceProxy.cs /nologo

Code example:

public interface ObjectManagerSyncPortType
{

    // CODEGEN: Generating message contract since the operation createObject is neither RPC nor document wrapped.
    [System.ServiceModel.OperationContractAttribute(Action="http://www.sample.com/createObject", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute()]
    Sample.createObjectResponse1 createObject(Sample.createObjectRequest1 request);
    // ...
}

As far as I know, the WSDL file is completely standalone and does not require additional XSD files.

+3
source share
2 answers

So, it turns out that ReplyAction="*"is the culprit . Thanks for the help.

+6
source

I do not see any problems with the code that was generated:

public interface ObjectManagerSyncPortType
{

    // CODEGEN: Generating message contract since the operation createObject is neither RPC nor document wrapped.
    [System.ServiceModel.OperationContractAttribute(Action="http://www.sample.com/createObject", ReplyAction="*")]
    [System.ServiceModel.XmlSerializerFormatAttribute()]
    Sample.createObjectResponse1 createObject(Sample.createObjectRequest1 request);

This is absolutely complete code - try it! I'm sure it works.

"OperationContractAttribute" , , , "OperationContract" .

[OperationContract] - ( .NET, - WCF ) 100% [OperationContractAttribute]. .

+1

Source: https://habr.com/ru/post/1739364/


All Articles