Communicate With WebService From MS SQL 2005 CLR Procedure, Quick Steps

Jan 14, 2008

-> Communicate with WebService from MS SQL 2005 CLR Procedure, Quick Steps

1- Create SQL project in V.S 2005.


2- Add new Trigger Class, right click on project select Add -> New Item.


3- Add Web Service reference.


4- Use impersonation technique to communicate with Service.


Example:


using (WindowsIdentity id = SqlContext.WindowsIdentity)
{
WindowsImpersonationContext context = id.Impersonate();


/////////////////////////////
proxy = new WebServiceProxy();

proxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

proxy.HelloWorld();

/////////////////////////////


context.Undo();
}


5- Set SQL Project Permission Level to External, change from the project properties Database Tab


"Permission Level Select the permission level from the drop-down list to specify a set of code

access permissions granted to the assembly when accessed by Microsoft SQL Server. The value can be

Safe, External, or Unsafe; these values correspond to the SQL Server permission sets SAFE,

EXTERNAL_ACCESS, and UNSAFE, respectively. Safe is the default.

This setting corresponds to the PERMISSION_SET argument for the SQL Server CREATE ASSEMBLY command.
" MSDN


6- "The TRUSTWORTHY database property is used to indicate whether the instance of SQL Server trusts

the database and the contents within it. By default, this setting is OFF, but can be set to ON by

using the ALTER DATABASE statement.

Note:
To set this option, you must be a member of the sysadmin fixed server role." MSDN


ALTER DATABASE [Database Name] SET TRUSTWORTHY ON
.



7- Build and Deploy assembly.

8- The web service reference generates XmlSerializers assembly, there are many ways to resolve
this issue, a quick way would be to add the XmlSerializers assembly to the database where the
main CLR assembly is deployed.


From "SQL Server Management Studio" select the target database, goto "Programmability" then ->
"Assemblies", there right click "New Assembly" and specify reference.





Hope this is helpful to others.
Regards
Rabeeh Abla

View 1 Replies


ADVERTISEMENT

Steps For Debugging Stored Procedure In Sql Server 2005

Dec 20, 2007

hi friends,
     Anyone give give me the steps we have to follow for debussing a stored procedure in sql server 2005...
 

View 2 Replies View Related

Invoking Webservice Using SQL CLR Procedure

Jan 27, 2008

Hi,

I have written a SQL CLR procedure, which will be invoking the webservice..I developed the application locally and it works fine, I am able to invoke the webservice using the SQL CLR procedure present in my database. But when i hosted the webservice in App server and executed the SQL CLR procedure in DB Server.
From DB Server, I am not able to invoke the webservice present in the app server. But i am able to browse the webservice from my db server.
I am getting the foolowing error message


A .NET Framework error occurred during execution of user defined routine or aggregate 'usp_LoadView':
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
System.Net.Sockets.SocketException:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
System.Net.WebException:
at StoredProcedures.usp_LoadView(String ConnectionString, String WebserviceUrl, String ColumnMappingsXml, SqlXml AddressXml, SqlXml& ExceptionSqlXml, Int32& ErrorStatus)


I goggled and tried out various options, like increasing €œwebservice timeout€? and increasing €œexecutiontimeout€? for HttpRuntime, but none seems to be working. Please provide me your suggestions to how to fix this..

View 4 Replies View Related

Access Webservice From A Stored Procedure.

Apr 1, 2008

Hi everybody,
How can I access a webservice from inside a stored procedure? any help is greatly appriciated.

View 3 Replies View Related

Calling Webservice From A T-SQl Stored Procedure

Oct 6, 2006

Hi,



I need to call a web service (consume a webservice)from a T-SQL stored procedure. Is there a way to do this. If not is there a way to make a simple http request, something like a utl_http in oracle.



At the moment iam using a MSSOAP30.SOAPCLIENT object created using sp_OACreate to make this call. However this means that the soap toolkit be installed on the pc on which SQL server is installed. I was hoping to find a completely independent way.



Also when i call sp_OACreate where does sqlserver 2005 look to find that object. Iam thinking of putting the MSSOAP30.dll on that machine, if all else fails.





Ahmad

View 1 Replies View Related

CLR Stored Procedure Consume Webservice

Nov 8, 2006

Can you have a CRL stored procedure call a webservice that returns a dataset?

View 7 Replies View Related

How To Debug Local Webservice's Stored Procedure From Asp.net

Aug 17, 2007

hi
    i have developed asp.net application which calls  web service of localsystem. it also contains logic for interaction with database. we are also creating connection string through coding not from web.config.  i want to debug stored procedure which is called by webmethod. then pls suggess me how can i debug this stored procedure from asp.net which is called  in local webservice???
  if any one have solve pls help...
atul

View 1 Replies View Related

First Steps: Any Chance Of Upgrading VS 2005 Express To SQL 2005 Server?

Mar 4, 2006

Hello,
Thanks for reviewing my question.  I have installed VisualStudio 2005 on a computer and would like to know if I can install SQL 2005 Server and replace the SQL Express version?  Will VS recognize it?
Many Thanks to the Experts
Peter

View 2 Replies View Related

Soap Message Exchange Between .NET Webservice And Stored Procedure

Aug 16, 2007

Hello,

is message exchange between a .NET Webservice and a SQL stored procedure possible?
And if, could you please explain me how? Or give me a tip where i can get more informations
and maybe samples?
thanks for your help

regards
pamelia

View 30 Replies View Related

CLR Stored Procedure Calling MS CRM Webservice Failing With Socket Error

Jun 18, 2007



Hi!



I am developing an integration solution for MS CRM.



The basic idea is to have a CLR stored procedure that draws data from a SQL database, transforms the data, and then adds it to MS CRM via the webservice.



When executing the stored proc, it randomly fails (although at approximately the same time, everytime).



This is the error message:



Msg 6522, Level 16, State 1, Procedure add_CCU_information, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'add_CCU_information':
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
System.Net.Sockets.SocketException:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
System.Net.WebException:
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CRM_Integration.CRM_Service.CrmService.Execute(Request Request)
at StoredProcedures.add_CCU_information()



If someone could please give some advice, I would really appreciate it.



Regards,



Du Toit

View 2 Replies View Related

QUICK HELP FOR STORE PROCEDURE

Nov 7, 2007

hi,

I wirte down a small query and i wanna write down a store procudure for that..can somebody help me out for this ASAP...its urgent..

Select Id,address1,address2,city,state,zip from xyz
where city is null

HOW TO WRITE STORE PROCEDURE..Do I need to delcare parameter and value...??? can't I just save this query directly by saying
CREATE PROCEDURE AS... and than save...beacuae my boss just wanna keep that procudure as reference to run that.

looking for QUICK reply

View 3 Replies View Related

Can't See Job Steps In 2005.

Apr 15, 2008

I've created SQL Server Agent jobs through management studio on SQL Server 2005. I can view and edit these jobs when I am logged into the server via remote desktop, but when trying to administer these jobs through Management Studio on a different machine, the steps do not appear in the job properties window.
Anybody else see this behavior? Know why it occurs? Is it a bug, or another wonderful "feature" of Manglement Studio?

View 10 Replies View Related

Consuming Sqlserver 2005 Webservice From Asp.net 1.1

Oct 4, 2006

Is it possible to consume the sql 2005 web service from 1.1? When I try and do so I receive the following error:Type 'http://schemas.microsoft.com/sqlserver/2004/sqltypes:varchar' is not declared or not a simple type. An error occurred at , (1, 2452).

Thanks,

Olja

View 1 Replies View Related

Accessing External Webservice Or Webpage From SQL 2005

Sep 22, 2006

Is it possible to access a webservice from within SQL 2005?What I am looking to do is place  a trigger on a specific table, and detect if a specific column is being updated.  If it is, I want to launch a robust process that does x, y and z.  Something like this:1) record is updated indicating that an account is closed.2) SQL launched a webservice/ aspx page that builds an HTML email template and then mail it.thanks!

View 2 Replies View Related

Error Connecting To SQL 2005 Through Webservice Using SQL Authentication

Sep 26, 2006

Running a SQL 2005 Database under a Default instance. i.e. (SERVERNAME) and not (SERVERNAME/SQL2005)

View 3 Replies View Related

Reporting Services 2005 And XML DataSource (as WebService)

Apr 25, 2006

I'm trying to build WebService to use result as DataSource for RS 2005 (XML DataSource).

But I have a strange problem.

I have WebMethod with parameters.

When I'm testing my WS in browser then everything works just fine.


But... When I'm trying to call this web-service from VS2005 environment then something strange happens.

Looks like VS passing parameters incorrectly to my WS (not passing at all!)


I've created very simplyfied version just to check parameters:

using System.Xml;
using System.Xml.Serialization;
using System.Messaging;
using System.Text;
using System;
using System.Web.Services;
[WebService(Namespace = "http://company.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class GetRemoteData : System.Web.Services.WebService
{
[WebMethod]
public XmlElement GetData(string CompanyName, string FunctionName, string ParameterList)
{
XmlDocument xmlDocument = new XmlDocument();
XmlElement xmlElement1;
xmlElement1 = xmlDocument.CreateElement("parameters", "values", "urn:errors");
xmlElement1.InnerText = String.Format("{0}, {1}, {2}", CompanyName, FunctionName, ParameterList);
return xmlElement1;
}
}



In the browser WS returns all passed parameters back correctly. VS - not.


What's wrong with my code? Why MSDN example works fine?
Do I need to specify some undocumented (soap specific) attributes?


Where I can find full tutorials how to create RS-compatible web-service?

(Sorry for cross-posting but I have no single reply...)

View 3 Replies View Related

Quick Question About Checking For Existing Procedure Before Creation.

Feb 27, 2008

Hey everyone,

I'm getting a rather bizarre (but probably simple) error when trying to check for the existence of a procedure before creating it. I know I could just drop it, but I'm really curious as to why this code doesn't work right.



Code SnippetIF OBJECT_ID(N'dbo.spCoverageLog') IS NULL
CREATE PROCEDURE [dbo].[spCoverageLog] ( @spName VARCHAR(100) )
AS
BEGIN
UPDATE dbo.CodeCoverage
SET CreationDate = GETDATE(),ProcedureName = @spName;
END

GO
It's generating a syntax error at PROCEDURE.

Anyone know why this might happen?

The solution was to run the CREATE PROCEDURE statement with EXEC, but it shouldn't be.




Thanks in advance for any suggestions!

View 5 Replies View Related

SQL Server (2005) - SQL Job Steps / Error Handling

Apr 4, 2008

We have several jobs that if any step fails, we need to continue with the next step. Due to this we have the both 'On Success Action' and 'On Failure Action' set to 'Go to the next step'. Our only issue is that when all the steps are done we still require the job itself to fail.

So my question is this, is there anyway the status of a job can be queried to determine if any of it's steps failed?

View 6 Replies View Related

Sql Server 2005 Reporting Services And XML Webservice DataSource

Dec 14, 2007

I am new to both Reporting Services and Webservices implementation so I am just trying to use a simple example. I found a Webservice on the internet that returns movie information:

http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx?wsdl

I am trying to call in using XML DataSource and with absolutely no luck. Here are the steps I have followed:

DataSource type: XML
Connection String: http://www.ignyte.com/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx

Report Data Quert:

<Query>
<SoapAction>http://www.ignyte.com/GetUpcomingMovies</SoapAction>
<Method Namespace="http://www.ignyte.com/whatsshowing" Name="GetUpcomingMovies">
<Parameters>
<Parameter Name="month">
<DefaultValue>12</DefaultValue>
</Parameter>
<Parameter Name="year">
<DefaultValue>2007</DefaultValue>
</Parameter>
</Parameters>
</Method>
<ElementPath>RunQueryResponse{}/RunQueryResult{}/diffgram{}/DataSetName/TableName</xmldp:ElementPath>
</Query>


I am getting an error: The XmlDP query is invalid. (Microsoft Report Designer)


Any help? I am trying to figure out this simple example so I can apply it to my own webservice.

Thanks

View 1 Replies View Related

Basic Steps As How To Web Usage Mine In Sql Server 2005

Jan 26, 2007



Hi there,

I am doing a project on web usage mining of my universities server logs and im just wondering how i go about mining them in sql server 2005?

Do i mine them in one table? do i normalise the web log data? what algorithms will i use on them as im trying to get usage patterns from the users and also where most of the users come from.



Thanks in advance



Gary

View 3 Replies View Related

How To (the Steps) To Create DTS Package In 2005 As In The Case Of SQL 2000

May 30, 2007

Hi,



Warm Wishes for all !!



I used to create DTS Package in SQL Server 2000 and some times schedule accordingly , but in SQL 2005 although there is a provision to buid the same through integration service but couldnt able to succeed.

( the goal is to transfer the data from one table to another in different database)



Is there any document or any one can provide the steps involved in developing DTS Package in SQL 2005



Thanks

Aravind

View 1 Replies View Related

Quick Launch 2005 On PC

Jul 25, 2007

Poor me :o I have to share a home PC now so cannot have things my own way. When using my own PC I had SQL Server 2005 dev edition run on start up. Now I am sharing it seems rather churlish to not have it start on demand.With 2000 you got a little icon in the taskbar that indicated the status of SQL Server and a quick right click -> start was all you needed to get the little fella up and running. With 2005 you need to go all the way to configuration manager and start it. I have four options:#1 - a few mouse clicks to start SQL Server via configuration manager (unacceptable - imagine all the wasted time and RSI!)#2 - bat file to start SQL Server (ok)#3 - more sophisticated little app that shows the status of SQL Server in the taskbar and allows me to start it (nice but a pain to put together)#4 - something much spiffier which one of you gurus can let me in on I am sat on the edge of my little seat in anticipation :)

View 1 Replies View Related

Steps To Follow SQL Server 2005 Reporting Services Forms Authentication

Oct 12, 2007

I need to know the steps on how to configure the SSRS Forms Authentication and its IIS Configuration. What specific Config Files should be modified?

i am using IIS 6.0, Windows Server 2003, SQL Server 2005.

Please help....

View 1 Replies View Related

Steps To Install 64 Bit Sql Server 2005 Standard Edition In Windows Vista 64 Ultimate

Jul 25, 2007

Hi



I have just take my system back to the factory defaults after some unsuccessful attempts to install 64 bit and 32 bit sql server on my notebook. I am looking to use either 32 or 64 bit (I have disks for both) and I would like to get a step by step guide that will help me through the process.



I tried an install of the 64 bit version, applied SP2, and it went smoothly but the report services browser didn't work. I tried to change some IIS settings but I didnt document what I changed so i was unable to undo the changes that i made when these didnt work.



I tried several combinations of things but then decided that a clean install on a clean system was the best option.



I need the SQL engine , reporting services, analysis services - and possibly integration services - i am not sure if i need notification services (dont know what it does anyway!)



I also have vs2005 - should i install that first or after sql server 2005 SP2?







Thanks



Doug

View 1 Replies View Related

Need A Quick Answer About Reporting Services In SQL Server 2005?

Jun 26, 2007

Hi all,

I apologize in advance for the lack of homework before posting, but I am just looking for a quick answer, or a quick point in the right direction to figure this out.

I have a developer from an adjacent team that wants to use Reporting Services in a SQL Server 2005 installation.

From what I found online during what I thought was a definitive search yesterday, I gave him the MSDN SQL Server 2005 DVD and told him that Reporting Services is now part of the standard installation. Which is what my brief search yesterday indicated to me.

He did the installation (full, according to him) and said he could not find Reporting Services.

So, the quick question is...

Where is Reporting Services in SQL Server 2005? I don't have a separate MSDN DVD that contains it as was the case on SQL Server 2000. This further supports my (wavering) position that it is part of the standard installation.

Thoughts? Direction? Collective kicks in the posterior?

Thanks!

View 6 Replies View Related

How Do You Add A Job(multiple Steps) To Be One Of The Steps Of Another Job

Jun 6, 2001

Hi,
I have two job J1 and J2, each one has 10 steps. Now I want J2 to be the 11th step of J1 and I did not want manually type all the steps of J2 to be 11-20 step of J2. Is there an easy way through TSQL to do this ?
sp_add_jobstep only works when the step is OS command or a script but not a job

View 2 Replies View Related

Communicate Between Two Servers

Jun 9, 2004

I have two sql servers, A and B. each one has one database, A and B. I am trying to write a stored porcedure in database A to retrieve the data in database B. how do I do it? can you give me a simple example. (like "select")

View 6 Replies View Related

If WCF Can Communicate With ServiceBroker?

Dec 10, 2006

hi,

I want tomake wcf and service broker communicate with each other,Are there some resources about that?

thanks in advance

View 10 Replies View Related

Application Cannot Communicate With DB

Sep 24, 2007



I have a C# windows application which i've developed that uses an embedded SQL CE DB.
When i deployed the project, It worked fine for many PCs.
But for some PCs it seems it cannot (The application) communicate with the DB.
Why i am saying that ? That's because the application itself opens . but at the first task where the applciation requests the DB for information, It just CAN'T do that, And stands as if no action has happened (i.e. no button has been pressed)...


Any ideas ?

View 1 Replies View Related

Communicate With Service Broker In C#?

Mar 22, 2007

So SQLDependencies failed to do what I wanted them to do for my Cache Invalidating, so i'm going to humor another possibility for a half day - Triggers on my database table that communicate messages to my C# inside my ASP.NET App. Any advice on how to tap into a message queue with C#? I'm thinking that my messages could be 1 of about 100 different strings as far as what occurred on the Database Tables

View 3 Replies View Related

How To Communicate From MS SQL Server To MySQL

Dec 21, 2007

I want to send table values from MS SQL Server to MySQL. For example if any row is inserted or deleted or updated in MS SQL Server database then the same has to be reflected in a similar table in MySQL so that the both the database table are in synch with each other. it would be of gr8 help if anyone could suggest something regarding this. Thanks in advance....

dinesh

View 3 Replies View Related

Job Fails To Communicate With SQL Server Agent

Sep 13, 2006

Hi,

Just need some help on a job issue.

The job in question gives the below mentioned error when run

Error 22022: Unable to post notification to SQL
ServerAgent (reason: OpenFileMapping()returned error
2, 'The system cannot find the file specified')

This seems to have started after I changed the owner for the Agent and MSSQL service from local service to a domain ID.

FYI, I have also changed the job owner from sa to the domain ID and have tried restarting the agent service in the hope that the Job can speak to the agent .. but it doesnt :(

Microsoft suggests to change some registry entries but I am not sure if that'd work
http://support.microsoft.com/default.aspx?scid=kb;en-us;911841&sd=rss&spid=2852

The server on which this job is hosted is a production box .. so am a litle apprehensive about making any registry changes

Any Suggestions ?

Thanks.

Warm Regards,
Ranjit.

View 2 Replies View Related

Unable To Communicate With Report Server

Mar 27, 2007



When I browse to http://localhost/Reports/Pages/Folder.aspx I am getting "Unable to communicate with report server. Please verify that the report server is operational". The http://localhost/ReportServer runs fine in the browser. Also the config files have the correct urls. I don't have any other service like Sharepoint installed on the machine

Any ideas?

Thanks

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved