Я настроил и закодировал простой вызов веб-службы для действия Struts 2. Я не получаю данные от вызова, но он возвращает JSON должным образом. Я использую Почтальон, чтобы сделать звонок.
public class WSLaborJONAction
{
// this property is not getting populated on the call
private String test;
public String execute() throws Exception
{
...some code
return "success";
}
public String getTest()
{
return test;
}
public void setTest(String test)
{
this.test = test;
}
}
<package name="webservices" namespace="/" extends="json-default">
<result-types>
<result-type name="json" class="org.apache.struts2.json.JSONResult" />
</result-types>
<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor" />
</interceptors>
<!-- LABOR JON -->
<action name="WSLaborJON" class="mil.ndms.taa.af.webservices.labor.WSLaborJONAction">
<result name="success" type="json" />
</action>
</package>
GET /taa/WSLaborJON
Content-Type: application/json
User-Agent: PostmanRuntime/7.13.0
Accept: '*/*'
Cache-Control: no-cache
Postman-Token: 111a91a2-919f-4469-a96c-c5b666c9ebec
Host: localhost:8080
accept-encoding: gzip, deflate
content-length: 30
Connection: keep-alive
{
"test":"MyInputTest"
}
HTTP/1.1 200
status: 200
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 23
Date: Tue, 11 Jun 2019 18:02:13 GMT
{"test":"MyOutputTest"}
Мой тест String всегда нулевой. Мне нужно использовать его в действии из вызова JSON. Есть идеи о том, что мне не хватает?