第一次接触使用delph7调用java接口,发布XML格式报文 ,求高手指导,最好有个例子,感谢不尽!

jcxhan 2017-03-25 06:23:50
接口测试地址
测试地址:http://223.68.184.9:8084/DAQItem/services/CallUniversalService
维修厂编号:32101594
验证用户名:antj_01
验证密码:antj_01pass2016
...全文
865 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lyhoo163 2017-04-06
  • 打赏
  • 举报
回复
jcxhan 2017-03-27
  • 打赏
  • 举报
回复
已连接成功,下面还有更多问题麻烦大家。谢谢。
jcxhan 2017-03-25
  • 打赏
  • 举报
回复
delphi 客户端自动生成了webserive的访问代码 // ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://223.68.184.9:8084/DAQItem/services/CallUniversalService?wsdl // Encoding : UTF-8 // Version : 1.0 // (2017-03-22 21:47:58 - 1.33.2.5) // ************************************************************************ // unit CallUniversalService1; interface uses 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. // ************************************************************************ // // !:string - "http://www.w3.org/2001/XMLSchema" // ************************************************************************ // // Namespace : http://service.rong // transport : http://schemas.xmlsoap.org/soap/http // style : document // binding : CallUniversalServiceSoapBinding // service : CallUniversalServiceService // port : CallUniversalService // URL : http://223.68.184.9:8084/DAQItem/services/CallUniversalService // ************************************************************************ // CallUniversalService = interface(IInvokable) ['{2D7FAF1F-C142-A89F-21C5-D321BCA855EA}'] function readStringXml(const x: WideString): WideString; stdcall; end; function GetCallUniversalService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CallUniversalService; implementation function GetCallUniversalService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): CallUniversalService; const defWSDL = 'http://223.68.184.9:8084/DAQItem/services/CallUniversalService?wsdl'; defURL = 'http://223.68.184.9:8084/DAQItem/services/CallUniversalService'; defSvc = 'CallUniversalServiceService'; defPrt = 'CallUniversalService'; 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 CallUniversalService); 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(CallUniversalService), 'http://service.rong', 'UTF-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(CallUniversalService), ''); InvRegistry.RegisterInvokeOptions(TypeInfo(CallUniversalService), ioDocument); end. java 调用接口例子: 接口调用示例: /**调接口测试 * @param args * @throws AxisFault */ public static void main(String[] args) throws AxisFault { // TODO Auto-generated method stub // 使用RPC方式调用WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // 指定调用WebService的URL (目前为测试地址) EndpointReference targetEPR = new EndpointReference("http://223.68.184.9:8084/DAQItem/services/CallUniversalService"); options.setTo(targetEPR); // 指定要调用的计算机器中的方法及WSDL文件的命名空间: QName opAddEntry = new QName("http://service.rong","readStringXml"); // 参数 String xml = "调用接口需要传输的xml参数"; Object[] opAddEntryArgs = new Object[] {xml}; // 调用plus方法并输出该方法的返回值 Class[] classesa = new Class[] {String.class }; String rest=(String) serviceClient.invokeBlocking(opAddEntry,opAddEntryArgs, classesa)[0]; try { System.out.println(URLDecoder.decode(rest.toString(), "utf-8")); } catch (UnsupportedEncodingException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } }

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧