Please ensure to include your code between [code][/code] tags while asking or replying to questions.

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Sending soap request in qtp

02-24-2011, 08:33 AM
Post: #1
Not Solved Sending soap request in qtp

Hi ,
need help on webservices testing

i want to sent SOap xml as request using post method and verify the xml content

need some sample code on webservices testing


tugandhar@gmail.com
Find all posts by this user
Quote this message in a reply
02-24-2011, 01:28 PM
Post: #2
Not Solved RE: Sending soap request in qtp
Hi ugandhar,

You can use web Service testing Wizard provided by QTP for testing webservices. Else can be done using WinHttpRequest object.

First Create an properly formatted request XML.

'Create Object of WinHttp.WinHttpRequest.5.1
Code:
Set WinHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
'Configure timeouts in milliseconds (Resolve, Connect, Send, Receive).
Code:
WinHttpReq.SetTimeouts 30000, 30000, 30000, 30000
'Open [POST] connection to Web Service via WinHttpRequest object.
Code:
WinHttpReq.Open "POST", ServerName, False
'Configure HTTP request header properties.
Code:
WinHttpReq.SetRequestHeader "Content-Type", "text/xml;charset=utf-8"
WinHttpReq.SetRequestHeader "Accept", "text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
WinHttpReq.SetRequestHeader "Content-Transfer-Encoding", "binary"
WinHttpReq.SetRequestHeader "Connection", "keep-alive"

'Define connection values.
Code:
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
UserName = "XYZ"
Password
= *****

'Send connection authorization credentials.
Code:
WinHttpReq.SetCredentials UserName, Password, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
'Send request input as a properly formatted XML string.
Code:
WinHttpReq.Send(strXML)
'Reference response text
Code:
sResponseText = CStr(WinHttpReq.ResponseText)

Verify what ever Tag you want to verify.

Thanks,
Rajeshwar

Practice as if you are the worst, perform as if you are the best
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Want to Automate SOAP UI test cases on QTP geethwind 6 8,329 08-07-2014 12:03 AM
Last Post: rshrestha
  Request Help | Usage of Oracle Add-In for Oracle SQL Developer Nasir Ahmed 3 252 06-18-2014 04:28 PM
Last Post: vinod123
Rolleyes Urgent help with Gmail Sending mail feature nidhitaneja 2 306 03-05-2014 09:39 PM
Last Post: nidhitaneja
  Webservies with SOAP Attachment - QTP Kesavan 5 3,126 04-26-2013 03:11 PM
Last Post: sheela
MyBB request for VB code for finding X in dynamic web table davidsmi@bossig.com 2 1,169 04-16-2011 06:40 AM
Last Post: davidsmi@bossig.com



User(s) browsing this thread: 1 Guest(s)