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;
|
阅读(1819) | 评论(0) | 转发(0) |