I need my wcf client to communicate with the service with a blank SoapAction because the service is configured to dispatch the operation by body of the soap message. And the operation contract is decorated as below so it will not require soap action. I guess WCF sends a soapaction by default. Is there any option in wcf client to send a blank soapaction? Thanks for any help!
[OperationContract(Action="")]
use the same OperationContract attribute on your client code, i.e. reference.cs. More details here.
Related
I have a WCF service with ws-security using wsHttpBinding. In one of my method, I want to read the ws-security SOAP header. How do I do it?
I have visited this link but not getting idea. I simply want to read the soap header in one of the operation contract in my WCF service.
Is it possible to receive a soap message in a WCF method?
Thanks,
Jay
Jay,
Yes is possible to receive a SOAP message in a WCF method, but what I think you want is to read the header variables in the inbound request.
On the host side, create an object from this:
System.ServiceModel.OperationContext.Current.IncomingMessageHeaders
This will return an indexed collection of the inbound message headers sent from the client, and you can read it this way:
OpContext.IncomingMessageHeaders(0).ToString
I implemented a wcf web service by using wsHttpBinding. The SOAP message perfectly includes some of the important ws-addressing fields inlcuing wsa:MessageID, wsa:ReplyTo, wsa:To and wsa:Action.
The problem is that wsa:From filed is missing from the SOAP messages. Is there any way to have wsa:From in the soap messages when I use wsHttpBinding?
Thank you,
I have developed a WCF service which use SOAP headers as part of the validation of the request process.
In my service side I verify that the SOAP headers sent and valid.
I generated WSDL files using SOAPUI in order to send to my costumer.
When testing the generated wsdls, I noticed that SOAPUI does not add SOAP headers to the requests automatically.
Is there any way to mark the service (with attribute or something similar) like a service which needs SOAP headers?
Thanks
If you are only using some interceptors / inspectors to validate that header is present you cannot expect that it will be mentioned in WSDL. Header is mentioned in WSDL only if it is part of message contract used by your operation or if you add them to message description manually.
From a wcf4 service need to access to the underlying http request,including it's soap message, how can I do that from code?, I know I can use fiddler, etc, but need to do it programatically.
Look at Message Inspectors.
Is it possible to post to a WCF service hosted in IIS? I know that that this is possible using REST but I really need the WSDL generation and SOAP headers. I need to transition an existing ASMX web services to WCF but I need to also allow my clients to continue to utilize the service via http posts (xml http request via javascript). Is REST my only option?
No, with a SOAP service, you need to use the SOAP methods and actions - you cannot use HTTP POST to "dump" some data on a SOAP service.
If you need HTTP POST, then REST is the way to go.
You can also use REST style WCF
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx