Chinaunix首页 | 论坛 | 博客
  • 博客访问: 470626
  • 博文数量: 66
  • 博客积分: 2125
  • 博客等级: 大尉
  • 技术积分: 704
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-08 13:42
个人简介

空气中的尘埃

文章分类

全部博文(66)

文章存档

2019年(1)

2017年(4)

2016年(2)

2015年(4)

2014年(4)

2013年(2)

2012年(5)

2011年(6)

2010年(9)

2009年(8)

2008年(12)

2007年(6)

2006年(2)

2005年(1)

我的朋友

分类:

2010-08-13 12:11:46

Visual studio 2008,delphi7 调用resin 下的 axis 的webservice 的方法
1、建立axis 的服务。
 下载axis 1.4
 解压后webapp 下的axis 拷贝到resin 的webapps\ 下。
 axis 下新建文件 TestS.jws 内容为

 

public class TestS{
  private String name;
  public String hello(String word){
    return word+" Hello, axis Ver1.4 talking to you.";
  }
}

 
 启动resin 临听端口8089
 在浏览器中输入
 得到
 

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="" xmlns:apachesoap="" xmlns:impl="" xmlns:intf="" xmlns:soapenc="" xmlns:wsdl="" xmlns:wsdlsoap="soap/" xmlns:xsd="">
- <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
  -->
- <wsdl:message name="helloRequest">
  <wsdl:part name="word" type="xsd:string" />
  </wsdl:message>
- <wsdl:message name="helloResponse">
  <wsdl:part name="helloReturn" type="xsd:string" />
  </wsdl:message>
- <wsdl:portType name="TestS">
- <wsdl:operation name="hello" parameterOrder="word">
  <wsdl:input message="impl:helloRequest" name="helloRequest" />
  <wsdl:output message="impl:helloResponse" name="helloResponse" />
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="TestSSoapBinding" type="impl:TestS">
  <wsdlsoap:binding style="rpc" transport="" />
- <wsdl:operation name="hello">
  <wsdlsoap:operation soapAction="" />
- <wsdl:input name="helloRequest">
  <wsdlsoap:body encodingStyle="" namespace="" use="encoded" />
  </wsdl:input>
- <wsdl:output name="helloResponse">
  <wsdlsoap:body encodingStyle="" namespace="" use="encoded" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="TestSService">
- <wsdl:port binding="impl:TestSSoapBinding" name="TestS">
  <wsdlsoap:address location="" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

 
 在浏览器中输入
 得到

<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="-instance">
- <soapenv:Body>
- <helloResponse soapenv:encodingStyle="">
  <helloReturn xsi:type="xsd:string">tome Hello, axis Ver1.4 talking to you.</helloReturn>
  </helloResponse>
  </soapenv:Body>
  </soapenv:Envelope>



visual studio 2008 调用
1、新建一个C# 窗体应用
  添加webrefrence .
 
  添加一个按钮,两个textBox, 按钮事件中写
   

private void button1_Click(object sender, EventArgs e)
        {
            WebReference.SayHelloService sh = new WebReference.SayHelloService();
            string str = sh.hello(this.textBox1.Text);
            this.textBox2.Text = str;
        }



delphi7 调用
1、新建工程
 2、文件->新建->其它->Webservice->WSDL Importer
 Location of WSDL or URL
 
 完成生成TestS1.pas
 Unit1 中uses 加上TestS1
 默认窗体中添加
 一按钮
 事件为

procedure TForm1.Button1Click(Sender: TObject);
var
say :SayHello;
begin
say := GetSayHello();
showmessage(say.hello('律师'));
end;


阅读(1783) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~