webservice 调用报错 400

在尝试通过工具调用指定URL的WebService时遇到400错误。尽管URL在浏览器中能正常显示WSDL文件,但在设置用户名和密码后,使用Java的Service和Call进行调用时抛出异常。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

直接在地址栏中输入地址和用户名,浏览器能够正常显示wsdl文件,但是工具调用就报错了。

我的调用的方法是这样的,为什么执行完之后报400错误,求高手指点:

String url = "http://10.10.30.12:50000/dir/wsdl?p=sa/cea12ef812243d8cac57203bb509d6fb";
String method = "OI_EOS2SAP_Report_REQ";

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(method);
 
call.setUsername("DRPSOAP");
call.setPassword("DRPSOAP");

String[] strs = new String[] {"1","2"};

List return_value = (List) call.invoke(strs);

 

参数是随意些的,应该不影响

 

异常:

Exception in thread "main" AxisFault

 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode: 
 faultString: (400)Bad Request
 faultActor: 
 faultNode: 
 faultDetail: 
{}:return code:  400
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Error Report</title>
<style>
td {font-family : Arial, Tahoma, Helvetica, sans-serif; font-size : 14px;}
A:link {color : #0059AA;}
A:visited {color : #999999;}
A:active {color : #999999;}
</style>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0">
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="left" height="75">
<tr bgcolor="#FFFFFF">
    <td align="left" colspan="2" height="48"><font face="Arial, Verdana, Helvetica" size="4" color="#666666"><b>  400 &nbsp Bad Request</b></font></td>
</tr>
<tr bgcolor="#3F73A3">
    <td height="23" width="84"><img width=1 height=1 border=0 alt=""></td>
    <td height="23"><img width=1 height=1 border=0 alt=""></td>
    <td align="right" height="23"><font face="Arial, Verdana, Helvetica" size="2" color="#FFFFFF"><b>SAP NetWeaver Application Server / AS Java </b></font></td>
</tr>
<tr bgcolor="#9DCDFD">
    <td height="4" colspan="3"><img width=1 height=1 border=0 alt=""></td>
</tr>
</table>
<br><br><br><br><br><br>
<p><font face="Arial, Verdana, Helvetica" size="3" color="#000000"><b>  Error: HTTP method POST is not supported by this URL<p><font face="Arial, Verdana, Helvetica" size="2" color="#000000"><b>  Troubleshooting Guide <a href="https://sdn.sap.com/irj/sdn/wiki?path=/display/JSTS/Home">https://sdn.sap.com/irj/sdn/wiki?path=/display/JSTS/Home</a></p><p></b></font></p>
<p><font face="Arial, Verdana, Helvetica" size="2" color="#000000"><table><tr><td valign="top"><b> Details:</b></td><td valign="top"><PRE>No details available</PRE></font></td></tr></table></font></p>
</body>
</html>


{http://xml.apache.org/axis/}HttpErrorCode:400


(400)Bad Request
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at axis.Test.get_webser(Test.java:48)
at axis.Test.main(Test.java:25)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值