如何解决java axis 调用webservice服务器操作异常
2个回答
展开全部
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
一、WebService在cs后台程序中的调用
A、通过<a href="https://www.baidu.com/s?wd=%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">命名空间</a>和类名直接调用
示例:
WebService ws = new WebService();
string s = ws.HelloWorld();
B、通过添加WEB引用的方式调用,首先添加WEB引用,通过URL指向WEBSERVICE,
指定WEB引用名,假设为KK;
示例:
kk.WebService n = new kk.WebService();
string ss=n.HelloWorld();
二、WebService在前台页面的JS 调用方法
1、首先通过下面的方法把Webservice在前台引用进来
2、然后就可以通过JS程序进行调用,示例如下:
function a()
{
WebService.HelloWorld(onresult);
}
//这里的onresult是<a href="https://www.baidu.com/s?wd=%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">回调函数</a>
function onresult(result)
{
alert(result);
}
function b()
{
WebService.add(1,2,onreturn)
}
function onreturn(result)
{
alert(result);
}
//下面的'context'是上下文,可以通过回到函数通过重载的方式获得;
function c()
{
WebService.div(1,1,onresultC,onerror,'context');
}
function onresultC(res,c)
{
alert(res);
alert(c);
}
//onerror是获得异常信息的<a href="https://www.baidu.com/s?wd=%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">回调函数</a>,下面给出了获得异常信息的方法
function onerror(error)
{
var a="";
a=String.format("获取<a href="https://www.baidu.com/s?wd=%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">服务器端</a>异常的具体类型:{0}\t\n获取详细的异常描述信息:{1}\t\n获取造成异常的:{2}\t\n获取<a href="https://www.baidu.com/s?wd=%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">服务器端</a>异常的堆栈
跟踪信息:{3}\t\n获取一个布尔值,表示异常是否是由于网络连接超时造成的{4}",
error.get_exceptionType(),
error.get_message(),
error.get_statusCode(),
error.get_stackTrace(),
error.get_timedOut())
alert(a);
}
a();
b();
c();
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
一、WebService在cs后台程序中的调用
A、通过<a href="https://www.baidu.com/s?wd=%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">命名空间</a>和类名直接调用
示例:
WebService ws = new WebService();
string s = ws.HelloWorld();
B、通过添加WEB引用的方式调用,首先添加WEB引用,通过URL指向WEBSERVICE,
指定WEB引用名,假设为KK;
示例:
kk.WebService n = new kk.WebService();
string ss=n.HelloWorld();
二、WebService在前台页面的JS 调用方法
1、首先通过下面的方法把Webservice在前台引用进来
2、然后就可以通过JS程序进行调用,示例如下:
function a()
{
WebService.HelloWorld(onresult);
}
//这里的onresult是<a href="https://www.baidu.com/s?wd=%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">回调函数</a>
function onresult(result)
{
alert(result);
}
function b()
{
WebService.add(1,2,onreturn)
}
function onreturn(result)
{
alert(result);
}
//下面的'context'是上下文,可以通过回到函数通过重载的方式获得;
function c()
{
WebService.div(1,1,onresultC,onerror,'context');
}
function onresultC(res,c)
{
alert(res);
alert(c);
}
//onerror是获得异常信息的<a href="https://www.baidu.com/s?wd=%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">回调函数</a>,下面给出了获得异常信息的方法
function onerror(error)
{
var a="";
a=String.format("获取<a href="https://www.baidu.com/s?wd=%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">服务器端</a>异常的具体类型:{0}\t\n获取详细的异常描述信息:{1}\t\n获取造成异常的:{2}\t\n获取<a href="https://www.baidu.com/s?wd=%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%AB%AF&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBPH0vrAm1rH-hPj6sPAcz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHn3Pj01PHmsnHm1P1Tkn1T3n0" target="_blank" class="baidu-highlight">服务器端</a>异常的堆栈
跟踪信息:{3}\t\n获取一个布尔值,表示异常是否是由于网络连接超时造成的{4}",
error.get_exceptionType(),
error.get_message(),
error.get_statusCode(),
error.get_stackTrace(),
error.get_timedOut())
alert(a);
}
a();
b();
c();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询