一路拾遺
Collect By Finding All The Way ......
BlogJava
首頁
新隨筆
新文章
聯系
聚合
管理
posts - 81,comments - 41,trackbacks - 0
<
2008年9月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
我的博客開張啦!歡迎大家多多來踩!
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(5)
給我留言
查看公開留言
查看私人留言
隨筆檔案
2010年9月 (1)
2010年6月 (2)
2010年5月 (5)
2009年12月 (4)
2009年11月 (3)
2009年10月 (2)
2009年8月 (2)
2009年7月 (4)
2009年6月 (5)
2009年5月 (1)
2009年4月 (2)
2008年12月 (2)
2008年11月 (1)
2008年10月 (1)
2008年9月 (4)
2008年8月 (12)
2008年7月 (30)
文章檔案
2008年12月 (1)
相冊
畢業照
搜索
積分與排名
積分 - 64466
排名 - 823
最新評論
1.?re: myeclipse開發hibernate應用程序示例[未登錄]
真的好好...
--云
2.?re: myeclipse開發hibernate應用程序示例
做得很認真,頂一個
--~!
3.?re: myeclipse開發hibernate應用程序示例[未登錄]
not bad
--1
4.?re: myeclipse開發hibernate應用程序示例
類名一定要大寫,hibernate版本要小于4才行!!!!!!
--第三方
5.?re: myeclipse開發hibernate應用程序示例
有錯誤啊
--第三方
閱讀排行榜
1.?myeclipse開發hibernate應用程序示例(15648)
2.?使用AXIS調用WSDL描述的Web服務(9683)
3.?使用AXIS調用WSDL描述的Web服務(續)(6044)
4.?基于RemoteObject方式的Java-Flex交互(USING LCDS)(2680)
5.?Java WebService注冊中心JUDDI配置方法(2198)
評論排行榜
1.?myeclipse開發hibernate應用程序示例(16)
2.?使用UDDI4J連接JUDDI(10)
3.?使用AXIS調用WSDL描述的Web服務(續)(5)
4.?使用AXIS調用WSDL描述的Web服務(3)
5.?找實習的傷心事(2)
使用AXIS調用WSDL描述的Web服務
首先說一下使用AXIS調用WSDL文件時需要的JAR包:
(1)axis 其中包括axis.jar、axis-ant.jar、commons-discovery-0.2.jar、commons-logging-1.0.4.jar、jaxrpc.jar、log4j-1.2.8.jar、log4j.properties、saaj.jar、wsdl4j-1.5.1.jar。
http://www.apache.org/dyn/closer.cgi/ws/axis/
(2)javamail mail.jar。
http://java.sun.com/products/javamail/
(3)jaf activation.jar。
http://java.sun.com/javase/technologies/desktop/javabeans/jaf/downloads/index.html
一、WSDL文件內容
該實例采用的WSDL文件是使用AXIS創建的Web服務,功能是輸入字符串,返回歡迎語句。對于遠程(其他服務器)的Web服務的調用一直不成功,原本想調用下DictionaryService.wsdl,可是運行時總是返回“ faultString: org.xml.sax.SAXException: Bad envelope tag: definitions”錯誤,實在無奈、、、Hello.jws的內容如下:
<?
xml version="1.0" encoding="UTF-8"
?>
<
wsdl:definitions
targetNamespace
="http://localhost:8080/axis/Hello.jws"
xmlns:apachesoap
="http://xml.apache.org/xml-soap"
xmlns:impl
="http://localhost:8080/axis/Hello.jws"
xmlns:intf
="http://localhost:8080/axis/Hello.jws"
xmlns:soapenc
="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl
="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap
="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd
="http://www.w3.org/2001/XMLSchema"
>
<!
-
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
--
>
<
wsdl:message
name
="helloResponse"
>
<
wsdl:part
name
="helloReturn"
type
="xsd:string"
/>
</
wsdl:message
>
<
wsdl:message
name
="helloRequest"
>
<
wsdl:part
name
="name"
type
="xsd:string"
/>
</
wsdl:message
>
<
wsdl:portType
name
="Hello"
>
<
wsdl:operation
name
="hello"
parameterOrder
="name"
>
<
wsdl:input
message
="impl:helloRequest"
name
="helloRequest"
/>
<
wsdl:output
message
="impl:helloResponse"
name
="helloResponse"
/>
</
wsdl:operation
>
</
wsdl:portType
>
<
wsdl:binding
name
="HelloSoapBinding"
type
="impl:Hello"
>
<
wsdlsoap:binding
style
="rpc"
transport
="http://schemas.xmlsoap.org/soap/http"
/>
<
wsdl:operation
name
="hello"
>
<
wsdlsoap:operation
soapAction
=""
/>
<
wsdl:input
name
="helloRequest"
>
<
wsdlsoap:body
encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
namespace
="http://DefaultNamespace"
use
="encoded"
/>
</
wsdl:input
>
<
wsdl:output
name
="helloResponse"
>
<
wsdlsoap:body
encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
namespace
="http://localhost:8080/axis/Hello.jws"
use
="encoded"
/>
</
wsdl:output
>
</
wsdl:operation
>
</
wsdl:binding
>
<
wsdl:service
name
="HelloService"
>
<
wsdl:port
binding
="impl:HelloSoapBinding"
name
="Hello"
>
<
wsdlsoap:address
location
="http://localhost:8080/axis/Hello.jws"
/>
</
wsdl:port
>
</
wsdl:service
>
</
wsdl:definitions
>
二、調用Web服務
據說有三種方法,參見:
http://blog.csdn.net/boy_wh520/archive/2007/05/09/1601756.aspx
http://www.ibm.com/developerworks/cn/webservices/ws-startaxis/index.html
這里只介紹一下第一種方法,代碼如下:
package
wsdl;
import
org.apache.axis.client.Call;
import
org.apache.axis.client.Service;
public
class
CallService
{
public
static
void
main(String[] args)
{
try
{
String endpoint
=
"
http://localhost:8080/axis/Hello.jws
"
;
//
調用過程
Service service
=
new
Service();
Call call
=
(Call) service.createCall();
call.setTargetEndpointAddress(
new
java.net.URL(endpoint));
call.setOperationName(
"
hello
"
);
//
WSDL里面描述的操作名稱
call.addParameter(
"
helloRequest
"
, org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
//
操作的參數
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
//
設置返回類型
call.setUseSOAPAction(
true
);
//
給方法傳遞參數,并且調用方法
String temp
=
"
Tom
"
;
Object[] obj
=
new
Object[]
{temp}
;
String result
=
(String)call.invoke(obj);
System.out.println(
"
Result is :
"
+
result);
}
catch
(Exception e)
{
e.printStackTrace();
}
}
}
posted on 2008-08-04 21:48
胖胖泡泡
閱讀(9683)
評論(3)
編輯
收藏
FeedBack:
#
re: 使用AXIS調用WSDL描述的Web服務[未登錄]
2008-09-07 22:15 |
dong
你這個問題解決了沒?我也遇到了,不知道改如何做,如果解決了發心信息到我郵箱吧,hsd6181000@163.com
回復
更多評論
#
re: 使用AXIS調用WSDL描述的Web服務
2008-09-08 09:25 |
胖胖泡泡
問題已解決 參見 使用AXIS調用WSDL描述的Web服務(續)
http://www.tkk7.com/mrcold/archive/2008/08/05/220121.html
回復
更多評論
#
re: 使用AXIS調用WSDL描述的Web服務
2009-06-17 22:48 |
xc
@胖胖泡泡
這里是加?WSDL的目的
“?WSDL: Obtaining WSDL for deployed services
When you make a service available using Axis, there is typically a unique URL associated with that service. For JWS files, that URL is simply the path to the JWS file itself. For non-JWS services, this is usually the URL "http://<host>/axis/services/<service-name>".
If you access the service URL in a browser, you'll see a message indicating that the endpoint is an Axis service, and that you should usually access it using SOAP. However, if you tack on "?wsdl" to the end of the URL, Axis will automatically generate a service description for the deployed service, and return it as XML in your browser (try it!). The resulting description may be saved or used as input to proxy-generation, described next. You can give the WSDL-generation URL to your online partners, and they'll be able to use it to access your service with toolkits like .NET, SOAP::Lite, or any other software which supports using WSDL.
You can also generate WSDL files from existing Java classes (see Java2WSDL: Building WSDL from Java).
”
回復
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
Copyright ©2025 胖胖泡泡 Powered By
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
亚洲 欧洲 日韩 综合在线
|
久久精品国产亚洲麻豆
|
亚洲另类小说图片
|
很黄很色很刺激的视频免费
|
色在线亚洲视频www
|
在线精品免费视频
|
精品亚洲av无码一区二区柚蜜
|
成在线人永久免费视频播放
|
亚洲国产成人精品无码区在线秒播
|
曰批全过程免费视频在线观看无码
|
亚洲大成色www永久网站
|
久久国产精品免费专区
|
久久亚洲精品成人AV
|
亚洲w码欧洲s码免费
|
欧洲 亚洲 国产图片综合
|
伊人久久亚洲综合影院
|
一级毛片aaaaaa视频免费看
|
国产亚洲一区二区在线观看
|
91精品视频在线免费观看
|
亚洲区日韩精品中文字幕
|
亚洲AV网站在线观看
|
91福利免费网站在线观看
|
亚洲视频在线观看网址
|
成人五级毛片免费播放
|
成年大片免费视频播放一级
|
亚洲成AV人片在线观看无
|
在线观看免费人成视频色9
|
羞羞视频在线免费观看
|
久久青草亚洲AV无码麻豆
|
久久国内免费视频
|
一级毛片免费播放试看60分钟
|
亚洲bt加勒比一区二区
|
国产一卡2卡3卡4卡2021免费观看
|
精品久久久久亚洲
|
亚洲高清国产拍精品26U
|
好吊妞998视频免费观看在线
|
成人精品视频99在线观看免费
|
久久久亚洲AV波多野结衣
|
免费国产a国产片高清网站
|
久久国产乱子精品免费女
|
亚洲欧美乱色情图片
|