Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为简单REST web服务调整SoapUI_Java_Rest_Tomcat_Jersey_Soapui - Fatal编程技术网

Java 为简单REST web服务调整SoapUI

Java 为简单REST web服务调整SoapUI,java,rest,tomcat,jersey,soapui,Java,Rest,Tomcat,Jersey,Soapui,我有一个基于Jersey的RESTWeb服务,它在我的EclipseIDE中的Tomcat9上运行 使用broser进行测试时,服务器运行正常: 开放链接 带来: <messages> <message> <author>koukushik</author> <created>2019-02-20T12:48:41.817+02:00</created> <id>1</id> <message&

我有一个基于Jersey的RESTWeb服务,它在我的EclipseIDE中的Tomcat9上运行

使用broser进行测试时,服务器运行正常:

开放链接

带来:

<messages>
<message>
<author>koukushik</author>
<created>2019-02-20T12:48:41.817+02:00</created>
<id>1</id>
<message>Hello World</message>
</message>
<message>
<author>koukushik</author>
<created>2019-02-20T12:48:41.817+02:00</created>
<id>2</id>
<message>Hello Jersey</message>
</message>
</messages>
请不要请求原始:

GET http://localhost:8080/messenger/webapi/messages/messenger/webapi/messages HTTP/1.1
Accept-Encoding: gzip,deflate
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
回答HTML:

<html lang="en">
   <head>
      <meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/>
      <title>HTTP Status 404  Not Found</title>
      <style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style>
   </head>
   <body>
      <h1>HTTP Status 404  Not Found</h1>
      <hr class="line"/>
      <p>
         <b>Type</b>
         Status Report
      </p>
      <p>
         <b>Message</b>
         Not Found
      </p>
      <p>
         <b>Description</b>
         The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
      </p>
      <hr class="line"/>
      <h3>Apache Tomcat/9.0.14</h3>
   </body>
</html>
GET方法的结尾似乎包含HTTP/1.1。有问题吗?如何使SoapUI与我的项目一起工作

UPD

现在一切正常:
问题在于,原始请求中显示的您试图访问的URL不是您想要的URL,因此返回404状态码

请尝试以下设置


如果我理解错误,请纠正我,但在原始请求中,我看到您试图访问与原始URL不同的URL,这将导致404错误,但我在请求中没有看到资源和参数框。如何启用它们?我已经用我的请求图片更新了问题主体,它可以工作,您使用哪个SoapUI版本?我使用5.4.0,您如何继续提出请求?下面是SoapUI官方页面上的一个好例子
<html lang="en">
   <head>
      <meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/>
      <title>HTTP Status 404  Not Found</title>
      <style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style>
   </head>
   <body>
      <h1>HTTP Status 404  Not Found</h1>
      <hr class="line"/>
      <p>
         <b>Type</b>
         Status Report
      </p>
      <p>
         <b>Message</b>
         Not Found
      </p>
      <p>
         <b>Description</b>
         The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
      </p>
      <hr class="line"/>
      <h3>Apache Tomcat/9.0.14</h3>
   </body>
</html>