- 浏览: 231413 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (101)
- Practice (17)
- Model (15)
- Prototype (2)
- Integration (6)
- GWT (3)
- Android (16)
- Lab (6)
- Ubuntu (4)
- Data Structure(D,S) (1)
- 社会观察员 (1)
- python (14)
- redis (0)
- mysql (9)
- php (0)
- Data Structure(D (1)
- haproxy (2)
- Shell (5)
- Zabbix (1)
- CentOS (1)
- sqlplus (1)
- rlwrap (1)
- Oracle (2)
- schema (2)
- user (1)
- accredit (1)
- Delphi (2)
- nagios (1)
- nginx (0)
最新评论
-
白云飞:
兄弟能不能发一份完整的源码到我邮箱?luochengwei20 ...
【Python真的很强大】程序Log实时监控 -
myreligion:
nice job!
解决一个棘手的bug: java.lang.NoClassDefFoundError: android.os.AsyncTask -
yw9002:
你这个貌似提交的时候整个页面都会刷新。
AjaxAnyWhere+Struts的一个应用(demo/feature crew) -
fkpwolf:
这总结偏向于细节了,流水账
Android app项目和开发总结 -
crazybull:
期待详细总结~~~
Android app项目和开发总结
web services是用delphi写的,接口如下:
调用web services的代码:
再看看wsdl:
注意:
它标识了命名空间下的函数名,输入参数,输出参数.
注意
它标识了soap调用的地址.
下面附注源码(包含必须的xerces.jar,activation.jar,soap.jar,mail.jar).
interface uses InvokeRegistry, Types, XSBuiltIns; type { Invokable interfaces must derive from IInvokable } IQQService = interface(IInvokable) ['{9604D694-3FFF-4D64-9041-0EE9BE9C166C}'] { Methods of Invokable interface must not use the default } { calling convention; stdcall is recommended } function ListAccount(var QQList : Olevariant):boolean; stdcall;//列出可供申请的QQ号码 function RequestQQ():String;stdcall; //随机产生一个QQ号码 function GetQQPassword(QQ:String):String;stdcall; //取得相应QQ号码的密码 end; implementation initialization { Invokable interfaces must be registered } InvRegistry.RegisterInterface(TypeInfo(IQQService)); end.
调用web services的代码:
package sunflowerbbs.oicp.net; import java.net.URL; import java.util.Vector; import org.apache.soap.Constants; import org.apache.soap.Fault; import org.apache.soap.rpc.Call; import org.apache.soap.rpc.Parameter; import org.apache.soap.rpc.Response; public class Soap { final static String SOAPURL = "http://sunflowerbbs.oicp.net:9015/UniversalService/QQService.dll/soap/IQQService"; public String doSOAPRequest(String _strURI, String _strMethodName, String _strName, String _strValue) throws Exception { // 创建一个远程调用 Call call = new Call(); // 设置远程对象的URI call.setTargetObjectURI("urn:" + _strURI); // 设置调用的方法名 call.setMethodName(_strMethodName); // 设置编码风格 call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); // 设置方法调用的参数 if (_strName != null) { Vector params = new Vector(); params.addElement(new Parameter(_strName, String.class, _strValue, null)); call.setParams(params); } // 发送RPC请求 Response resp = call.invoke(new URL(SOAPURL), ""); if (resp.generatedFault()) { // 远程调用出错处理 Fault fault = resp.getFault(); System.out.println("调用失败!"); System.out.println("错误代号:" + fault.getFaultCode()); System.out.println("错误信息:" + fault.getFaultString()); return "调用失败!"; } else { // 调用成功,获取返回值 Parameter result = resp.getReturnValue(); return result.getValue().toString(); } } public static void main(String[] args) { System.out.println("SOAP调用测试开始。。。"); try { Soap mysoap = new Soap(); // 调用远程的SOAP服务 String qq = mysoap.doSOAPRequest("QQServiceIntf-IQQService", "RequestQQ", null, null); String password = mysoap.doSOAPRequest("QQServiceIntf-IQQService", "GetQQPassword", "QQ", qq); System.out .println(String.format("QQ=%s,Password=%s", qq, password)); } catch (Exception e) { System.out.println("调用Soap异常!"); e.printStackTrace(); } System.out.println("SOAP调用测试结束。。。"); } }
再看看wsdl:
<?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="IQQServiceservice" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"> <message name="ListAccount0Request"> <part name="QQList" type="xs:anyType"/> </message> <message name="ListAccount0Response"> <part name="QQList" type="xs:anyType"/> <part name="return" type="xs:boolean"/> </message> <message name="RequestQQ1Request"/> <message name="RequestQQ1Response"> <part name="return" type="xs:string"/> </message> <message name="GetQQPassword2Request"> <part name="QQ" type="xs:string"/> </message> <message name="GetQQPassword2Response"> <part name="return" type="xs:string"/> </message> <portType name="IQQService"> <operation name="ListAccount"> <input message="tns:ListAccount0Request"/> <output message="tns:ListAccount0Response"/> </operation> <operation name="RequestQQ"> <input message="tns:RequestQQ1Request"/> <output message="tns:RequestQQ1Response"/> </operation> <operation name="GetQQPassword"> <input message="tns:GetQQPassword2Request"/> <output message="tns:GetQQPassword2Response"/> </operation> </portType> <binding name="IQQServicebinding" type="tns:IQQService"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="ListAccount"> <soap:operation soapAction="urn:QQServiceIntf-IQQService#ListAccount" style="rpc"/> <input message="tns:ListAccount0Request"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </input> <output message="tns:ListAccount0Response"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </output> </operation> <operation name="RequestQQ"> <soap:operation soapAction="urn:QQServiceIntf-IQQService#RequestQQ" style="rpc"/> <input message="tns:RequestQQ1Request"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </input> <output message="tns:RequestQQ1Response"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </output> </operation> <operation name="GetQQPassword"> <soap:operation soapAction="urn:QQServiceIntf-IQQService#GetQQPassword" style="rpc"/> <input message="tns:GetQQPassword2Request"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </input> <output message="tns:GetQQPassword2Response"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </output> </operation> </binding> <service name="IQQServiceservice"> <port name="IQQServicePort" binding="tns:IQQServicebinding"> <soap:address location="http://sunflowerbbs.oicp.net:9015/UniversalService/QQService.dll/soap/IQQService"/> </port> </service> </definitions>
注意:
<operation name="GetQQPassword"> <soap:operation soapAction="urn:QQServiceIntf-IQQService#GetQQPassword" style="rpc"/> <input message="tns:GetQQPassword2Request"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </input> <output message="tns:GetQQPassword2Response"> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:QQServiceIntf-IQQService"/> </output> </operation>
它标识了命名空间下的函数名,输入参数,输出参数.
注意
<soap:address location="http://sunflowerbbs.oicp.net:9015/UniversalService/QQService.dll/soap/IQQService"/>
它标识了soap调用的地址.
下面附注源码(包含必须的xerces.jar,activation.jar,soap.jar,mail.jar).
- call-webservices.zip (1.2 MB)
- 下载次数: 33
发表评论
-
MySQL的XML接口-数据解析
2016-01-21 21:46 1094MySQL从5.1.5开 ... -
xml + xslt => html => pdf
2014-03-05 18:02 1767继上一篇:使用java将xml格式化,本blog主 ... -
【Python真的很强大】md5sum in Python
2014-01-17 13:17 2262''' md5sum in Python ... -
使用java将xml格式化
2013-12-25 18:04 2080将生成的xml用ie浏览器打开,就可以见到漂亮的缩进的xm ... -
【Python真的很强大】程序Log实时监控
2013-12-10 16:45 7321需求构思: 在linux下常常需要查看程序的实时输出,我 ... -
【Python真的很强大】开发简易在线搜索
2013-11-25 23:54 1764需求如下:开发一个简易的搜索引擎(即提供查询关键字的服 ... -
haproxy使用总结
2012-10-17 17:19 1273DESCRIPTION HAProxy i ... -
集合数据比较
2012-07-31 12:17 1100数据比较的原型模型是两集合的操作(求交集,并集,补集),如下 ... -
利用事件冒泡(Event Bubbling )获取鼠标下的元素属性
2010-03-17 16:21 2028<html> <head> ... -
Generic Classes & Reflect
2010-02-26 10:05 1101abstract class TestGeneric1 < ... -
在数据库中用正则表达式查询数据
2009-12-30 21:20 1855Mysql5.0及以后直接支持. select * fro ... -
AjaxAnyWhere+Struts的一个应用(demo/feature crew)
2009-12-28 21:05 2775AjaxAnywhere介绍: Aja ... -
构建自己的Properties
2009-10-08 10:12 4621开发到了一定时间,就会有很多的定式思维阻碍我们。 比如问到XM ... -
gwt Client-Server 交互原形模型
2007-10-16 13:17 2433gwt Client-Server 交互原形模型 ...
相关推荐
一个完整的Asp.net利用Ajax ScriptManager调用webservice的例子。 本例子在vs2008+C#环境中正常运行的例子。
VBAS 使用 SoapToolkit 调用 WebService 参考文档、软体实例。、
C# 调用web services 的几个范例,也只是XML格式文件。主要可以配置web services 地址,可赋值。
C#动态调用webservice服务 先初始化类 WebServiceCall.WebServiceCall webservicecall1 = new WebServiceCall.WebServiceCall(); 然后调用方法 WebService()
C++ Builder 6.0 调用WebService的例子。
FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#. FB4 call WEBSERVICE,base on SOAP protocol.. the webservice writed with C#. FB4 call WEBSERVICE,base on SOAP protocol.. the ...
call webservice by C
java代码-使用java解决webservice接口call调用方式的源代码 ——学习参考资料:仅用于个人学习使用!
webservice-client-call axis
Synchronous Javascript call using Scriptable XML webservice (SJAX)。 http://www.linjon.cn, 成都领君科技有限公司
图解如何从SAP系统中调用我部WebService
webservice to call payroll calculation
Java调用php的webservice: header("Content-Type:text/html;charset=UTF-8"); // require('lib/nusoap.php'); require_once("lib/nusoap.php"); $server = new soap_server(); $server->configureWSDL('...
用来动态调用web service
里面包含用到的axis的jar包 和一个java文件,下载后,将文件放在工程下,添加jar包即可运行,用的开源的webservice服务,里面重要代码都做了注释。
动态调用webservice所需jar包,实现的代码如下 ,String result = ""; try { Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(ws_url); //远程...
该webservice有几个模块,执行api,查询api等,可实现client端 sql 去调用,也可以直接call database procedure 及function 只需要在config文件修改数据库信息及可使用,要调用demo的给我留言
java通过webservice调用asmx的实例。
XML-Remote Procedure Call)目前已经被JAX-WS规范取代,JAX-WS 是JAX-RPC 的演进 版本,但 JAX-WS 并不完全向后兼容 JAX-RPC,二者最大的区别就是 RPC/encoded 样式的 WSDL,JAX-WS 已经不提供这种支持。JAX-RPC 的...