.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Passing GetObjectContext from WCF service to COM

Posted By:      Posted Date: September 08, 2010    Points: 0   Category :WCF
Hi, I am trying reuse COM component in my existing application(ASP,COM).Com is using GetObjectContext and the stored session information to create the Objects inside the COM. How can set the GetObjectContext in WCF application. tried below code  in WCF but ctx is null Dim ctx As COMSVCSLib.ObjectContext Dim objAppServer As New COMSVCSLib.AppServer ctx = objAppServer.GetObjectContext()     Thanks in advance  

View Complete Post

More Related Resource Links

Problem with passing an Image as binary through web service



I have a web service that is accessed by a windows forms application and receives updates like facility name, address, image etc. Everything works fine except the image data is not being passed to the windows app. I am saving the images in database on both sides, so when I pull it from the server I use the following code

if (!reader.IsDBNull(floorPlanOrdinal))

facility.FloorPlan = (byte[])reader["FloorPlan"];

I can see the facility.FloorPlan Dimentions as 103840 when I debug this method which means that the data is pulled from the database fine.

On the forms side though the dimentions become 0, all other values pass fine except this. Here is the facility property in the web service on server side.

using System;

using System

Passing return value from a Web Service to a label in a Form View

I am using JavaScript to call a web service. The JS is correctly receiving and passing the web service information. At the moment, the web service returns a country name as a string to a JavaScript alert pop up box as follows:ret = CountryRegionsWebService.GetTranslatedCountryShortName(ddl1_value, ddl2_value, OnComplete, OnTimeOut, OnError);function OnComplete(args) { alert(args); } I want to change this so that web service returns the country name to a label inside an insert item template of a form view. Is there a way to pass in the label variable to the OnComplete function signature and still account for the variable args?, such as: Server Side Declaration of JavaScript ddl2.Attributes.Add("onChange", "JavaScript:OnComplete('" + lab5.ClientID + "', '" + "args" + "');"); Client Side JavaScript function OnComplete(lab5_id, args) { var lab5 = document.getElementById(lab5_id); lab5.innerHTML = args; }  

Passing parameter into Web Service

Hi, I'm creating a web service using C#, and wondering if it is possible to capture the parameter passed in from the URL?e.g. http://www.abc.com/webservice/service.asmx?para1=one&para2=twoIs there a function or something that can obtain the parameters like the normal Request.QueryString? Thanks in advance! Rgds

Passing Parameters to Web Service Method using XML DataSource

I would like to know how to pass parameter values to a web service that I am using as a data source.  I am using the Data Source Type XML.  I have been able to retrieve data back from the web service method that does not require parameters.  But I need to be able to use a web service that requires parameter values.  How do you use the XML data source type with parameters?  I have use information from the article  http://www.codeproject.com/KB/reporting-services/SSRS2005XML.aspx. thanks, Lloyd

syntax problem passing parameter into Indexing Service Query

Hi everyone, I have the following query which works fine: select OriginalFileName from Document_Entries where EntryType like 'File%' and substring(entry,charindex('file_',entry),LEN(entry)) in (  SELECT filename FROM OPENQUERY(MySearchCat, 'SELECT Directory, FileName FROM SCOPE() WHERE    CONTAINS('' "green" '') ') )  It finds all documents in the document system which contain the word "green" using the index catalog.  My problem is that i need to include this query in a larger stored procedure which accepts a parameter for key words amongst others. I can't work out the syntax to get the @keywords parameter into query. The closest I've come is the following which runs but comes back with "incorrect syntax near keyword 'green'".  The @keywords parameter will contain any key words the user enters.   declare @keywords nvarchar(500) set @keywords='green'   Declare @query nvarchar(max) set @query = ' select OriginalFileName from Document_Entries where EntryType like ''File%'' and substring(entry,charindex(''file_'',entry),LEN(entry)) in (  SELECT filename FROM OPENQUERY(MySearchCat, ''SELECT Directory, FileName FROM SCOPE() WHERE    CONTAINS(''' + @keywords + ''') '')     )  )' exec(@query)   Any ideas? thanks Gus

Passing List to WCF Service

Hi, All, I'm not sure this has been covered before.  I did search, but not sure that any of those responses apply: I'm relatively new to WCF. I have the following classes:  PostAddress, EmailAddress, PhoneNumber, ContactInformation and, Person.  The ContactInformation contains each a List<PostAddress>, List<EmailAddress>, List<PhoneNumber> property.  The Person class has a ContactInformation property. When I pass my Person object to my WCF service, my ContactInformation Lists values are null.  For example: I create an address with: street, city, state, zip, country and add it to my List<PostAddress> I add the list to the Person's ContactInformation's List<PostAddress> Property I pass it to the WCF Service.  At that time, I have this: Person.ContactInformation.Addresses.Count = [the number of addresses in the list] Person.ContactInformation.Addresses[index].property = null My service inferface looks like this (I haven't fully sketched it all out yet): [   ServiceContract]     public interface IMyService { [   OperationContract]     bool FoundDuplicate( Person p ); [   OperationContract]     void SubmitNewMembership( Person p, Membership m ); } I'm using Visual Studio Ultimate 2010/.NET 4 on Windows 7 Professional Edition if that

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

passing XMLDocument object as input to WCF service



i have to write a WCF service which accepts XMLDocument object as input.

In my contract, I have defined a function like this:

bool validate(XmlDocument doc);

In my service, the function is implemented llke this:

public bool validate(XMLDocument doc)


code to validate the doc against an XSD file

From my test project i am passing an XML document.

But it says service cannot be found.

Instead if i define XMLDocument doc inside function like this:

public bool validate()


XMLDocument doc= path of document

code to validate the doc against an XSD file

and contract like this:

bool validate();

it works fine.

It validates the XML against an XSD and returns true or false.

Please help.

Not passing service certificate to AsymmetricSecurityBindingElement



I need to consume a SOAP web service created in Java from a WCF client. The service I have to consume has the following constraints:

  • needs transport level security by communicating over HTTPS 
  • needs signatures on the body (soap:body element) and a custom header of each request. The signature is done using a client certificate and complies with http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0.pdf. The signature is required only on requests. Service responses are not signed.

It does not seem very complicated, but it proved rather difficult to achieve. My first attempt was to create a custom binding in the configuration file with CertificateOverTransport authentication. This had two major problems: it generated a timestamp header and included it in the signature (removing it would would throw an exception), it never included my required items (body and custom header) in the signature.

So I came to a second approach which consisted in creating a custom binding in code:

class MyBinding : Binding
public override BindingElementCollection CreateBindingElements()
  var elements = 

Passing business objects as parameters to web service

First I will explain our architecture

All of our Business Class are put into a Project Business Classes and they are passed around different layers to get the job done

Business Layer
   --- Depending on  a configuration calls either a web service or Data Access to get its data.

Business Layer


Business Layer
Web Service
Data Access

Sample Code:

    Business Classes

    public class Customer
        private string _name;
        public string Name
            get { return _name; }
            set { _name = value; }

   Data Access
     public void Add(Customer customer)

Passing File to Web Service


Hello all. I am not extremely familiar with web programming and I have reached the point that I am going to start pulling my hair out on this. Most of my programming is in windows.

History: One of our clients hired a company to handle orders for them and it is now my job to set up a web service that will receive a cXML file from them with the order information in it. I created a web service which resides on a Windows 2003 Server using IIS 6. I created an application to send the file to the web service and my problem now is I keep getting access denied when the web service tries to write the file to the hdd. The web service runs as the default IUSR_computername account with Enable anonymous access checked. In one of my troubleshooting attempts I gave the IUSR_.... account full permissions to the folder that the files are to be saved to and this still resulted in access denied when writing the file. The next step I took was looking on the internet to find out how to pass the credentials to the web service and I failed miserably at that also so my question is how do I pass the credentials to the web service so it can write the file to disc?

Here is the web service code. I am using VB.Net 2008 for the application and used VB.Net 2010 for the web service. (two seperate computers)

Imports System.Web
Imports System.Web.S

Passing an object with a TimeSpan field to web service resets the TimeSpan to 00:00:00


Hello all,


I have a web service that takes a TaskGroupRecord object as a parameter. This object is defined as:

  public class TaskGroupRecord
    public Guid TaskGroupID { get; set; }
    public string Name { get; set; }
    public DateTime StartDate { get; set; }
    public TimeSpan Duration { get; set; }
    public RepeatSchedule Schedule { get; set; }

    public TaskGroupRecord()
      //TaskGroupID = Guid.Empty;
      //Name = string.Empty;
      //StartDate = DateTime.MaxValue;
      //Duration = new TimeSpan();

Passing service end point credential in request

I need to call a service end point protected behind a security gateway (non-ms technology from IBM), so there are credentials for the gateway and credentials for the service end points, how can I pass these two sets of credential in the service call?

Passing an exception object to a WCF service


I'm pretty new to WCF , as an experiment I was trying to create a WCF service wrapper over an exception handler class which is using the enterprise library underneath.

I created a simple class with one exception variable, which gets exposed as the data contract

when I try to pass the exception to the WCF service I get the following serialzation error

There was an error while trying to serialize parameter http://tempuri.org/:ex. The InnerException message was 'Type 'System.Collections.ListDictionaryInternal' with data contract name 'ArrayOfKeyValueOfanyTypeanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.

I configured the app.config for the calling application by adding Syste.Exception as known type in the DataContractSerializer

        <add type="System.Exception, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089">
          <knownType type="System.Exception, mscorlib, Version=, Cult

Passing credentials to run query web service with integrated security

Dear, I want to publish a web service that I perform a query to a db, the problem is that access to the database with integra

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend