TSQL Soap Request

I am trying to post to my web service.

The xml below (@requestBody) works fine in SoapUI.org app

However...
When I run in TSQL this I am getting no response.
Nor am I getting an error.

How can I see what is actually going on?

DECLARE @obj INT ,
    @url VARCHAR(MAX) ,
    @response VARCHAR(MAX) ,
    @requestHeader VARCHAR(MAX) ,
    @requestBody VARCHAR(MAX) ,
    @contentLength VARCHAR(10)

SET @url = 'http://ggctc.mydomain.com/Service.asmx?wsdl'

SET @requestBody = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:MemberGet>
         <!--Optional:-->
         <tem:methodKey>mykey</tem:methodKey>
         <!--Optional:-->
         <tem:certID></tem:certID>
         <tem:startDate>2006-10-07</tem:startDate>
         <tem:endDate>2015-09-16</tem:endDate>
         <!--Optional:-->
         <tem:filter>ACTIVE</tem:filter>
      </tem:MemberGet>
   </soapenv:Body>
</soapenv:Envelope>'

SET @contentLength = CAST(LEN(@requestBody) AS VARCHAR(10)) 


EXEC sp_OACreate 'MSXML2.ServerXMLHttp', @obj, OUT
EXEC sp_OAMethod @obj, 'Open', NULL, 'POST', @url, false
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Type','text/xml;charset=UTF-8'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'SOAPAction', 'POST'
EXEC sp_OAMethod @obj, 'setRequestHeader', NULL, 'Content-Length', @contentLength
EXEC sp_OAMethod @obj, 'send', NULL, @requestBody
EXEC sp_OAGetProperty @obj, 'responseText', @response OUT

SELECT  @response [RESPONSE]

EXEC sp_OADestroy @obj

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun KlineLead Software EngineerCommented:
The wsdl at the end of your URL tells the web service to provide the web service definition. I don't believe that should be included when you are attempting to run the web service itself.
0
Larry Bristersr. DeveloperAuthor Commented:
Shaun,
  Please clarify...what exactly do I need to remove?
0
Shaun KlineLead Software EngineerCommented:
On line 8 of your posted code, change it to:
SET @url = 'http://ggctc.mydomain.com/Service.asmx'
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Larry Bristersr. DeveloperAuthor Commented:
Same thing
Response NULL
0
Shaun KlineLead Software EngineerCommented:
The sp_OA methods return a result when executed. You may want to capture that value to determine if an error occurs within those methods:
DECLARE @hResult int
DECLARE @source varchar(255), @desc varchar(255) 
EXEC @hResult = sp_OAMethod @obj, 'setRequestHeader', null, 'Content-Length', @len 
IF @hResult <> 0 
BEGIN
      EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT
      SELECT      hResult = convert(varbinary(4), @hResult), 
            source = @source, 
            description = @desc, 
            FailPoint = 'SetRequestHeader failed'
      return
END

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shaun KlineLead Software EngineerCommented:
It also appears that you soap action is not correct. It should contain the method name you are calling in the web service. It should be something like "http://tempuri.org/YourMethodNameHere"
0
Larry Bristersr. DeveloperAuthor Commented:
SHaun,
  Where is @objectID set?
0
Shaun KlineLead Software EngineerCommented:
Sorry, that should have been @obj, as it is in the code you posted. I changed the first occurrence, but missed the second.
0
Larry Bristersr. DeveloperAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.