I have a client they gave some WSDL, I generated some code from their WSDL using svcutil tool. [System.ServiceModel.OperationContractAttribute(Action="")]
but it is not allowed in WCF. How I can make this Action a blank string?
The following worked for me: from here
Download the Microsoft WCF examples. Add the following files to your project from WF_WCF_Samples\WCF\Extensibility\Interop\RouteByBody\CS\service
DispatchByBodyOperationSelector.cs
DispatchByBodyBehaviorAttribute.cs
Add the following attributes to your interface (next to your ServiceContract)
XmlSerializerFormat
DispatchByBodyBehavior
Add the following to your service interface
[OperationContract(Action = "")]
public void DoNothing()
{
}
For my service, the WrapperName
and Wrappernamespace
are null for all messages. I had to go into DispatchByBodyBehaviorAttribute
and edit ApplyDispatchBehavior()
to add the following lines to check for this:
if (qname.IsEmpty) {
qname = new XmlQualifiedName(operationDescription.Messages[0].Body.Parts[0].Name, operationDescription.Messages[0].Body.Parts[0].Namespace);
}