大家好,首先本人对web service不太了解,现在做一个项目,其中要做一个员工资料的同步程序。
对方是一个ORACLE数据库的HR系统,我这边的程序需要调用它的人员资料,但是它HR系统不允许我直接访问ORACLE数据库里的表数据,只是一个WEBSERVICE接口给到我,我想问一下,这个所谓的接口是一个什么样的东西,是一系列的函数说明吗?我用DELPHI能直接调用它提供的WEBSERVICE接口吗?
对方是一个ORACLE数据库的HR系统,我这边的程序需要调用它的人员资料,但是它HR系统不允许我直接访问ORACLE数据库里的表数据,只是一个WEBSERVICE接口给到我,我想问一下,这个所谓的接口是一个什么样的东西,是一系列的函数说明吗?我用DELPHI能直接调用它提供的WEBSERVICE接口吗?
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://172.20.100.10/test/service.asmx?wsdl
// >Import : http://172.20.100.10/test/service.asmx?wsdl:0
// Encoding : utf-8
// Version : 1.0
// (2010/6/22 上午 11:31:35 - - $Rev: 10138 $)
// ************************************************************************ //unit service;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;const
IS_OPTN = $0001;
IS_REF = $0080;
type // ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl] // ************************************************************************ //
// Namespace : Kye
// soapAction: Kye/HelloWorld
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : ServiceSoap
// service : Service
// port : ServiceSoap
// URL : http://172.20.100.10/test/service.asmx
// ************************************************************************ //
ServiceSoap = interface(IInvokable)
['{B82FAFBA-EAB8-AD5C-2535-FB6046355616}']
function HelloWorld(const name_: WideString): WideString; stdcall;
end;function GetServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ServiceSoap;
implementation
uses SysUtils;function GetServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ServiceSoap;
const
defWSDL = 'http://172.20.100.10/test/service.asmx?wsdl';
defURL = 'http://172.20.100.10/test/service.asmx';
defSvc = 'Service';
defPrt = 'ServiceSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as ServiceSoap);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(ServiceSoap), 'Kye', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceSoap), 'Kye/HelloWorld');
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap), ioDocument);
InvRegistry.RegisterExternalParamName(TypeInfo(ServiceSoap), 'HelloWorld', 'name_', 'name');end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,service, StdCtrls;type
TForm1 = class(TForm)
btn1: TButton;
edt1: TEdit;
Label1: TLabel;
procedure btn1Click(Sender: TObject);
private
aa:ServiceSoap;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);
begin
aa:=GetServiceSoap(False,'',nil);
ShowMessage(aa.HelloWorld(edt1.Text));
end;end.
vEmpInfoService com.hrsoft.tlbase.ws.api.employee.EmpInfoService
.................................这个是JAVA的描述方式,如果要转换成DELPHI的格式应该是怎样的呢?
接口类: com.hrsoft.tlbase.ws.api.employee.EmpInfoService
.................................这个是JAVA的描述方式,如果要转换成DELPHI的格式应该是怎样的呢?
这个路径里的部分内容是:<wsdl:definitions xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://employee.api.webservices.talentbase.neusoft.com/xsd" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://employee.services.webservices.talentbase.neusoft.com/xsd" xmlns:axis2="http://employee.services.webservices.talentbase.neusoft.com" targetNamespace="http://employee.services.webservices.talentbase.neusoft.com">
<wsdl:documentation>employee info</wsdl:documentation>
- <wsdl:types>
- <xs:schema xmlns:ax21="http://employee.api.webservices.talentbase.neusoft.com/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://employee.api.webservices.talentbase.neusoft.com/xsd">
<xs:element name="EmpInfo" type="ns0:EmpInfo" />
- <xs:complexType name="EmpInfo">
- <xs:sequence>
<xs:element name="age" nillable="true" type="xs:string" />
<xs:element name="beginWorkDate" nillable="true" type="xs:string" />
<xs:element name="birthPlace" nillable="true" type="xs:string" />
<xs:element name="birthday" nillable="true" type="xs:string" />
<xs:element name="cardType" nillable="true" type="xs:string" />
<xs:element name="code" nillable="true" type="xs:string" />
<xs:element name="contactPeople" nillable="true" type="xs:string" />
<xs:element name="contractBody" nillable="true" type="xs:string" />
<xs:element name="degree" nillable="true" type="xs:string" />
<xs:element name="dispatch" nillable="true" type="xs:string" />
<xs:element name="email" nillable="true" type="xs:string" />
<xs:element name="employeeStatus" nillable="true" type="xs:string" />
<xs:element name="employeeType" nillable="true" type="xs:string" />
<xs:element name="enddate" nillable="true" type="xs:string" />
<xs:element name="englishLevel" nillable="true" type="xs:string" />
<xs:element name="entryType" nillable="true" type="xs:string" />
<xs:element name="firstName" nillable="true" type="xs:string" />
<xs:element name="gender" nillable="true" type="xs:string" />
<xs:element name="hireDate" nillable="true" type="xs:string" />
<xs:element name="idCardAddress" nillable="true" type="xs:string" />
<xs:element name="idcard" nillable="true" type="xs:string" />
<xs:element name="ifSensitive" nillable="true" type="xs:string" />
<xs:element name="jobClass" type="xs:long" />
<xs:element name="jobCode" nillable="true" type="xs:string" />
<xs:element name="jobGradeType" nillable="true" type="xs:string" />
<xs:element name="jobID" type="xs:long" />
<xs:element name="jobIndex" nillable="true" type="xs:string" />
<xs:element name="jobLevel" nillable="true" type="xs:string" />
<xs:element name="jobName" nillable="true" type="xs:string" />
<xs:element name="jobSeniority" type="xs:long" />
<xs:element name="joinJobDate" nillable="true" type="xs:string" />
<xs:element name="joinUnitDate" nillable="true" type="xs:string" />
<xs:element name="keyUser" nillable="true" type="xs:string" />
<xs:element name="knowledge" nillable="true" type="xs:string" />
<xs:element name="lastName" nillable="true" type="xs:string" />
<xs:element name="marital" nillable="true" type="xs:string" />
<xs:element name="middleName" nillable="true" type="xs:string" />
<xs:element name="name" nillable="true" type="xs:string" />
<xs:element name="nation" nillable="true" type="xs:string" />
<xs:element name="nationality" nillable="true" type="xs:string" />
<xs:element name="nativePlace" nillable="true" type="xs:string" />
<xs:element name="oid" type="xs:long" />
<xs:element name="operateTime" nillable="true" type="xs:string" />
<xs:element name="operator" type="xs:long" />
<xs:element name="orgCode" nillable="true" type="xs:string" />
<xs:element name="orgID" type="xs:long" />
<xs:element name="orgName" nillable="true" type="xs:string" />
<xs:element name="origin" nillable="true" type="xs:string" />
<xs:element name="parttime" nillable="true" type="xs:string" />
<xs:element maxOccurs="unbounded" name="parttimeInfo" nillable="true" type="ns0:ParttimeVO" />
<xs:element name="passPort" nillable="true" type="xs:string" />
<xs:element name="polity" nillable="true" type="xs:string" />
<xs:element name="positionType" nillable="true" type="xs:string" />
<xs:element name="pracetice" nillable="true" type="xs:string" />
<xs:element name="regresidence" nillable="true" type="xs:string" />
<xs:element name="re" nillable="true" type="xs:string" />
<xs:element name="sourceType" nillable="true" type="xs:string" />
<xs:element name="specialty" nillable="true" type="xs:string" />
<xs:element name="status" nillable="true" type="xs:string" />
<xs:element name="systemID" type="xs:long" />
<xs:element name="tele" nillable="true" type="xs:string" />
<xs:element name="transfer" nillable="true" type="xs:string" />
<xs:element name="unitCode" nillable="true" type="xs:string" />
<xs:element name="unitID" type="xs:long" />
<xs:element name="unitName" nillable="true" type="xs:string" />
<xs:element name="usedName" nillable="true" type="xs:string" />
<xs:element name="weave" nillable="true" type="xs:string" />
<xs:element name="workSeniority" nillable="true" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ParttimeVO" type="ns0:ParttimeVO" /> 然后我通过DELPHI的webservice的WSDL importer 导入这个路径的内容,发现生成的单元里面的内容如下:// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://ehr.xxx.com.cn/xxx/services/EmpService?wsdl
// (2010/08/02 15:20:38 - 1.33.2.5)
// ************************************************************************ //unit EmpService;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;type // ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
implementationinitializationend. 没有任何的函数定义,和以前使用飞信的接口不一样的,请问大家这种webservice格式要如何与delphi关联起来呢?
file->New->webservice->WSDL Import Wizard對話框(WSDL Source)選擇或輸入你的webservice地址即可產生delphi對應的pas文件,再向我之前寫的demo調用即可
=================================
CBX框架是一套健壮、简单易用的Delphi三层框架,完全以Midas为基础進行开发,非常适合开发大型企业应用。CBX是一个完备的体现RIA思想的应用开发框架,它充分的具备了这三大要素,包含:浏览器ao运行容器插件;宿主在IIS的应用服务器兼部署服务器;以Delphi 7为基础扩展而来的强大开发环境。 CBX的价值在于:能够将Delphi7开发桌面应用的强大能力搬上了浏览器,远远超越基于Html乃至Ajax技术的Web开发技术的能力范畴,它意味着:几乎所有的VCL控件都能直接用使用在Web客户端中;几乎所有的Windows API都可以在客户端调用;客户端代码执行效率达到了C++的级别; 能使用客户端电脑的所有硬件资源。
具备一个简约而高效强大的服务器容器环境,能够用Delphi Midas的开发模式开发高效率的、能够穿透防火墙、在互联网上运行的应用服务器,天然集成无状态中间层业务对象的机制,系统层次简捷健壮,充分体现了三层构架的高性能,将三层构架系统的特性发挥到了极致;
CBX具备高度开放的访问接口,天然面向和各种Web系统交互和集成,诸如:JSP、ASP、ASP.Net、PHP乃至静态html网页,开发者不仅可以将CBX模块自如的嵌入到纯Web系统中,而且还能通过灵活的接口和CBX对象交互,让CBX充当各种纯Web构架方案的强有力补充,弥补纯html技术能力所不能及之处。请加入500人超级CBX&Delphi群 11701114
快递查询接口 http://webservice.36wu.com/ExpressService.asmxip查询接口 http://webservice.36wu.com/ipService.asmx天气预报接口 http://webservice.36wu.com/weatherService.asmx身份证查询接口 http://webservice.36wu.com/IdCardService.asmx手机归属地接口 http://webservice.36wu.com/MobilePhoneService.asmx翻译接口 http://webservice.36wu.com/TranslationService.asmx火车时刻接口:http://webservice.36wu.com/TrainService.asmx股票查询接口:http://webservice.36wu.com/StockService.asmx 邮编接口:http://webservice.36wu.com/ZipcodeService.asmx二维码Web服务
http://webservice.36wu.com/DimensionalCodeService.asmx公交查询Web服务
http://webservice.36wu.com/mapService.asmx
ISBN查询Web服务
http://webservice.36wu.com/ISBNService.asmx
ICP备案查询Web服务 http://webservice.36wu.com/ICPServic.asmx