Web services SSIS Web服务-写入Web服务

Web services SSIS Web服务-写入Web服务,web-services,ssis,Web Services,Ssis,我已成功使用SSIS中的“使用web服务”任务,但我不知道如何写入web服务,有人能帮我吗 谢谢这个问题太模糊了,无法给出明确的答案,但是,猜猜你在问什么,你已经能够从web服务(GET)读取数据,但是你现在想要将数据写入(POST/PUT)web服务 如果是这样,最好使用脚本任务并使用C#(或VB)调用所述web服务。我还建议GET请求也使用这种方法,而SSIS Web服务任务不处理“较新”的Web服务协议,如oAuth身份验证 粗略样本如下: using System.Net

我已成功使用SSIS中的“使用web服务”任务,但我不知道如何写入web服务,有人能帮我吗


谢谢

这个问题太模糊了,无法给出明确的答案,但是,猜猜你在问什么,你已经能够从web服务(GET)读取数据,但是你现在想要将数据写入(POST/PUT)web服务

如果是这样,最好使用脚本任务并使用C#(或VB)调用所述web服务。我还建议GET请求也使用这种方法,而SSIS Web服务任务不处理“较新”的Web服务协议,如oAuth身份验证

粗略样本如下:

      using System.Net
      using System.IO          

      string url 
            = "http://webservicehere.org";

        // create the request
        HttpWebRequest request 
            = (HttpWebRequest)HttpWebRequest.Create(url);

        // set the method to POST
        request.Method 
            = "POST";

        // set the content type, usually application/json or application/xml
        request.ContentType 
            = "application/json";

        // handle authentication, in this case the web service
        // requires the authentication token to be passed in as a
        // header called "Cookie"
        request.Headers.Add("Cookie", SqlAuthCookie);

        // get the stream object to use to write the request data
        StreamWriter requestWriter 
            = new StreamWriter(request.GetRequestStream());

        // write the data to the web service
        // where (data) is the JSON/XML that you are
        // sending to the endpoint
        requestWriter.Write(data);

        // close the connection upon completion
        requestWriter.Close();

        try
        {
            // read the response received from the web service
            HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();

            // code to handle the response goes here
            // i.e. deserialise json/xml to strongly typed objects

        }
        catch (WebException we)
        {
            // catch any exceptions thrown by the web service here
        }
        catch (Exception e)
        {
            // catch other exceptions here
        }

我相信“阅读”指的是“调用”,这意味着web服务正在执行的操作可能是阅读或写作,谁知道呢?您尝试过什么?你能提供一个不适合你的代码示例吗?