如何使用 curl 和 SOAP 调用 MobileFirst 适配器?
How to invoke MobileFirst adapters with curl and SOAP?
美好的一天,
我们需要通过 curl 和 SOAP 调用 MobileFirst 适配器,省略身份验证。
如何使用 curl 和 application/x-www-form-urlencoded 执行此操作的示例如下所示,但我们还需要使用 SOAP 调用适配器。
curl -XPOST -d 'adapter=PushAdapter&procedure=sendNotifications¶meters=["[\"UserA\",\"UserB\"]", "Pushed.you"]' http://localhost:10080/application/invoke
原因是,我们想通过只允许 SOAP 的网络区域触发发送 PushNotifications。
我们对不同的建议持开放态度,例如实施新的 JavaAdapter(非 JS)、实施额外的 WebService 或弹出的任何可以以可接受的方式满足要求的建议。
我希望有人能想到如何通过 SOAP 调用适配器,省略身份验证。
谢谢,
小发明
----编辑---
我添加了一个新的 Java 适配器,就像 Hasan 的视频所暗示的那样。
非常感谢您的提示 :)
我添加了这样的 WebService:
@WebService
@Path("/soap")
@OAuthSecurity(enabled=false) // Disable the imfAuthentication :)
public class ExternalPushService {
@POST
@Path("/push")
@WebMethod(action="push")
public String push(@WebParam(name="name") String name) {
return name + "ABC";
}
}
我现在可以向 http://localhost:10080/app/adapters/PushBridge/soap/push 端点发送 HTTP POST 请求,但 SOAP 未被解析。
相反,我在 "name" 参数中获得了完整的信封。
如果我对 PushBridge/soap 进行 SOAP 调用,我会得到 405 Method not allowed.
有人知道我怎样才能让 SOAP 开箱即用吗?
答案是:否
当你在你的 java 适配器中添加 @WebService 时,这将面临交战:
Problem description:This annotation requires a web service project. Convert the Java project to a web project targeting the specified runtime environment
SOAP 基础服务基于 JAX-WS 规范。
但是
Java 适配器基于 JAX-RS 规范。
https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/server-side-development/java-adapter/
美好的一天,
我们需要通过 curl 和 SOAP 调用 MobileFirst 适配器,省略身份验证。
如何使用 curl 和 application/x-www-form-urlencoded 执行此操作的示例如下所示,但我们还需要使用 SOAP 调用适配器。
curl -XPOST -d 'adapter=PushAdapter&procedure=sendNotifications¶meters=["[\"UserA\",\"UserB\"]", "Pushed.you"]' http://localhost:10080/application/invoke
原因是,我们想通过只允许 SOAP 的网络区域触发发送 PushNotifications。
我们对不同的建议持开放态度,例如实施新的 JavaAdapter(非 JS)、实施额外的 WebService 或弹出的任何可以以可接受的方式满足要求的建议。
我希望有人能想到如何通过 SOAP 调用适配器,省略身份验证。
谢谢, 小发明
----编辑---
我添加了一个新的 Java 适配器,就像 Hasan 的视频所暗示的那样。 非常感谢您的提示 :)
我添加了这样的 WebService:
@WebService
@Path("/soap")
@OAuthSecurity(enabled=false) // Disable the imfAuthentication :)
public class ExternalPushService {
@POST
@Path("/push")
@WebMethod(action="push")
public String push(@WebParam(name="name") String name) {
return name + "ABC";
}
}
我现在可以向 http://localhost:10080/app/adapters/PushBridge/soap/push 端点发送 HTTP POST 请求,但 SOAP 未被解析。 相反,我在 "name" 参数中获得了完整的信封。 如果我对 PushBridge/soap 进行 SOAP 调用,我会得到 405 Method not allowed.
有人知道我怎样才能让 SOAP 开箱即用吗?
答案是:否
当你在你的 java 适配器中添加 @WebService 时,这将面临交战:
Problem description:This annotation requires a web service project. Convert the Java project to a web project targeting the specified runtime environment
SOAP 基础服务基于 JAX-WS 规范。
但是
Java 适配器基于 JAX-RS 规范。 https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/server-side-development/java-adapter/