JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Application Framework » Spring  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Re:Spring Remote Services part2 Web services using SOAP [Re:uxa]
uxa





發文: 489
積分: 6
於 2007-12-17 15:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
介紹過Spring + XFire來部署Web Service,接下來就是Client端的應用囉

其實非常的簡單,首先看到Spring的設定
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
 
  <bean id="citationService"
    class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
    <property name="wsdlDocumentUrl"
      value="http://localhost:8080/SpringInAction/ws/citation?wsdl">
    </property>
    <property name="serviceInterface"
      value="com.springinaction.chapter08.CitationService">
    </property>
  </bean>
 
</beans>


給定WSDL的位置以及interface就能夠存取到這個Web Service了,非常的簡單
再來測試一下存取這個Web Service吧
1
2
3
    ApplicationContext ctx = new ClassPathXmlApplicationContext("com/springinaction/chapter08/springWebServiceClientXFire.xml");
    CitationService service = (CitationService)ctx.getBean("citationService");
    System.out.println(service.getCitation());


由於部署的Web Service只是簡單的回傳字串,所以這裡小弟只是將其打印出來。
以上就是Spring + XFire的應用啦,希望對各位會有些幫助^^


reply to postreply to post
☆只要努力就有希望☆
話題樹型展開
人氣 標題 作者 字數 發文時間
4375 Spring Remote Services part2 Web services using SOAP uxa 2403 2007-12-14 14:13
4032 Re:Spring Remote Services part2 Web services using SOAP uxa 1024 2007-12-17 15:24
2224 Re:Spring Remote Services part2 Web services using SOAP chih0812 284 2009-06-16 15:38
2431 Re:Spring Remote Services part2 Web services using SOAP chih0812 1424 2009-06-16 17:59
» JWorld@TW »  Java Application Framework » Spring

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8