起步软件技术论坛-X3

 找回密码
 立即注册
搜索
123
返回列表 发新帖
楼主: zykj

[请求]急,X3如何调用别人的 webservice**

[复制链接]
 楼主| 发表于 2009-5-27 14:52:54 | 显示全部楼层
现在已经封好了 可是会报错 不知是什么原因?
在计算表达式的时候产生异常,类型:“ESOAPDomConvertError”,内容:
DocumentElement http://schemas.xmlsoap.org/soap/envelope/:Envelope expected, http://schemas.xmlsoap.org/wsdl/:definitions found。


=================
procedure TMainForm.Button1Click(Sender: TObject);
var
  s: SpeedtestPortType;
begin
     //SpeedtestPortType  JustepExt.OMS.
s := Speedtest.GetSpeedtestPortType(False,'http://10.143.47.8:8081/erpspeedtest/services/Speedtest?wsdl');
  Dialogs.ShowMessage(s.Speedtest);
  s := nil;
end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-5-27 14:57:58 | 显示全部楼层
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://10.143.47.8:8081/erpspeedtest/services/Speedtest?wsdl
// Encoding : UTF-8
// Version  : 1.0
// (2009-5-26 16:45:23 - $Revision:   1.9.1.0.1.0.1.9  $)
// ************************************************************************ //

unit Speedtest;

interface

uses InvokeRegistry, 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://erp/Speedtest
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : SpeedtestHttpBinding
  // service   : Speedtest
  // port      : SpeedtestHttpPort
  // URL       : http://10.143.47.8:8081/erpspeedtest/services/Speedtest
  // ************************************************************************ //
  SpeedtestPortType = interface(IInvokable)
  ['{489F3809-0801-5C4D-1B31-4FA82DE9D890}']
    function  Speedtest: String; stdcall;
  end;

function GetSpeedtestPortType(UseWSDL: Boolean; Addr: string): SpeedtestPortType;


implementation
  uses SOAPHTTPClient;

function GetSpeedtestPortType(UseWSDL: Boolean; Addr: string): SpeedtestPortType;
const
  defWSDL = 'http://10.143.47.8:8081/erpspeedtest/services/Speedtest?wsdl';
  defURL  = 'http://10.143.47.8:8081/erpspeedtest/services/Speedtest';
  defSvc  = 'Speedtest';
  defPrt  = 'SpeedtestHttpPort';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  RIO := THTTPRIO.Create(nil);
  try
     if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
    Result := (RIO as SpeedtestPortType);
  finally
    if Result = nil then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(SpeedtestPortType), 'http://erp/Speedtest', 'UTF-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SpeedtestPortType), '');
  InvRegistry.RegisterInvokeOptions(TypeInfo(SpeedtestPortType), ioDocument);

end.
回复 支持 反对

使用道具 举报

发表于 2009-5-27 15:03:14 | 显示全部楼层
你先 用delphi调试下,用楼上的单元调用成功。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-5-27 15:28:10 | 显示全部楼层
能不能给个试过 能用的 dll与bpl给我 试下
回复 支持 反对

使用道具 举报

发表于 2009-5-27 15:37:47 | 显示全部楼层
http://bbs.justep.com/forum.php?mod=viewthread&tid=5317
这个可能bpl不能用,只要重新按照步骤制作一次bpl就行了。
回复 支持 反对

使用道具 举报

发表于 2009-5-27 16:28:47 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-20 14:29 , Processed in 0.040465 second(s), 14 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表