gpt4 book ai didi

java - 带参数的 ATG 11 REST 调用

转载 作者:行者123 更新时间:2023-12-02 09:14:20 24 4
gpt4 key购买 nike

我需要使用 ATG 11 REST API 调用方法。

public String getString(String str) {
return str;
}

我创建了这样的 Actor 属性配置:

$class=atg.service.actor.ActorChainService
definitionFile=/path/to/service/accountServiceActor.xml

我的 accountServiceActor.xml:

<?xml version="1.0" encoding="UTF-8"?>
<actor-template default-chain-id="cartService" xsi:noNamespaceSchemaLocation="http://www.atg.com/xsds/actorChain_1.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<actor-chain id="getString" transaction="TX_SUPPORTS">
<component id="getString" name="/path/to/service/AccountService"
method="getString" method-return-var="str">
<input name="str" value="${param.str}" />
<output id="str" name="str" value="${str}" />
</component>
</actor-chain>
</actor-template>

我还更新了AccessControlServlet.propertiesActorChainRestRegistry.properties

所以我的休息电话在这里:

curl -L -v -b customer_cookies.txt -X POST -H "Content-Type: application/json" -d '{ "str" : "value" }' http://localhost:7003/path/to/service/AccountServiceActor/getString

我收到此错误:

* Adding handle: conn: 0x7f8eb9803000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f8eb9803000) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 7003 (#0)
* Trying ::1...
* Connected to localhost (::1) port 7003 (#0)
> POST /path/to/service/AccountServiceActor/getString HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:7003
> Accept: */*
> Cookie: DYN_USER_CONFIRM=f0f599f9f11aa5571d7055c2b4c7c9d5; DYN_USER_ID=240004; JSESSIONID=6iUR5qvjjBHPhSNq6zMh_B6dn18lwhKFWvPbOZxTekUIhsFPqf3r!-1528908093
> Content-Type: application/json
> Content-Length: 20
>
* upload completely sent off: 20 out of 20 bytes
< HTTP/1.1 500 Internal Server Error
< Connection: close
< Date: Tue, 26 Aug 2014 11:19:21 GMT
< Content-Length: 265
< Content-Type: text/html; charset=UTF-8
< X-ATG-Version: version=QVRHUGxhdGZvcm0vMTEuMA==
* Replaced cookie JSESSIONID="fcMSCqdKrO-PvMyLalmJHSnuHBa0VEBaJscD01nZYZDOXCXs6Q3j!-1528908093" for domain localhost, path /, expire 0
< Set-Cookie: JSESSIONID=fcMSCqdKrO-PvMyLalmJHSnuHBa0VEBaJscD01nZYZDOXCXs6Q3j!-1528908093; path=/; HttpOnly
< X-Powered-By: Servlet/3.0 JSP/2.2
<
CONTAINER:atg.service.actor.ActorException: There was an error while trying to find a method.&#59; SOURCE:java.lang.NoSuchMethodException: path.to.service.impl.AccountService.getString&#40;null&#41;

我做错了什么?帮助我使我的配置正确。

最佳答案

<input name="str" class-name="java.lang.String" value="${param.str}" /> 

请在您的输入参数中添加类名属性:片段:

关于java - 带参数的 ATG 11 REST 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25504624/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com