I have a web-service with the following methods (c#):
[WebMethod]
public string HelloWorld1(string a)
{
return "Hello World - " + a.ToString();
}
[WebMethod]
public string HelloWorld2()
{
return "Hello World";
}
I am trying to use it inside a sql-server procedure with the following code:
...
-- URL 1
set @url = 'http://localhost/ws/ws1.asmx/HelloWorld2'
-- URL 2
--set @url = 'http://localhost/ws/ws1.asmx/HelloWorld1?a=amama'
EXEC msdb.dbo.sp_OACreate 'MSXML2.XMLHTTP', @OBJ OUT
EXEC msdb.dbo.sp_OAMethod @OBJ, 'Open', NULL, 'post', @URL , false
EXEC msdb.dbo.sp_OAMethod @OBJ, 'send'
EXEC msdb.dbo.sp_OAGetProperty @OBJ, 'responseText', @RESPONSE OUT
SELECT @RESPONSE [response]
EXEC msdb.dbo.sp_OADestroy @OBJ
When I use the first URL 1, I get the desired response. But when I use URL 2, the following error is showed:
System.InvalidOperationException: Request format is invalid .
em System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
em System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Could you please tell me what is wrong?