-1

Maybe i am mixing up some things but i can not find any questions or documentation on overloading actions for a wcf service recieving SOAP messages.

The goal: I have 3 SOAP messages coming in to my wcf service with the same actionname on the same endpoint. This is fixed and i can not change this.

I would excpect the following wcf interface would work:

    [OperationContract(Action = "urn:oasis:names:tc:SPML:2:0:req/active", Name = "addRequest")]
    void Add(data data);

    [OperationContract(Action = "urn:oasis:names:tc:SPML:2:0:req/active", Name = "modifyRequest")]
    void Modify(psoID psoID, modification modification);

    [OperationContract(Action = "urn:oasis:names:tc:SPML:2:0:req/active", Name = "deleteRequest")]
    void Delete(psoID psoID);

The problem: If i only have one operationalcontract like this my service works but if i have multiple operationalcontracts the following error will popup: `

500System.ServiceModel.ServiceActivationException

I believe it can not have multiple operational contracts with the same actionname. I also believe this should be possible because i am replacing a soap service that does handle all 3 messages with the same actionname. (wcf and soap shouldn't be that far appart?)

I added the operational names in order to fix the problem but without luck.

Any help would be appriciated. Thanks!

Pieter
  • 458
  • 5
  • 16
  • Could you please configure [WCF trace log](https://learn.microsoft.com/en-us/dotnet/framework/wcf/diagnostics/tracing/configuring-tracing?redirectedfrom=MSDN) and share? The trace log will say why the service is not activated. – Selim Yildiz Nov 03 '19 at 19:45
  • Thanks for the tip of the wcf trace. It will help me in the future to debug but the question is answered so no need to commit the trace – Pieter Nov 04 '19 at 15:58

1 Answers1

1

The Action property indicates the address the client request, which will be sent to the server and determines the method to be called on the server-side. Here is a client request captured by the Fiddler.

POST http://10.157.13.69:21011/ HTTP/1.1
Content-Type: text/xml;charset=utf-8
SOAPAction: "urn:oasis:names:tc:SPML:2:0:req/active"
Host: 10.157.13.69:21011
Content-Length: 162
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

The SOAPAction HTTP header is the Action name of the operation. The Name property determined the name of the practical method on the client-side.

ServiceReference1.ServiceClient client = new ServiceClient();
                client.addRequest(23);

Thereby, unless we change the WCF web service from SOAP web service to Rest API, otherwise, this feature cannot be achieved because the SOAP web service addressing style depends on the Action field.
Namely, we need to change the service to Restful API by using Webhttpbinding.

[OperationContract(Action = "urn:oasis:names:tc:SPML:2:0:req/active", Name = "addRequest")]
[WebGet]
void Add(int data);

Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22
  • I already gaveup on the idea it was possible. Thank you for guiding me towards a restfull api. I will check it out as soon as i am done. – Pieter Nov 04 '19 at 15:57