起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 358|回复: 10

[请求]X3调用WEB SERVICE 问题,特急!!!!**

[复制链接]
发表于 2008-12-30 00:34:02 | 显示全部楼层 |阅读模式
我想在X3里面调用 用JAVA写的 WEB SERVICE 服务程序,管理员提供了以下的方法,我不知道以下的这段客户端实现程序是在X3导入地址生成的的还是在DELPHI导入地址生成的
WebService文件
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
     Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
        Return "Hello World"
    End Function

End Class

生成的接口文件
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL     : http://localhost:3518/WebSite1/Service.asmx?WSDL
// Encoding : utf-8
// Version  : 1.0
// (2006-8-2 9:38:19 - $Revision:   1.9.1.0.1.0.1.9  $)
// ************************************************************************ //

unit MyService;

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://tempuri.org/
  // soapAction: http://tempuri.org/HelloWorld
  // transport : http://schemas.xmlsoap.org/soap/http
  // binding   : ServiceSoap
  // service   : Service
  // port      : ServiceSoap
  // URL       : http://localhost:3518/WebSite1/Service.asmx
  // ************************************************************************ //
  ServiceSoap = interface(IInvokable)
  ['{77573149-9C57-FA51-F11F-EFD527C91BD9}']
    function  HelloWorld: String; stdcall;
  end;

function GetServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''): ServiceSoap;


implementation
  uses SOAPHTTPClient;

function GetServiceSoap(UseWSDL: Boolean; Addr: string): ServiceSoap;
const
  defWSDL = 'http://localhost:3518/WebSite1/Service.asmx?WSDL';
  defURL  = 'http://localhost:3518/WebSite1/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;
  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 ServiceSoap);
  finally
    if Result = nil then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(ServiceSoap), 'http://tempuri.org/', 'utf-8');
  InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceSoap), 'http://tempuri.org/HelloWorld');

end.

平台上调用方法:
var
  s: ServiceSoap;
begin
{  s := JustepExt.MyService.GetServiceSoap(False, 'http://localhost:3518/WebSite1/Service.asmx');
  Dialogs.ShowMessage(s.HelloWorld);
  s := nil;
回复

使用道具 举报

发表于 2008-12-30 09:03:43 | 显示全部楼层
delphi
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-30 12:47:54 | 显示全部楼层
那这个客户端在DELPHI生成后,在X3怎么导入啊,因为我要在X3实现以下的平台上调用方法:
var
  s: ServiceSoap;
begin
  s := JustepExt.MyService.GetServiceSoap(False, 'http://localhost:3518/WebSite1/Service.asmx');
  Dialogs.ShowMessage(s.HelloWorld);
  s := nil;
回复 支持 反对

使用道具 举报

发表于 2008-12-30 13:19:43 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-30 14:00:06 | 显示全部楼层
还有个问题,就是DELPHI的第三方导入工具,如何导入DELPHI的PAS
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-30 14:03:23 | 显示全部楼层
还有个问题,就是X3的第三方导入工具,如何导入DELPHI的PAS
回复 支持 反对

使用道具 举报

发表于 2008-12-30 14:06:59 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-30 17:28:31 | 显示全部楼层
我DELPHI客户端生成的只有一份.PAS文件,好像不能按照 http://bbs.justep.com/forum.php?mod=viewthread&tid=20086
指示的方法导入啊
回复 支持 反对

使用道具 举报

发表于 2008-12-30 17:29:33 | 显示全部楼层
注意事项写了:如果是已经有了.pas文件,可以跳过第一步,直接从第二步生成配置文件开始了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-12-30 17:49:52 | 显示全部楼层
这我知道,.PAS是不是我客户端生成的接口文件的那个.PAS,但我用X3的导入工具IMPIDE.EXE生成不了一个新IRP文件,奇怪
回复 支持 反对

使用道具 举报

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

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-28 19:58 , Processed in 0.037562 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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