sqlserver2008 中使用MSXML2.ServerXMLHttp拼装soap调用webservice
要调用的接口方法:UP_ACC_inst_Info(string xml)
接口参数:xml格式的字符串
接口功能:传递人员编号、备注到接口进行更新,接口返回更新结果。
实例:
declare @strXML varchar(5000)
declare @obj int
declare @sUrl varchar(5000)
declare @response varchar(5000)
declare @hr int
--参数
SET @strXML ='<root><accountid>654</accountid> <innotes>654的备注</innotes></root>'
--将参数中的<,>转换为转义字符,否则接口无法把@strXML识别为string类型,会报400错误信息
set @strxml=replace(@strXML,'<','<')
set @strxml=replace(@strXML,'>','>')
--接口地址
set @sUrl='http://localhost/WebService.asmx'
--拼装soap 1.2 格式信息
set @strXML='<?xml version="1.0" encoding="utf-8"?><soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body><UP_ACC_inst_Info xmlns="http://tempuri.org/"><strXML>'+@strXML+'</strXML></UP_ACC_inst_Info></soap12:Body></soap12:Envelope>'
exec sp_OACreate 'MSXML2.ServerXMLHttp', @obj out
exec sp_OAMethod @obj,'Open',null,'POST',@sUrl,FALSE
exec sp_OAMethod @obj,'setRequestHeader',null,'Content-Type','application/soap+xml; charset=utf-8'
exec sp_OAMethod @obj,'Send',null,@strXML
exec sp_oagetproperty @obj,'status',@response out
IF @hr <> 200
BEGIN
EXEC sp_OAGetErrorInfo @obj
print @obj
return
END
exec sp_oagetproperty @obj,'responseTEXT',@response out
--由于接口返回的结果也是xml格式的string,将里边的<,>转换回来
set @response=replace(@response,'<','<')
set @response=replace(@response,'>','>')
print @response
exec sp_oadestroy @obj
sqlserver2008 中使用MSXML2.ServerXMLHttp拼装soap调用webservice的更多相关文章
- 将map中的查询参数拼装到URL路径中
被调接口的URL路径: //被调接口url String apiUrl = "http://api.open.xxxxxx.com/implatform/interview/send?acc ...
- C#实现SOAP调用WebService
最近写了一个SOA服务,开始觉得别人拿到我的服务地址,然后直接添加引用就可以使用了,结果"大牛"告知不行. 让我写一个SOAP调用服务的样例,我有点愣了,因为没做过这方面的,于是搞 ...
- C# 通过Get、Post、Soap调用WebService的方法
实现代码来源于网络,我只是作了一些修改! using System; using System.Web; using System.Xml; using System.Collections; usi ...
- c#soap调用WebService
辅助类 /// <summary> /// 上传数据参数 /// </summary> public class UploadEventArgs : EventArgs { i ...
- PHP5下SOAP调用实现过程
本文以某公司iPhone 6手机预约接口开发为例,介绍PHP5下SOAP调用的实现过程. 一.基础概念 SOAP(Simple Object Access Protocol )简单对象访问协议是在分散 ...
- PHP5下WSDL,SOAP调用实现过程
一.基础概念 SOAP(Simple Object Access Protocol )简单对象访问协议是在分散或分布式的环境中交换信息的简单的协议,是一个基于XML的协议,它包括四个部分:SOAP封装 ...
- Java调用WebService方法总结(8)--soap.jar调用WebService
Apache的soap.jar是一种历史很久远的WebService技术,大概是2001年左右的技术,所需soap.jar可以在http://archive.apache.org/dist/ws/so ...
- JS中字符串拼装 单双引号的处理 字符转义
js中可能会用到动态追加元素,可能数据也是从后台传过来的,当然有两种思路, 1.在后台拼装好直接返回; 2.在前台js里面拼装, 如果拼装大量的html时可能单双引号就容易出问题;那么如何解决呢?最近 ...
- 【Raspberry Pi】新入手的Raspberry Pi3拼装日志
一.概述 2016年暑假某宝入手Raspberry Pi 3,装机清单: 树莓派主板 亚克力外壳 小风扇 散热片 30G SD card 螺丝若干颗 因机型问题,可能与你的机器有微小差异 二.装机过程 ...
随机推荐
- Android入门2:从GridView控件使用到自定义Adapter
在日常手机app的使用中,出现频率最高的便是ListView和GridView.ListView的例子是微信主界面,而GridView的例子则是支付宝的主界面,不明白的小伙伴打开手机便一目了然.然而这 ...
- iOS9TableView分割线默认不显示,只有滑动的时候才显示 解决办法
只有iOS9和iPhone6 plus模拟器上TableView分割线不会显示,后来终于找到了原因: 由于iPhone6 plus的分辨率较高,开发的时候同常都使用command + 3 或者 com ...
- 原创:2016.4.25-2016.5.1 C# informal essay and tittle_tattle
1.Some tips of the Time in C sharp (1) How to define the category of the "Datetime"? date ...
- 4 常量类--Map常量
public static final HashMap<String, String> ETL_SOURCE_INPUTTYPE_MAP = new HashMap<String, ...
- poj2385 简单DP
J - 简单dp Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:65536KB 64bit ...
- static说明
1.最基本用法:加static的全局变量或者函数,只能在本文件中使用.可见性只在本文件中. 当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性.为理解这句话,我举例来说 ...
- 获取本机CPU,硬盘等使用情况
早上的时候接到主管的一个任务,要获取服务器上的cpu,硬盘, 数据库等 的使用情况,并以邮件的方式发给boss, = =没办法,公司的服务器真是不敢恭维,顺便吐槽一下公司的网速,卡的时候30k左右徘徊 ...
- Mvc htmlhelper that generates a menu from a controller
Simple menu system that grabs a list of actions from a single controller and creates an unordered li ...
- php环境安装及搭建
最近由于项目需要 转战 PHP . 在做了差不多两年java后 说实话看php代码还是有些难受的. 毕竟不习惯.废话不说 先说一下 PHP环境的部署等等,也就是最近几天学习的心得吧.方便以后参考. ...
- [php] PHP创建指定目录和文件
前几天看到有人问PHP环境下如何创建文件到指定目录下,正好自己最近在学习,经过一翻测试,终于出结果了,贴出来与大家分享. 目录结构: 代码所在的文件wwwroot/mydir/test/test.ph ...