gpt4 book ai didi

ios - Xtify 负载 - 服务器错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:21:52 25 4
gpt4 key购买 nike

我正在尝试使用 xtify 向 android 和 iOS 发送推送通知。我能够做到这一点,但是,有效负载信息似乎对我不起作用。如果我删除有效负载,请求会成功,但添加有效负载会导致服务器错误。谁能查看我发送的 json 并告诉我是否做错了什么?

{
"apiKey":"...",
"appKey":"...",
"xids":[
"..."
],
"content":{
"subject":"chat from billy bob",
"message":"hey",
"payload":{
"UserId":"1",
"DeviceId":"9"
}
}
}

这是服务器返回的错误:HTTP/1.1 500 内部服务器错误日期:2012 年 5 月 30 日星期三 22:51:51 GMT内容类型:text/html;charset=utf-8内容长度:5839连接:关闭

JBoss Web/2.1.3.GA - 错误报告

HTTP Status 500 -

type异常报告

< b>消息

描述 服务器遇到内部错误 (),导致它无法完成此请求。

异常

javax.servlet.ServletException: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT tokenat [Source: org.apache.catalina.connector.CoyoteInputStream@210c8d4e; line: 1, column: 199] (through reference chain: com.xtify.api.entities.PushRequest["content"]->com.xtify.api.entities.Content["payload"])       com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:418)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)       javax.servlet.http.HttpServlet.service(HttpServlet.java:717)       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

根本原因

org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT tokenat [Source: org.apache.catalina.connector.CoyoteInputStream@210c8d4e; line: 1, column: 199] (through reference chain: com.xtify.api.entities.PushRequest["content"]->com.xtify.api.entities.Content["payload"])       org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163)       org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219)       org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:44)       org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:13)       org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)       org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)       org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)       org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)       org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299)       org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:414)       org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:697)       org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580)       org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704)       org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315)       org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419)       com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:139)       com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:474)       com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123)       com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:46)       com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153)       com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:203)       com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)       com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)       com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)       com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)       com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)       com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1483)       com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1414)       com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1363)       com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1353)       com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)       javax.servlet.http.HttpServlet.service(HttpServlet.java:717)       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

注意 JBoss Web/2.1.3.GA 日志中提供了根本原因的完整堆栈跟踪。

JBoss Web/2.1.3.GA

最佳答案

元素类型是 JSON 而不是数组。所以 payload 元素应该是这样的:

“有效载荷”:“{'key1':'value1','key2':'value2'}”

试一试,让我知道结果如何。

迈克尔

关于ios - Xtify 负载 - 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10825456/

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