Configure SSRS delivery extension for invoking a WCF service - wcf

Have created a custom delivery extension in SQL Server Reporting Services (2008 R2). Within the custom delivery I am making a call to a WCF service. Am not sure where to put the app.config settings for the WCF bindings.
Have tried adding the entire 'system.serviceModel' section into the Reporting Server config file (rsreportserver.config). Have also added the generated app.config file from the custom DLL into the report server's /bin folder. Am still getting the following error though.
Could not find default endpoint element that references contract 'name of my WCF service' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
For now I am changing the code to create the bindings through code but would rather have this config file based. Any help is greatly appreciated.
Thanks
David

A. I would just create a proxy class of SSRS service objects in code.
B. Then make your own wrapper code for creating a report or getting report info. I explained this in another question here:
Programmatically Export SSRS report from sharepoint using ReportService2010.asmx
C. Then build a service around those wrapper methods to get your data.

Related

How to add service to a WCF Service library. Is this correct?

I am new to WCF and .Net application. So pardon me if I am asking some basic and silly question.
Basically my project is to create a WCF Service that would call an Oracle Stored Procedure that returns a set of parameters which is then passed to the Exchange Server to send Email.
For this so far I have done something like this:
In VS 2010 Create Project; Visual C#; WCF; select WCF Service Library.
Described as "A project for creating a WCF service class library (.dll)".
Gives an app.config
Debug brings up a WCF Service Host and a WCF Test Client automatically.
I initially followed the MSDN sample that is given below in the following website:
http://msdn.microsoft.com/en-us/library/ms731835.aspx
Now I Added another project to the same solution and chose WCF Service Application to host the above in IIS host. This gives me web.config file.
Before I proceed to my next question please let me know if the last step is correct or wrong?
To proceed further I tried to add my implementation service reference in web.config file.
When I try to debug I am getting a Service host that is running seperately (an icon on my machine) and a WCF Test Client opens up as well. Is this correct? Now how do I proceed further? I have no clue..
Now do I create methods that would call the Stored Procedure using Data access?
How do I proceed further? I am stuck. Please help.
Thank you.
You are on right path you just need to call your stored procedue and then call read the data and invoke method and pass it to client.
Here is full example with screenshot for your help
SQL Server
http://www.codeproject.com/Tips/468354/WCF-example-for-inserting-and-displaying-data-from
WCF Data Services and OData for Oracle Database
http://download.oracle.com/oll/obe/EntityFrameworkWCF/WCFEntityFramework.htm
Invoking Operations on the Oracle Database WCF
http://msdn.microsoft.com/en-us/library/dd788075%28v=bts.10%29.aspx

How to call a WCF service from a SSIS Custom Log Provider?

I created a SSIS Custom Log Provider (SQL Server 2012 / Visual Studio 2010 / .Net Framerowk 4), and now I have to call a WCF service. I am not sure how to do that, since this is a custom library project, with no config file.
Ideas? Thanks!
This is a tricky thing to do in SSIS. You would be better off calling the WCF Service from C# and using that app to populate and thus stage a table that you can get to from SSIS.
Having said this...if you want to access a WCF Service here are the basic steps.
WCF Endpoint Config Settings. The endpoint to your WCF Serivce must be placed in the dtsexec.exe.config AND the DtsDebugHost.exe.config file located in the following folder: C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn it would be wise to do the same in the Program Files folder if you are running 64 bit SQL Server as well.
Now you can create your SSISScript and add the Service Reference by right clicking on References and then Add Service.
If you have complied your own "internal" Proxies and contracts into DLL then you will need to copy those to the same location as the dtsexec.exe above AS WELL AS registering them in the GAC.
Remember...you need to do this where the SSIS package will run so typically your local instance of SSIS and the Production SQL Server.
Now...an alternative to this may be to "Brute Force" code all of the WCF Endpoint settings in code in your SSIS Script. I have not tired this but if it works that would eliminate the need for the endpoint in those obscure locations and config files. It would be cleaner and a better route. You could then store your WCF endpoints and other settings as variables the pass them into the SSIS Script as readonly values.
Good Luck!

Error message from svcutil.exe - what does it mean?

I've had not a lot of luck creating a WCF service with Visual Studio. It's in IIS, and it I click 'browse' on the .svc file itself, it tells me I have created a service. So I assume it's all okay to a point.
Throughout my time I came across a recommendation to use a program called svcutil.exe. I used it on my service and got the following error. I don't know what it means, so hopefully someone can shed some light on the situation.
Here's the result:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://localhost/EvalServiceSite/Eval.svc'
using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.Se
rviceModel.Description.DataContractSerializerMessageContractImporter
Error: Schema with target namespace 'http://tempuri.org/' could not be found.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:portType[#name='IEvalService']
Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is de
pendent on.
XPath to wsdl:portType: //wsdl:definitions[#targetNamespace='http://tempuri.org/
']/wsdl:portType[#name='IEvalService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:binding[#name='BasicHttpBinding_IEvalService']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:binding[#name='BasicHttpBinding_IEvalService']
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/'
]/wsdl:service[#name='EvalService']/wsdl:port[#name='BasicHttpBinding_IEvalServi
ce']
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.
I think this previous Stack Overflow question may help with your current question but not necessarily your problem.
Error: Cannot import wsdl:port with svcutil
You've created your WCF service and you've browsed to it in IIS so you're happy that it is working. The purpose of SVCUtil.exe is to generate classes that you can use in an application to interact with the service with compile time information on the contract members and methods.
it performs the exact same function as adding a service reference in visual studio to consume the service.
If your having trouble, i'd suggest just creating a simple console project in visual studio, adding a service reference and giving it the url of the service you've hosted in IIS. Then click "show all files" in the visual studio solution explorer and look at the reference.cs file it gives you. This will show you what information has been consumed from your service.
Edit
Hi Again,
After going through all the comments below I'm starting to see more about your problem. I think you misunderstand what it is your doing when in fact you've already achieved what you want to achieve.
The original project, the one you had with the WCF test client that worked did what you needed. It is a fully fledged WCF Service. All you needed to do was right click the solution in visual studio and publish it. If you then make sure that you make an IIS virtual directory point at your solution, through the publish wizard. Then when you run your project and then browse to that url, that will give you a service to consume for testing purposes.
What you are doing at the moment, creating a WCF project, adding that DLL to a website project is fundamentally wrong: The example you followed, presumably this one :
http://msdn.microsoft.com/en-us/library/ms733766.aspx
is about creating a WCF service in a web site project from scratch. Not about adding a pre-existing WCF project and hosting it.
Your essentially trying to do one thing in two different ways together.
Your current course of action is to either remove the DLL in your web project and then create the service there. Or host your current WCF service in IIS ( the project you downloaded from me or your original one)
At this point you have a hosted service. Then usually you have an application to interact wtih it. This you found using svcutil and can be done in one of two ways:
You create the console application and do "Add Service Reference" to the URL you have hosted in IIS.
Or you use SVC Util.exe point it at the url which generates a class file you include in your console / application.
I hope that clears things up about WCF and what stages to use various tools?
Edit 2
Just in case you don't get to the Chat:
I still think theres something wrong with your original project. I'm not sure what you mean by the one with the DLL either? if that means your website project with the dll of the WCF project, then no not that one.
I've taken the project I sent you earlier. I've hosed that in IIS so that when i browse to localhost/EvalService on my machine i get the standard
"EvalService Service
You have created a service.
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:"
Once I had that set up i created a console application, "added service reference" in visual studio and it consumed teh service no problem.
Try doing the above with the project I sent you and see how far you get.

Silverlight Business Application template with WCF is throwing warning

I am using the Silvelight Business Application template. I wrote a function which uses Membership.getUserList function to return the user list. I tried exposing it as Service using WCF. But when I try to compile the client side code it throws a warning saying "Client Proxy Generation for user_authentication.Web.Service1 failed'. Why does it happen?
The complete warning message is:
Warning 4 Client proxy generation for
service
'user_authentication.Web.Service1'
failed: Generating metadata files...
Warning: Unable to load a service with
configName
'user_authentication.Web.Service1'. To
export a service provide both the
assembly containing the service type
and an executable with configuration
for this service.
Details:Either none of the assemblies passed were executables
with configuration files or none of
the configuration files contained
services with the config name
'user_authentication.Web.Service1'.
Warning: No metadata files were
generated. No service contracts were
exported. To export a service, use
the /serviceName option. To export
data contracts, specify the
/dataContractOnly option. This can
sometimes occur in certain security
contexts, such as when the assembly is
loaded over a UNC network file share.
If this is the case, try copying the
assembly into a trusted environment
and running it.
Hard to say, I'm not a good enough clairvoyant yet ;-) ... Is your webservice actually already compiled, published and running? Maybe here you can find further hints:
MSDN WCF Forums: svcutil Error

How to use a WSDL file to create a WCF service (not make a call)

I have an old WSDL file and I want to create a server based on this WSDL file.
The WSDL is generated from a ASMX (I suppose but I am not sure).
How can I achieve this ?
original question where the OP thought he needed to create a client based on the WSDL.
Using svcutil, you can create interfaces and classes (data contracts) from the WSDL.
svcutil your.wsdl (or svcutil your.wsdl /l:vb if you want Visual Basic)
This will create a file called "your.cs" in C# (or "your.vb" in VB.NET) which contains all the necessary items.
Now, you need to create a class "MyService" which will implement the service interface (IServiceInterface) - or the several service interfaces - and this is your server instance.
Now a class by itself doesn't really help yet - you'll need to host the service somewhere. You need to either create your own ServiceHost instance which hosts the service, configure endpoints and so forth - or you can host your service inside IIS.
There are good resources out there if you know what to search for. Try "Contract First" and WCF. or "WSDL First" and WCF.
Here is a selection:
Basic overview of WSDL-First development with WCF and SvcUtil.exe.
WSCF - A free add-in to Visual Studio enabling Contract-First design with WCF
Introduction to WSCF
A walkthrough of using WSCF
The WSCF project page on CodePlex (WSCF is now open source)
Article on how to design "WCF-Friendly" WSDL
Use svcutil.exe with the /sc switch to generate the WCF contracts. This will create a code file that you can add to your project. It will contain all interfaces and data types you need to create your service. Change the output location using the /o switch, or you can find the file in the folder where you ran svcutil.exe. The default language is C# but I think (I've never tried it) you should be able to change this using /l:vb.
svcutil /sc "WSDL file path"
If your WSDL has any supporting XSD files pass those in as arguments after the WSDL.
svcutil /sc "WSDL file path" "XSD 1 file path" "XSD 2 file path" ... "XSD n file path"
Then create a new class that is your service and implement the contract interface you just created.
You could use svcutil.exe to generate client code. This would include the definition of the service contract and any data contracts and fault contracts required.
Then, simply delete the client code: classes that implement the service contracts. You'll then need to implement them yourself, in your service.
Using the "Add Service Reference" tool in Visual Studio, you can insert the address as:
file:///path/to/wsdl/file.wsdl
And it will load properly.