Execute a function from a web service

  • Hy

    Please help me with this problem:

    I need to connect from a dts package to a web service and

    to call operations on the service(sorry for my english)

  • Hi,

    Have a search about for the ServerXMLHTTP.4.0 object on Google (other search engines are available!! :D). This object allows you to send HTTP GET and HTTP POST request in ActiveX scripting.

    You could also use this object via the sp_OACreate, sp_OAMethod, sp_OAProperties procedures in T-SQL.

    As I say, have a look around see what you can find, if you need more help with what you find, post back and we can help you further.



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • My web services in on WCF, in .net.

    I tried:

    DECLARE @err varbinary

    ,@sh int-- SOAP handle

    ,@ret varchar(8000)

    ,@msg varchar(32)

    SELECT @msg = 'sp_OACreate'

    EXEC @err = sp_OACreate 'MSSOAP.SoapClient30', @sh OUT

    exec @err=sp_OASetProperty @sh, 'ClientProperty', 'True', 'ServerHTTPRequest'

    EXEC@err = sp_OAMethod @sh,'MSSoapInit',NULL,'http://CompHost:7777/ServiceName?wsdl'

    but it gives me 0x80070057 error on the mssoapinit function.

    Why?

  • It sounds as though your sp_OACreate execution is failing. Run: EXEC sp_OAGetErrorInfo after each EXEC statement to return the errors. You could also use Print @sh to make sure that the create is working.

    Scratch the above... :crazy:

    After having a look at some of my previous work and a bit of internet research, I've found that the Error code 0x80070057 is an incorrect parameter. Although I can't help as to which one is incorrect.



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • I solved the problem with mssoapinit (changigd the binding type), but can you tall me how to call a method. I have on my web service this operation:

    public int sqrtFunc(int j)

    {

    return j * j;

    }

    I tried to call it this way:

    declare @i int

    set @i=2

    EXEC@err = sp_OAMethod @sh,'sqrtFunc','j',@i,@ret OUT

    but didn't work. What is the right way to call it

  • I find the answer:

    EXEC@err = sp_OAMethod @sh,'sqrtFunc',@ret OUT,@i

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply