wcf-client

Multiple name spaces in a soap fault message causing FaultException deserialization to fail

℡╲_俬逩灬. 提交于 2019-12-20 02:54:20
问题 We're connecting to a web service and the fault message we're getting back isn't deserializing (at all), and no version of class that I can make will deserialize correctly. We have no control over the server side of things. The server does not allow for discovery, so adding ?WSDL to the end of the URL of the endpoint results in an error, not a WSDL. [Fiddler][1] shows the Fault message coming back looks like: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:eGov="http://eGov.gov

What happens when a WCF client specifies multiple endpoints for the same contract?

丶灬走出姿态 提交于 2019-12-19 19:14:12
问题 Will it consume from all of them? Will it throw an exception? 回答1: You can have multiple endpoints for the same contract and different addresses in your clieint config, no problem. They need to be separated by a unique name= attribute on the <endpoint> tag. <client> <endpoint name="tcpEndpoint" address="net.tcp://server:8888/SomeService" binding="netTcpBinding" contract="IYourService" /> <endpoint name="httpEndpoint" address="http://server:8777/SomeService" binding="basicHttpBinding" contract

What happens when a WCF client specifies multiple endpoints for the same contract?

三世轮回 提交于 2019-12-19 19:14:00
问题 Will it consume from all of them? Will it throw an exception? 回答1: You can have multiple endpoints for the same contract and different addresses in your clieint config, no problem. They need to be separated by a unique name= attribute on the <endpoint> tag. <client> <endpoint name="tcpEndpoint" address="net.tcp://server:8888/SomeService" binding="netTcpBinding" contract="IYourService" /> <endpoint name="httpEndpoint" address="http://server:8777/SomeService" binding="basicHttpBinding" contract

How can I consume a WCF service using a local WSDL file?

谁说我不能喝 提交于 2019-12-18 21:52:13
问题 I need to consume a WCF service based on a (preferably single) wsdl file. The environment is VS-2008 (sp1), and I will be using a customized "Add Service Reference" macro to generate an error handling proxy. I want to be able to do this, by supplying a WSDL file that I get from the service provider (I do not want to supply a host URL). How can this be done? 回答1: Sure - you can copy the path+filename for the WSDL and paste that into the "Add Service Reference" dialog box in Visual Studio (or

WCF - channel factory vs client base

若如初见. 提交于 2019-12-18 11:47:17
问题 I am new to WCF. Initially I created a WCF service and used the generated client proxy to consume the service from client. So whenever I performed some operations on service everything executed sequentially as I am invoking operations synchronously. I changed the concurrency mode to multiple, but still the operations happened synchronously. Then I generated asynchronous methods for my operations and uses the begin/end patterns so which I guess "freed" the channel and let the operations happen

WCF Service Client Lifetime

久未见 提交于 2019-12-18 03:38:07
问题 I have a WPF appliction that uses WCF services to make calls to the server. I use this property in my code to access the service private static IProjectWcfService ProjectService { get { _projectServiceFactory = new ProjectWcfServiceFactory(); return _projectServiceFactory.Create(); } } The Create on the factory looks like this public IProjectWcfService Create() { _serviceClient = new ProjectWcfServiceClient(); //ToDo: Need some way of saving username and password _serviceClient

There was no endpoint listening at <URI> that could accept the message. This is often caused by an incorrect address or SOAP action

◇◆丶佛笑我妖孽 提交于 2019-12-17 20:09:21
问题 I have two WCF clients consuming a 3rd party web service. These two clients execute the same method call. In the one case it works every time, in the other I get the "There was no endpoint listening ..." message. As far as I can tell, the only difference between the two calls is that they are in two different client exes, and that means that the .exe.config files are not the same. They use the same source code, which is shared between the two projects in Visual Studio, so that's not different

How to programmatically connect a client to a WCF service?

◇◆丶佛笑我妖孽 提交于 2019-12-17 02:33:39
问题 I'm trying to connect an application (the client) to an exposed WCF service, but not through the application configuration file, but in code. How should I go about doing this? 回答1: You'll have to use the ChannelFactory class. Here's an example: var myBinding = new BasicHttpBinding(); var myEndpoint = new EndpointAddress("http://localhost/myservice"); using (var myChannelFactory = new ChannelFactory<IMyService>(myBinding, myEndpoint)) { IMyService client = null; try { client = myChannelFactory

Dependency Inject with Ninject 2.0

天涯浪子 提交于 2019-12-14 02:47:43
问题 A little question regarding Ninject. I use a WCF 'duplex channel' to communicate with a service. The channel is defined as an interface, lets call it IMyChannel for simplicity. To instantiate a channel we use DuplexChannelFactory<IMyChannel> object's CreateChannel() method. So far I have manage to bind the factory class with this. Bind< DuplexChannelFactory< IMyChannel>>().ToMethod(context => new DuplexChannelFactory< IMyChannel>( new MessageEndPoint(), new NetTcpBinding(), "net.tcp:/

Add filename and length parameter to WCF stream when Transfermode = Stream

青春壹個敷衍的年華 提交于 2019-12-13 17:09:03
问题 In contrast to all the SO posts that talk about this topic, I'm not interested in wrapping a stream object in a [MessageContract] , since that is not permitted when in streaming mode (afaik). When I'm in streaming mode, how do I return to the client some metadata, such as length and filename? Can I add a WCF/SOAP header? How would I do this? I am looking into extending the filestream class and add a [MessageHeader] attribute, but I'm unable to get this to work. 回答1: here is how we do it