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 螺丝若干颗 因机型问题,可能与你的机器有微小差异 二.装机过程 ...
随机推荐
- 0301——Notification 通知
注册消息 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(方法) name:@"消息名字&q ...
- 慕课linux学习笔记(七)常用命令(4)
帮助命令 Man命令 Man的级别 命令帮助 可被内核调用的函数帮助 函数和函数库帮助 特殊文件帮助 /dev 配置文件帮助 游戏的帮助 其他杂项的帮助 管理员可用命令帮助 内核相关文件的帮助 -f ...
- 自定义滚动条 niceScroll 配置参数
配置参数 当调用“niceScroll”你可以传递一些参数来定制视觉方面: cursorcolor - 十六进制改变光标颜色,默认值是“#000000” cursoropacitymin - 改变不透 ...
- Hdu1092
#include <stdio.h> int main() { ; while(scanf("%d",&n)){ ) {;} else{ int i,a; ;i ...
- akoj-1048-求某一整数序列的全排列问题
求某一整数序列的全排列问题 Time Limit:1000MS Memory Limit:65536K Total Submit:35 Accepted:16 Description 现有一整数序列 ...
- Log4net 配置详解
首先需在config文件的<configSections>节点中增加子节点配置. <configSections> <section name="log4net ...
- Navicat_Preminum
一. 安装 参考http://blog.csdn.net/longyuhome/article/details/79206041. 软件准备• [OYKSOFT.COM]navicat11.0.8_p ...
- 图解SSL/TLS协议(转)
本周,CloudFlare宣布,开始提供Keyless服务,即你把网站放到它们的CDN上,不用提供自己的私钥,也能使用SSL加密链接. 我看了CloudFlare的说明(这里和这里),突然意识到这是绝 ...
- 转:PHP分页技术的代码和示例
本文来自:10 Helpful PHP Pagination Scripts For Web Developers 分页是目前在显示大量结果时所采用的最好的方式.有了下面这些代码的帮助,开发人员可以在 ...
- 去掉java反编译(JD-GUI)生成的源文件中注释
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.Fi ...