Java 服务器返回 HTTP 响应代码:URL 405

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24299707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 11:21:42  来源:igfitidea点击:

Server returned HTTP response code: 405 for URL

javahttpsoapui

提问by dneranjan

When I create a new SOAP project in SoapUI 4.6.4, first I have to add initial WSDL url. My initial WSDL URL: http://l:xxxxxxxxxxxxxxx?wsdl.

当我在 SoapUI 4.6.4 中创建一个新的 SOAP 项目时,首先我必须添加初始 WSDL url。我的初始 WSDL URL:http://l:xxxxxxxxxxxxxxx?wsdl.

But I'm getting this error:

但我收到此错误:

Error loading http://lxxxxxxxx?wsdl: org.apache.xmlbeans.XmlException: java.io.IOException: Server returned HTTP response code: 405 for URL: http://lxxxxxxxx?wsdl

加载错误http://lxxxxxxxx?wsdl:org.apache.xmlbeans.XmlException:java.io.IOException:服务器返回 HTTP 响应代码:URL 为 405:http://lxxxxxxxx?wsdl

So how can I fix this?

那么我该如何解决这个问题?

采纳答案by Yazan

Response Code 405: method Not Allowed one of the Methods GET/POST is disallowed, and you are using one of them check this

响应代码 405:不允许方法 GET/POST 方法之一被禁止,并且您正在使用其中之一 检查此

回答by Angga

405 is method not allowed error, this mean you have method that causing problem when its being called. Check if you have duplicate path with method in your wsdl. If no duplicate path try open the http://lxxxxxxxxxxxx?wsdlin your browser if you cant, that`s mean something wrong with your web configuration.

405 是方法不允许的错误,这意味着您有方法在调用时会导致问题。检查您的 wsdl 中是否有使用方法的重复路径。如果没有重复的路径,请尝试ttp://lxxxxxxxxxxxx?wsdl在浏览器中打开 h ,如果不能,则表示您的 Web 配置有问题。

回答by Rajni Gangwar

Most of the answers here are correct but difficult to get for those who are new in this like me. So in simple try changing your controller's request mapping.

这里的大多数答案都是正确的,但对于像我这样的新手来说很难得到。因此,简单地尝试更改控制器的请求映射。

@RequestMapping(path = RequestMappingURL.IVPS_CYCLE_DATE, method = { RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)

@RequestMapping(路径 = RequestMappingURL.IVPS_CYCLE_DATE,方法 = { RequestMethod.POST },产生 = MediaType.APPLICATION_JSON_VALUE)

In above code I mapped request method as post but actually client was sending get request. As soon as I changed it to GET it worked. See below code

在上面的代码中,我将请求方法映射为 post 但实际上客户端正在发送 get 请求。一旦我将其更改为 GET,它就起作用了。看下面的代码

@RequestMapping(path = RequestMappingURL.IVPS_CYCLE_DATE, method = { RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)

@RequestMapping(路径 = RequestMappingURL.IVPS_CYCLE_DATE,方法 = { RequestMethod.GET },产生 = MediaType.APPLICATION_JSON_VALUE)