可能最簡單的 soap 哦!
服務器為 java tomcat
下載服務器:http://www.apache.org/dist/ws/
axis/ 為java
axis-c/ 為 c
1.我這下載的 axis 1_4 版本 ,解壓 /webapps/axis 放到 tomcat 的webapps
啟動tomcat(這就不修改任何,如有需要 該 web.xml 等配置了) 參考 >>
blog 主 還有很多介紹 axis 大家可以 看看 日志 > 其下的 "學習"
直接寫個文件 HelloWorld.jws 放到 %TOMCAT_HOME%"webapps"axis
public class HelloWorld {
public String sayHello() {
return "HELLO soap!";
}
}
public String sayHello() {
return "HELLO soap!";
}
}
等不及 可以使用 看看
http://127.0.0.1:8080/axis/HelloWorld.jws?method=sayHello
結果 :
<soapenv:Envelope>
<soapenv:Body>
<sayHelloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sayHelloReturn xsi:type="xsd:string">HELLO soap!</sayHelloReturn>
</sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>
<soapenv:Body>
<sayHelloResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<sayHelloReturn xsi:type="xsd:string">HELLO soap!</sayHelloReturn>
</sayHelloResponse>
</soapenv:Body>
</soapenv:Envelope>
客戶段
perl cpan >> install SOAP::Lite
#!perl -w
use SOAP::Lite;
print SOAP::Lite
-> proxy('http://127.0.0.1:8080/axis/HelloWorld.jws')
-> uri('http://127.0.0.1:8080/axis/HelloWorld.jws')
-> sayHello()
-> result;
結果: HELLO soap!use SOAP::Lite;
print SOAP::Lite
-> proxy('http://127.0.0.1:8080/axis/HelloWorld.jws')
-> uri('http://127.0.0.1:8080/axis/HelloWorld.jws')
-> sayHello()
-> result;
整理 www.aygfsteel.com/Good-Game