WCF

Windows Communication Foundation (WCF) is a tool used to implement and deploy a service-oriented architecture (SOA) to support distributed computing where services have remote consumers. It features a runtime and a set of APIs in the .NET Framework for building connected, service-oriented applications. Services typically have a WSDL interface (Web Services Description Language) that any WCF client can use to consume the service, regardless of which platform the service is hosted on. WCF implements many advanced Web services (WS) standards such as WS-Addressing, WS-ReliableMessaging, WS-Security, RSS Syndication Services, WS-Discovery, routing and better support for REST services.

Share tech news, updates, or what's on your mind.

Sign up to Post

All

We have a requirement where we need to build a WCF service which can make outbound calls (as client) to backend services which requires 2-way SSL (mutual-authentication).

We have been trying this with no luck. It works with 1-way SSL (WCF as client), but when we set the backend services to require 2-way SSL, the handshake failed at the point where WCF is supposed to send its certificate to the backend service, but it doesn't.

Any one has experience doing this? Any clues of what the problem could be will be much appreciated.

Best Regards
Charles
0
Enroll in July's Course of the Month
LVL 9
Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Hello sir , i'm using WCF services in both web application and android . Now i want to implement encryption and decryption of various id's  so if i apply the encryption and decryption then on the web end i can easily manage the code but for android developer this is very hectic problem therefore suggest me how can i manage the code.
0
I have a class called "globals" which holds multiple classes that are use by my WCF application. So for example globals consists of up to 50 classes. Until now I have been defining classes with globals  as follows:

   public class Commands
    {
        DataSet ds = new DataSet();
        DataTable dt1=new DataTable("dt1");
        DataSet ds2 ;//= new DataSet("ds2");
        DataTable dt2; //= new DataTable("dt2");
        DataRow dr2;
        string[] delimitedList1;
        string[] delimitedList2;
        string[] delimitedList3;
        string[] delimitedList4;
        string[] delimitedList5;

        string currentDataType = null;
        string ds1XmlString = " ";
        string ds2XmlString = " ";
        string myStringValue = "";
        int cnt = 0;
        DataSet dsCopy = null;
        DataSet dsCopy2 = null;
        DataSet cltDS = null;
        DataSet dsSav1 = null;
        DataSet dsSav2 = null;
        DataSet dsSav3 = null;
        DataTable fileSchema;
        public Commands()
        {

        }

Open in new window


      globals g;

I now realize that by placing globals into class Commands that it is part of this class rather than a reference.I want to create class Commands and be able to reference variables that are available in globals without having to imbed globals as part of class commands. Appreciate if someone can explain how I can achieve this ?

regards
Pat
0
public void PostImagesToServer(Stream Images)
        {
         
            try
            {
                Guid Unique = System.Guid.NewGuid();
                string U = Unique.ToString();
                string Name = U + ".jpg";
                FtpWebRequest req = (FtpWebRequest)WebRequest.Create("ftp://NikhelPrans117@182.50.151.43/webservice/ChachaChaudaryImages/ComicImages/" + Name);
                req.Credentials = new NetworkCredential("NikhelPrans117", "Nilesh@2188");
                req.KeepAlive = true;
                req.UseBinary = true;
                req.Method = WebRequestMethods.Ftp.UploadFile;
                byte[] fileData = StreamToByte(Images);
                req.ContentLength = fileData.Length;
                Stream reqStream = req.GetRequestStream();
               
                reqStream.Write(fileData, 0, fileData.Length);
               
                reqStream.Close();
}
0
I have a simple page (SOAP Request) I can call in  a browser or from SoapUI.org app

http://mywcfClient.com/Service.asmx?op=SendMail

I type in the two variables and it returns a success or fail string

How do I call that in a C# Web Page?
0
Trying to consume webservice using wcf client, getting following error

The content type multipart/related; boundary=MIMEBoundaryurn_uuid_B50EC784A204DC07C91495512014914; type="text/xml"; start="<0.urn:uuid:B50EC784A204DC07C91495512014915@apache.org>"; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the  . The first 1024 bytes of the response were ...

Fiddler is showing the complete response but wcf is not able to deserialize the complete response. Response contains Japanese characters.
0
C# code is unable to parse the response from webservice, the information is in Japanese language.

Any help would be good.
0
I have a WCF Service written in C# which makes extensive user of global variables. The Service runs menus and transaction which are made up of sequenced database records with each database record capable of calling specific logic based on inbuilt commands. A typical simplistic example could be:

  05  Start
  10  Display Screen
  20  Input Range of Items
  30  run SQL statement to retrieve item details from Item master table
  40  Display Item Details
  50  Confirm selected Items
*60  Run SQL statement to report on Item Usage
*70  Output SQL results to CSV  
*80  Email usage report to user
  90  Goto Start

Those marked with * should run in a background thread so that after seq 50 the user will be returned to seq 05 whilst the background thread takes over. The issue I have is that Many of the variables controlling the transactions are global variables and so when the user returns to 05 and then exists to a new transactions this effects the background job since the background job is running the same code as the UI , except in the background thread.

I have copied all of the variables from UI to the background thread however the UI continues to update these global background thread variables after the background thread is launched. How can I stop the UI from affecting the background thread global variables ?

Pat
0
This app.config is resided in my c# class library. and I have class library called service.cs


I also have web application in c# and try to called service.cs (of course I added reference inside of the web app)
and I have alert about "Could not find default endpoint element that references contract"

so I create another web application project and add web reference directly and the webconfig is exactly the same. there is no error and I can call as usual.
What did I do wrong?

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
              <binding name="BasicHttpBinding_IQuotingService" allowCookies="true" maxBufferSize="20000000" maxReceivedMessageSize="20000000">
                <readerQuotas maxDepth="32" maxStringContentLength="200000000" maxArrayLength="200000000"/>
                <security mode="Transport"/>
              </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="abc.svc" 
                      binding="basicHttpBinding" 
                      bindingConfiguration="BasicHttpBinding_IQuotingService" 
                      contract="NGICService.IQuotingService" 
                      name="BasicHttpBinding_IQuotingService"
                      />
        </client>
    </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>

Open in new window

0
Hi All,

I have compile error below.


using System;
using System.Collections.Generic;
 
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Net;
using System.Web.Http;
 
using System.Web.OData;

Error      8      'System.Web.OData.Delta<ERVJGMERPDATASERVICE.TMCARCOLOR>' does not contain a definition for 'GetEntity' and no extension method 'GetEntity' accepting a first argument of type 'System.Web.OData.Delta<ERVJGMERPDATASERVICE.TMCARCOLOR>' could be found (are you missing a using directive or an assembly reference?)       

What component is missing ?

Thank you.
0
Free Tool: Port Scanner
LVL 9
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Dear,
Can someone let me know what to do to let our application developed in VS2015 using http as wen application and wcf services
There is any walk through to follow it

Thank you,
0
Example for WinRM  API using SOAP
0
We have the WCF service .SVC. There are multiple Operation contract in that.
When we hit the WSDL of web service, all methods get exposed.

Requirement : We want to expose selected methods client wise.

How can we do that.
0
Hi Team,

We would like to secure our API so that no body can hack the same.
We are working in .Net platform. Please provide some input to implement the same.

Reason to secure


1) Hacking
2) Data security

Please let me know
0
SRCarrierInfo.CarrierAgentActInfoServiceClient cgsClient = new SRCarrierInfo.CarrierAgentActInfoServiceClient();
cgsClient.GetCarrierWebsiteInformation(); //this is custom class library it will be returned. The name is likes: List<Domain.Carrier>


how can i expose my class library to the public? I use DNN 8 as client to call above object. and I can not reference my custom class library inside of DNN module project.
0
How can a WCF Service return a file (perhaps in stream?) based on its file type?

The idea is to let the end user calling the web method and then to get the file downloaded to end user.

Thank you.
0
Hello,

Can I use a published wcf from a  web services in order to do not duplicate a developed method
however, I could consume a WCF from windows project or  asp.net project
0
Hello Expert Team,

I am trying to develop a method in WCF service to dump data in an SQL tables
I asked the user to give us a json string with a specific format
if I test it for a small json , the method works correctly
but I tried to test for a long string it gives 'HTTP Error 414. The request URL is too long.'
 <WebGet> _
    Function GetHello(UserParam As String) As String
-----------------------
    Public Function GetHello(Json_Parameter As String) As String Implements IMobileservice.GetHello
        Dim ParameterInfoLength As String = ""

        Try
            ParameterInfoLength = Json_Parameter
        Catch ex As Exception
            ParameterInfoLength = ""
        End Try
        ParameterInfoLength = "This is the result of " & ParameterInfoLength
        Return ParameterInfoLength
    End Function

Do we have a solution?
Besides, I develop same method using a web services, it gives a window unresponsive to wait/kill, after a wait time ,  I get an answer, the method displays the string
 <WebMethod()> _
    Public Function GetHello(Json_Parameter As String) As String
        Dim ParameterInfoLength As String = ""

        Try
            ParameterInfoLength = Json_Parameter
        Catch ex As Exception
            ParameterInfoLength = ""
        End Try
        ParameterInfoLength = "This is the result of " & ParameterInfoLength
        Return ParameterInfoLength
    End Function

What do you suggest?
What is the best and …
0
We have an MVC application that consumes a third party WCF service.
We are calling a method in that service that takes base64encoded byte array as one of the parameters among other parameters.
We also have to specify the Username and Password in the ClientCredentials before calling the method

Below are the web. config settings
<system.serviceModel>
            <bindings>
                  <wsHttpBinding>
                        <binding name="WSHttpBinding_ISampleOrderSubmit">
                              <security mode="TransportWithMessageCredential">
                                    <transport clientCredentialType="None" />
                                    <message clientCredentialType="UserName" />
                              </security>
                        </binding>
                  </wsHttpBinding>
            </bindings>
            <client>
                  <endpoint address="https://abc.test.sample.com/SampleOrderSubmit.svc/SampleOrderSubmit.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ISampleOrderSubmit" contract="SampleOrder.ISampleOrderSubmit" name="WSHttpBinding_ISampleOrderSubmit" />
            </client>
      </system.serviceModel>

Most of the time everything works fine.
But on certain occasions we get the following error:


System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: An error occurred when verifying security for the message.


This is the only error that gets captured at our end and since majority of the times it works fine, we …
0
Announcing the Most Valuable Experts of 2016
LVL 6
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Hi,
I need to create a web service in vs 2015. This web service will connect to active directory and get all different kinds of information.
I need to call the same web service from asp.net application, asp.net mvc and classic asp applications. What kind of service is preferred WCF or Ajax enabled WCF? Which is more clean and more secure??  This service is going to host in cloud environment.

Which wcf service is more commonly used in this kind of situation?

thanks
0
Hi All,

I use InstallUtil to create WCF windows service.
Here is the code of installing :

Installing assembly 'D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.exe'.
Affected parameters are:
   logtoconsole =
   logfile = D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.InstallLog
   assemblypath = D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.exe
Installing service testWCFApp.ApplicationServer...
Creating EventLog source testWCFApp.ApplicationServer in log Application...
Rolling back assembly 'D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.exe'.
Affected parameters are:
   logtoconsole =
   logfile = D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.InstallLog
   assemblypath = D:\EMI NEW\APPLICATION WEB\testWCF\testWCFApp\bin\Debug\testWCFApp.exe
Restoring event log to previous state for source testWCFApp.ApplicationServer.
An exception occurred during the Rollback phase of the System.Diagnostics.EventLogInstaller installer.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.

What's wrong ?

Thank you.
0
Hi;

My question is simple; i am gonna to call below service :

http://www.webservicex.com/globalweather.asmx?op=GetWeather

But; something is wrong, it is returning to me Data Not Found. How can i fire it? My c# code is :

  myService.GlobalWeatherSoapClient client = new myService.GlobalWeatherSoapClient();
            Console.WriteLine(client.GetWeather("Stockholm", "Sweden"));
            Console.WriteLine(client.GetWeather("Berlin", "Germany"));

Open in new window

0
Hello,
I need to update an existing WCF service to allow labels to be printed from locally attached DYMO Labelwriter 450 printers (attached by USB port to the client). In the client application I have installed the following from nuget packages.

DYMO SDK Library with default label V1.0.1
DYMO Label Framework TypeScript.Definitily.Typed V0.6.3

If I specify the code below I get a  Namespace error. I have checked the assemblies after the Nugut upload but there are no DYMO assemblies present.  What am I doing wrong. How can I get the client to recognise the DYMO Labelprinter. Appreciate any help or examples that anyone can give me.

regards
Pat
 
using DYMO;  
public void PrintLabel(string serial_num, string part_Num)
        {
            var label = DYMO.Label.Framework.Label.Open(AppDomain.CurrentDomain.BaseDirectory + "Barcode.label");
            label.SetObjectText("Bar_code", serial_num);
            label.SetObjectText("text_box", part_Num);
            label.Print("DYMO LabelWriter 450 Turbo");
        }
0
I've built the default Visual Studio 2015 C# WCF Service Application.  Runs fine with the included client using the default connection http://localhost:50127/Service1.svc

For further testing I'm using Terra Term with the same URL, with and without the service1.svc, http, :50127 etc. Always get an Invalid Host error!

When I publish to a server (with its own IP) I have the same problem

Might this be related to the 50127 port and if so how would I change that?
0
Dears, kindly note that I have to build  have to build the server which host the service as windows form application c#, and the client also is windows from application c#, so I tried to create new WCF Service Library, now how can I host it by the server and access it by the client?

the client have to connect to the server using http protocol as it is far from it,

so, is there a possible scenario for that?
0

WCF

Windows Communication Foundation (WCF) is a tool used to implement and deploy a service-oriented architecture (SOA) to support distributed computing where services have remote consumers. It features a runtime and a set of APIs in the .NET Framework for building connected, service-oriented applications. Services typically have a WSDL interface (Web Services Description Language) that any WCF client can use to consume the service, regardless of which platform the service is hosted on. WCF implements many advanced Web services (WS) standards such as WS-Addressing, WS-ReliableMessaging, WS-Security, RSS Syndication Services, WS-Discovery, routing and better support for REST services.

Top Experts In
WCF
<
Monthly
>