Considering this WSDL: Adien WSDL Notification
And this svcutil command to create the corresponding C # class:
svcutil.exe https://ca-test.adyen.com/ca/services/Notification?wsdl /t:code /l:c
And OperationContract:
[OperationContract(Action="http://notification.services.adyen.com/sendNotification")] string SendNotification(NotificationRequest notificationRequest);
Calling the SendNotification (SOAP) method works with WCFStorm.
But when I call the method through a third party website that has a test button, I get:
OperationFormatter encountered an invalid message body. It is expected to find the node type 'Element' with the name 'SendNotification' and the namespace ' http://tempuri.org/ '. Found node type 'Element' with the name 'ns1: sendNotification' and namespace ' http://notification.services.adyen.com '
This is part of a third party request request that gives me a problem:
<soap:Body><ns1:sendNotification xmlns:ns1="http://notification.services.adyen.com"><ns1:notification>
How can I fix this using, preferably, small C # attribute directives?
UPDATE
Bug fixed ' http://tempuri.org/ - part of the problem by adding namespace to IPSPNotificationService ServiceContract:
[ServiceContract(Namespace = "http://notification.services.adyen.com")] public interface IPSPNotificationService
UPDATE 2
When you change OperationContract, WCFStorm still works fine. Now the method is also started by a third-party call, but the NotificationRequest parameter in this case is NULL:
[OperationContract(Action="http://notification.services.adyen.com/sendNotification", Name="sendNotification")] string SendNotification(NotificationRequest notificationRequest);
UPDATE 3
Let's look at it easier. Given the xml below, what contracts / service decorations do I need?
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"> <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"> <EventID>0</EventID> <Type>3</Type> <SubType Name="Information">0</SubType> <Level>8</Level> <TimeCreated SystemTime="2016-03-08T10:27:30.7325676Z" /> <Source Name="System.ServiceModel.MessageLogging" /> <Correlation ActivityID="{742fac90-3b97-4c9f-aee3-fd2589f75c37}" /> <Execution ProcessName="obscured" ProcessID="13280" ThreadID="11" /> <Channel /> <Computer>obscured</Computer> </System> <ApplicationData> <TraceData> <DataItem> <MessageLogTraceRecord Time="2016-03-08T11:27:30.7315670+01:00" Source="TransportReceive" Type="System.ServiceModel.Channels.BufferedMessage" xmlns="http://schemas.microsoft.com/2004/06/ServiceModel/Management/MessageTrace"> <HttpRequest> <Method>POST</Method> <QueryString/> <WebHeaders> <SOAPAction>"http://notification.services.adyen.com/sendNotification"</SOAPAction> <Content-Length>1140</Content-Length> <Content-Type>text/xml; charset=UTF-8</Content-Type> <Authorization>Basic obscured</Authorization> <Host>obscured</Host> <User-Agent>Jakarta Commons-HttpClient/3.0.1</User-Agent> </WebHeaders> </HttpRequest> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">https://obscured</To> <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://notification.services.adyen.com/sendNotification</Action> </s:Header> <soap:Body> <ns1:sendNotification xmlns:ns1="http://notification.services.adyen.com"> <ns1:notification> <live xmlns="http://notification.services.adyen.com">false</live> <notificationItems xmlns="http://notification.services.adyen.com"> <NotificationRequestItem> <additionalData xsi:nil="true"/> <amount> <currency xmlns="http://common.services.adyen.com">EUR</currency> <value xmlns="http://common.services.adyen.com">10000</value> </amount> <eventCode>AUTHORISATION</eventCode> <eventDate>2016-03-08T11:27:55.572+01:00</eventDate> <merchantAccountCode>obscured</merchantAccountCode> <merchantReference>obscured</merchantReference> <operations> <string>REFUND</string> </operations> <originalReference xsi:nil="true"/> <paymentMethod>ideal</paymentMethod> <pspReference>obscured</pspReference> <reason/> <success>true</success> </NotificationRequestItem> </notificationItems> </ns1:notification> </ns1:sendNotification> </soap:Body> </soap:Envelope> </MessageLogTraceRecord> </DataItem> </TraceData> </ApplicationData> </E2ETraceEvent>
Final update
I gave up, I saw that a third party can also send JSON messages. I adapted the configuration to use webHttpBinding, converted the JSON example to datacontract, and deserialized the message sent from OperationContext.Current.RequestContext.RequestMessage.