Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 11th, 2005, 02:11 AM
Registered User
 
Join Date: Oct 2005
Location: noida, UP, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kissvineet
Default how to send http post request via stored procedure

Hello Sir

i am a beginner level programmar. i have got a task and need help on
that. Plz Help me.

i have to send a http post request from a stored procedure to a URL.
and also from that stored procedure i have to send XML Data to the URL.

i have following XML Info.

<ERECHARGE>
          <TRANS_ID>Vendor's Transaction ID </TRANS_ID>
          <SOURCE_ID> Vendor's Name </SOURCE_ID>
          <MDN> Vendor's MDN </MDN>
          <DEALER_ID> Vendor's Dealer ID </DEALER_ID>
          <REQUEST>
                      <REQUEST_TYPE>ERECHARGE</REQUEST_TYPE>
                      <ATTRIBUTES>
                                 <ATTRIBUTE>
                                            <NAME>TARGET_MDN</NAME>
                                            <VALUE>MDN where recharge
amount to be transferred </VALUE>
                                 </ATTRIBUTE>
                                 <ATTRIBUTE>
                                           <NAME>AMOUNT</NAME>
                                           <VALUE>Recharge
Amount</VALUE>
                                 </ATTRIBUTE>
                                 <ATTRIBUTE>
                                            <NAME>PIN</NAME>
                                            <VALUE>Unique PIN given to
distributor on registration</VALUE>
                                </ATTRIBUTE>
                      </ATTRIBUTES>
          </REQUEST>
</ERECHARGE>

i have to send this information to a URL via a stored procedure.

i have to use stored procedure because we also have to store these
information in a table.

also, we have to store the response from that URL.

now, I am asking about what approach i should take. and how to solve
this problem.

i will be very thankful to you.

thanx


Reply With Quote
  #2 (permalink)  
Old November 12th, 2005, 12:38 AM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you have to have a browser to get a url. The only way I can see doing this if I follow the question is to shell out to the command prompt launch a browser with the xml data submitted to the url. SQL can create xml but it expects some other thing to talk on the web for it. Can't you have an asp page or ??? call the stored proc, get the xml, then have the web page hit your url? I don't follow how you plan to use just SQL are you using other programming tools?

Reply With Quote
  #3 (permalink)  
Old November 12th, 2005, 05:39 AM
Registered User
 
Join Date: Oct 2005
Location: noida, UP, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kissvineet
Default

hi

i think we can post http request from SQL Server. i have done it. Now the only issue is to post XML Data.


Reply With Quote
  #4 (permalink)  
Old November 14th, 2005, 01:47 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Perhaps you can teach me. How do you post a http request from sql without executing something from a command prompt?

Reply With Quote
  #5 (permalink)  
Old March 29th, 2006, 07:42 AM
Registered User
 
Join Date: Mar 2006
Location: Kolkata, West Bengal, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Papak
Default

Http Post can be done from Sql Server 2000 with Stored Procedure. I have done and implemented it .

Here is the Stored Procedure :


CREATE procedure HTTP_POST( @sUrl varchar(200), @response varchar(8000)
out)
As


Declare
@obj int
,@hr int
,@status int
,@msg varchar(255)


exec @hr = sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
-- exec @hr = sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
if @hr <> 0 begin Raiserror('sp_OACreate MSXML2.ServerXMLHttp.3.0
failed', 16,1) return end


exec @hr = sp_OAMethod @obj, 'open', NULL, 'POST', @sUrl, false
if @hr <>0 begin set @msg = 'sp_OAMethod Open failed' goto eh end


exec @hr = sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type',
'application/x-www-form-urlencoded'
if @hr <>0 begin set @msg = 'sp_OAMethod setRequestHeader failed' goto
eh end


exec @hr = sp_OAMethod @obj, send, NULL, ''
if @hr <>0 begin set @msg = 'sp_OAMethod Send failed' goto eh end


exec @hr = sp_OAGetProperty @obj, 'status', @status OUT
if @hr <>0 begin set @msg = 'sp_OAMethod read status failed' goto
eh
end


if @status <> 200 begin set @msg = 'sp_OAMethod http status ' +
str(@status) goto eh end


exec @hr = sp_OAGetProperty @obj, 'responseText', @response OUT
if @hr <>0 begin set @msg = 'sp_OAMethod read response failed' goto
eh end


exec @hr = sp_OADestroy @obj
return
eh:
exec @hr = sp_OADestroy @obj
Raiserror(@msg, 16, 1)
return
GO


I think it will he helpful to you.

Thanks
Papak


Papak Mondal
Senior Developer
http://www.autocastle.com
Reply With Quote
  #6 (permalink)  
Old April 5th, 2006, 06:38 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From what I can see..... You are going through the SQL server to execute code that does a post (sends web data but doesn't look at the web servers response). If you want to get web data it will have to be on port 80, SQL won't listen on this port for you. You can possibly shell out to a command prompt and run some text based web browser and possibly capture the results of the text based browser???

Just a thought.

This thread intrigues me. If you get this to work please post how.

Thanks,
Rob


Reply With Quote
  #7 (permalink)  
Old August 18th, 2008, 01:26 AM
Registered User
 
Join Date: Aug 2008
Location: manhatten, newyork, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Paessler URL Recorder helps to find out the URLs and POST DATA strings that a user sends to a web server while surfing a sequence of URLs. It works like a standard web browser, whereby you enter a URL at the top of the application then click "Go". You can then use the mouse to surf through the sequence you want to record. While you are accessing one page after the other, the URL and - if you submit a POST request - the POST DATA, are stored in the list at the bottom of the window. Once you have finished recording your URLs or POST DATA you can save the list of URLs to CSV and HTML, copy the list to the clipboard and copy individual URLs or POST DATA to the clipboard.
----------
Alicemark

Last edited by ntimmons; October 19th, 2012 at 09:41 AM.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send a file with HTTP Request in Jmeter munees BOOK: Expert One-on-One J2EE Design and Development 2 April 16th, 2014 06:32 AM
post a http request/response in new window nomenu dfarkish Javascript How-To 4 August 12th, 2009 09:58 AM
how to send Http request via a trigger kissvineet .NET Web Services 0 October 28th, 2005 05:50 AM
how to send Http request via a trigger kissvineet .NET Web Services 0 October 28th, 2005 05:48 AM



All times are GMT -4. The time now is 10:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.