您的位置:首页 > 编程语言 > PHP开发

JAVA调用PHP SOAP服务的示例

2014-11-27 21:47 302 查看
Image you had a php service that would connect to a mysql database and return query results via soap.

That php service (SOAP server) could look like that:

To make this example work you would need to create a database called userdb with an usertable. This would be the sql to create the table and put in some data:

After everything is created you would like to call the function get_names via a java program:

This java code makes a soap call to the php soap server and puts the returned database result into a List of Hashmaps with the database entries. The example output of the java program looks like that:

(3/0)added id = 1

(3/1)added name = alexander

(3/2)added email = a.balsam@nedeco.de

(3/0)added id = 2

(3/1)added name = alexander

(3/2)added email = alexander@balsam.de
If you have any input on this leave a comment or write some additional code and send it to me.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: