TSQL Soap Request

I am trying to post to my web service.

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

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?

    @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/">

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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.
Larry Bristersr. DeveloperAuthor Commented:
  Please clarify...what exactly do I need to remove?
Shaun KlineLead Software EngineerCommented:
On line 8 of your posted code, change it to:
SET @url = 'http://ggctc.mydomain.com/Service.asmx'
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Larry Bristersr. DeveloperAuthor Commented:
Same thing
Response NULL
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 
      EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT
      SELECT      hResult = convert(varbinary(4), @hResult), 
            source = @source, 
            description = @desc, 
            FailPoint = 'SetRequestHeader failed'

Open in new window

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"
Larry Bristersr. DeveloperAuthor Commented:
  Where is @objectID set?
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.
Larry Bristersr. DeveloperAuthor Commented:
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.