Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Send XML/SOAP Envelope to Web Service using T-SQL

Author  Topic 

Aaron
Starting Member

20 Posts

Posted - 2007-08-18 : 17:26:29
I'm trying to send a SOAP XML envelope to a Web Service in a SQL Server 2005 Stored Procedure. Is this possible? I've found some code on the internet that seems appropriate using sp_OA_Create but it's failing. The message I get is:

msxml4.dll
The parameter is incorrect.

Does this make sense to anyone?
Could someone even point me in the right direction since I can't even seem to find documentation to help me do this.

Thanks in advance,

Aaron

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-18 : 17:33:51
why are you not using http soap endpoint?

if you're trying to call a web service from sql server... don't do it. find a different way.
look into CLR.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-18 : 19:05:24
Why should I not try to call a webservice from SQL?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-18 : 19:09:55
the question is why should you?


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-18 : 19:52:23
SQL Server 2005 is capable to create it's own http endpoints.
With this, I think you can call web-services for various reasons.

What do Books Online tell you about "http endpoints"?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-18 : 19:59:34
there's a difference between calling a web service from sql server and
having http endpoint act as a webservice provided by sql server.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-18 : 22:49:27
Exactly, I thought the SQL Endpoint was to allow others to access to your sql server, not to allow you to get access to web services. Am I on the wrong path?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-19 : 09:29:44
your thinking is correct.
however calling a webservice from sql server is not good practice because of the synchronous nature of the operation
which can slow down sql server.

can you tell us why exactly do you want to do this? maybe we can suggest an alternative.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-19 : 10:15:56
I am processing an incoming xml document, then have to send back an acknowledgment to the sender. Up to now I've been doing this all through a powerbuilder app, but we're getting rid of it and I'd like the whole process to run as a job on sql server.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-19 : 10:32:34
well if sending an ack means calling a web service your only way from doing it inside SQL Server is using CLR integration.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-19 : 10:44:55
Is that a difficult thing to do ( CLR integration )?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-19 : 10:48:28
no not really
you can easily integrate the CLR into sql server 2005.

create a CLR stored procedure that calls the web service.
http://technet.microsoft.com/en-us/library/ms131094.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-19 : 10:55:20
this post is exactly what you need:
http://blogs.msdn.com/sqlclr/archive/2005/07/25/Vineet.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-19 : 11:37:42
Thank you very much, Spirit1.

Aaron
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-27 : 17:34:27
Ok, I attempted to create a vb.net dll to call my webservice. When I try to create a SQL assembly of my dll using this code:

CREATE ASSEMBLY DWFWebService from Z:\dwng_broker\WebService1.dll'
with permission_set = EXTERNAL_ACCESS

I get:

Msg 10327, Level 14, State 1, Line 12

CREATE ASSEMBLY for assembly 'WebService1' failed because assembly 'WebService1' is not authorized for PERMISSION_SET = EXTERNAL_ACCESS. The assembly is authorized when either of the following is true: the database owner (DBO) has EXTERNAL ACCESS ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission. If you have restored or attached this database, make sure the database owner is mapped to the correct login on this server. If not, use sp_changedbowner to fix the problem.

Is there something simple I need to do or do I have to jump through all the hoops in the error message?

Any help would be appreciated,

Aaron.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-27 : 17:36:16
Have you used the Surface Configuration Manager?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Aaron
Starting Member

20 Posts

Posted - 2007-08-27 : 17:42:44
I did, indeed, to enable CLR Integration. Is there anything else I should do?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-28 : 04:32:26
so your database trustworthy option is set to on?

if yes then you'll have to show us your code.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -