wcf-client

How add cutom header in WCF with dynamic user values to every call?

久未见 提交于 2019-12-06 08:43:07
I am consuming one java webservice with WCF client. I want to pass user related information to service in header. I have aleady gone to through thread How to add a custom header to every WCF calls? I have implemented IClientMessageInspector interface with BeforeSendRequest () method. Now, I want to pass user related information in SOAP header like Oraganization, which may differ for every user. I have all this information in my ASP.net application, which uses this service. Is there anyway I can pass user related information to this BeforeSendRequest () method from asp.net session and build

wcf client - soap encoding - complex types in different namespace

不问归期 提交于 2019-12-06 07:42:49
I keep running into namespace mismatches when trying to deserialize the SOAP response. The response is unqualified and the nested complex types are qualified with a namespace like this: <getResult> <enc:ApplicationExceptionOccurred xmlns:enc="com.namespace1.www/complexTypes">false</enc:ApplicationExceptionOccurred> <enc:SystemExceptionOccurred xmlns:enc="com.namespace1.www/complexTypes">false</enc:SystemExceptionOccurred> <enc:ComplexType xmlns:enc="com.namespace1.www/complexTypes"> ... </enc:ComplexType> </getResult> I can get the namespaces correct by adding the following attribute to the

Sending SOAP messages WCF client that include a username token and digital signature but are NOT encrypted

放肆的年华 提交于 2019-12-06 03:43:31
WCF does my head in. What I'm trying to do is create a WCF client that will send SOAP messages that contain a username token and are signed with a certificate, but are not encrypted. I've found many articles and blogs with code which almost does what I want, but not quite, and now I'm stumped. Can anyone give me a simple example of how to do this? What I've done so far is: Use svcutil to generate a config file and WCF code from a wsdl and xsd Install certificates and load from the certificate store I've tried many different things and had many different errors and would like a an example which

WCF - There was no endpoint listening at net.tcp://…/Querier.svc that could accept the message

吃可爱长大的小学妹 提交于 2019-12-05 23:39:51
问题 WCF - There was no endpoint listening at net.tcp://myserver:9000/SearchQueryService/Querier.svc that could accept the message. I have the net.tcp protocol enabled on the IIS application Windows firewall is off The net.tcp binding is set to port 9000 for the entire IIS application. My web.config is very standard: <system.serviceModel> <diagnostics> <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="true" /> </diagnostics> <services>

Exposing meta data for a WCF 4.0 Rest Template Service

梦想与她 提交于 2019-12-05 21:12:06
Probably missing something very basic. I created a WCF 4.0 Rest Service. It works no problems when I'm hitting the url from a browser and I'm getting back what I want. But now I want to use that service from a client mvc application (it will also be used by other non .net platforms which is why it's a rest service in the first place). Problem is how do I get a service reference to it so I can start to use it in my c# code? With the new minimal WCF .net 4 config approach and no interface for the service contract, I don't know how to specify a mex endpoint. Ultimately I don't want a mex endpoint

How to send list of objects to WCF service?

↘锁芯ラ 提交于 2019-12-05 18:23:43
I'm building WCF service and I would like to accept List as a parameter to one of my method. Here is my code: [ServiceContract] public interface IProductService { [OperationContract] int InsertProducts(List<Product> products); } [DataContract] [KnownType(typeof(List<Product>))] public class Product { [DataMember] public int ProductId{ get; set; } [DataMember] public string ProductName{ get; set; } [DataMember] public List<Product> Products { get; set; } } When I run service it gives me an error. This operation is not supported in the WCF, because it uses NameSpace.Product[] When sending a

WCF Proxy Using Post Even Though WebGet Attribute is Specified (Only when called from another WCF service) - Causes 405 Error

半城伤御伤魂 提交于 2019-12-05 15:56:58
I have a Restful WCF service sitting on another server configured with the WebGet attribute to respond to the HTTP Get method. I know the service works correctly because I can call the service directly through the browser and manually do a Get with Fiddler and receive a correct response. I have an Asp.NET project on my local machine that is calling this service with the following code: Proxy Interface 'IProductService': using System.ServiceModel; using System.ServiceModel.Web; namespace Hugo.Infrastructure.Services.Products { [ServiceContract] [XmlSerializerFormat] public interface

The server was unable to process the request due to an internal error. in WCF error

我只是一个虾纸丫 提交于 2019-12-05 15:37:08
I have written my service in framework 4.0 using C#. It's an simple method which returns a value The Web.config is like this: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <machineKey validationKey="0E1F430D6FFFA91FBEDAEC1D2DDAAC2127EB055DBAFB78328C5BDE83249A94EA66400453B" decryptionKey="A13EACEAAABBECF2D06619924A8" validation="SHA1" decryption="AES" /> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="DecryptCookie.Service1"> <host> <baseAddresses> <add baseAddress = "http://localhost:8732/Design_Time

Consuming non-wcf SOAP fault from WCF client (soap fault defined)

回眸只為那壹抹淺笑 提交于 2019-12-05 10:28:14
I have a non-wcf server that I call from WCF client and I need to gain access to registered soap fault in case server throws it (it contains a feedback I need for user). I used the example from How to access SOAP 1.1 fault detail from WCF client (no fault contract) but its a pain given I DO have the fault contract defined in the wsdl, at least per SOAP specification and the fault contains error code and error string. <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://www.cisco.com/BTS10200/i01" xmlns="http://www.w3.org/2001/XMLSchema"> ... <complexType name=

How to add attribute to WCF message header with MessageHeader.CreateHeader() method?

房东的猫 提交于 2019-12-05 10:13:16
I am adding a WCF custom header with the following code MessageHeader header = MessageHeader.CreateHeader("Key", "ns", "Value"); OperationContext.Current.OutgoingMessageHeaders.Add(header); With this I also want to add xmlns:wsa="http://www.w3.org/2005/08/addressing" wsa:IsReferenceParameter="1" as an attribute to this Message header. Is there any way to add above namespace and attribute to the message header? I found solution. We have to Implement custome header, which is inhertied from MessageHeader class. MessageHeader class does have method OnWriteStartHeader() . We can add xml namespaces