I tried to implement XMPP with Spring Integration using the following tutorial:
https://grokonez.com/spring-framework/spring-integration/firebase-cloud-messaging-xmpp-server-example-receive-upstream-messages-spring-integration
However I am getting the following error:
org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'json' cannot be found on object of type 'org.jivesoftware.smack.packet.StandardExtensionElement' - maybe not public or not valid?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:217) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:104) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:51) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:406) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:90) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:111) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:328) ~[spring-expression-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint$ChatMessagePublishingStanzaListener.processStanza(ChatMessageListeningEndpoint.java:143) ~[spring-integration-xmpp-5.1.1.RELEASE.jar:5.1.1.RELEASE]
So how to receive an upstream message within Spring integration?
Your problem that you don't show what is your code on the matter. And looks like you really are missing the fact that the mentioned sample is based on the GCM, where getExtension('google:mobile:data') from the org.jivesoftware.smack.packet.Message really returns for us a org.jivesoftware.smackx.gcm.packet.GcmPacketExtension with the getJson() method.
In your case it looks like your get a org.jivesoftware.smack.packet.StandardExtensionElement. So, that really is expected do not have a json over there.
Related
I am experimenting with Lagom to check how call, pathCall and namedCall are invoked. I am following lagom's tutorial. I created a new service and opened url using following urls but I get error
URL used (I expect to see hello2 response)
http://localhost:9000/
Error
GET\Q/stream\EService: hello-stream (http://0.0.0.0:58322)
2GET\Q/api/hello/\E([^/]+)Service: hello (http://0.0.0.0:57797)
3POST\Q/api/hello/\E([^/]+)Service: hello (http://0.0.0.0:57797)
**4POST\Q/hello2\EService: hello (http://0.0.0.0:57797)**
I have done following steps
After downloading template (see https://www.lagomframework.com/documentation/1.3.x/scala/IntroGetStarted.html), I have changed the code to add a new service call (called hello2). Following is teh code I have added in HelloService.scala
named("hello")
.withCalls(
pathCall("/api/hello/:id", hello _),
pathCall("/api/hello/:id", useGreeting _),
call(hello2) //added this line in default template.
)
I have defined hello2 as (in HelloService.scala)
def hello2: ServiceCall[String, String]
The code in HelloServiceImpl.scala is
override def hello2 = ServiceCall {
Future.successful("Hello2")
}
Questin 1 - What is the mistake (I guess I am not invoking the service correctly from the browser)?
When you say, "I guess I am not invoking the service correctly from the browser", do you mean you're just navigating to the URL in your browser? If so, this won't work because hello2 is defined as a POST endpoint and your browser will be sending a GET request.
hello2 is defined as a POST endpoint because in your ServiceCall definition it takes a request message. (See https://www.lagomframework.com/documentation/1.3.x/java/ServiceDescriptors.html for more info.)
If you change the request message type from String to NotUsed then Lagom should start generating a GET endpoint instead.
I have a java adapter (JAX-RS) that returns a POJO, one of the attributes is called validateUser and is a boolean value. I want to get the value of this boolean when called from main.js
It should work like this (main.js):
onGetLoginSuccess function (response)
busy.hide ();
alert ("validate:" + response ["validateUser"]);
As I can get the value in the variable response, the validateUser attribute my POJO.
Thank you for your attention
You can use alert(response.responseJSON.validateUser);
In general to examine the structure of "response" you could do something like: alert(JSON.stringify(response)); It could help you to understand which fields are available and how can you find this validateUser.
It is also important to make sure that your JAX-RS adapter returns JSON content type. Make sure that you have the annotation: #Produces("applicaion/json") in your JAX-RS method that returns this POJO
I have been trying to use the EventMerics API to return detailed event parameter data.
I have setup a test application and have uploaded event data with parameters, I can see the data in the web interface.
However the API doesn't seem to return the parameter data as stated by the documentation.
The following call
http://api.flurry.com/eventMetrics/Event?apiAccessCode=xxx&apiKey=xxx&startDate=2012-08-27&endDate=2012-08-27&eventName=heatmap%20-%20iPhone-Title-all
returns:
<eventMetrics type="Event" startDate="2012-08-27" eventName="heatmap - iPhone-Title-all" endDate="2012-08-27" version="1.0" generatedDate="8/27/12 10:45 PM">
<day uniqueUsers="2" totalSessions="12" totalCount="14" date="2012-08-27"/>
<parameters/>
</eventMetrics>
....
The parameters section is empty, I am expecting the following parameter values:
{touchXY : 299,465,2012-08-27 16:40:15 +0100}
{touchXY : 301,461,2012-08-27 16:29:03 +0100}
{touchXY : 192,312,2012-08-27 16:22:54 +0100}
{touchXY : 254,461,2012-08-27 16:23:04 +0100}
Has anyone got parameter values to return via the Flurry REST API?
the API call used by you is correct. I would recommend you to write to support#flurry.com to investigate why this is not happening.
(Disclaimer: I work in the Support team at Flurry)
The event name in the request is case sensitive so you should check the way it's written on the site. I changed mine from "editor" to "Editor" and the problem resolved.
I've read this example http://msdn.microsoft.com/en-us/library/ee476510.aspx about dynamic responses in wcf.
The sample on the bottom fit my goal pretty well. This is what i did:
[OperationContract]
[WebGet(UriTemplate = "/salaries({queryString})")]
Message GetSalaryByQuery(string queryString);
and my GetSalaryByQuery-Method:
public Message GetSalaryByQuery(string querystring)
{
if (WebOperationContext.Current.IncomingRequest.Accept == "application/json")
return WebOperationContext.Current.CreateJsonResponse<Result>(Salary.GetSalaryByQueryJson(querystring));
else
return WebOperationContext.Current.CreateAtom10Response(Salary.GetSalaryByQuery(querystring));
}
It is pretty similiar to the example i found.
But its not working however. It says that there is another parameter besides the message. I googled the message-class and it seems to me that its not possible to add an parameter to a message-response.
Is there a way to pass a parameter with the request and get a response with a message object?
Is there another way to get the dynamic response?
Thanks in advance.
I got it to work. I just deleted the Metadata-Enpoint and the behavior. My Webservice provides metadata on its own and therefore doesnt need to have the mex-Metadata defined.
I have created a web service based on
http://blogs.msdn.com/b/endpoint/archive/2010/01/06/introducing-wcf-webhttp-services-in-net-4.aspx
i am trying to add an error hadler based on
http://www.codeproject.com/KB/WCF/WCFErrorHandling.aspx
I have given
In web.config such that i am getting
result of a [OperationContract]
either as xml or as Json based on the request content type header.
But when an error occurs the error is returned only as XML
It is not returning error as JSON
Wat can i do to get error as JSON?
You need to implement IErrorHandler and write a ProvideFault method to output as WebContentFormat.Json
you can get all the details of how to do it here:
http://blog.manglar.com/how-to-provide-custom-json-exceptions-from-as-wcf-service/
http://blog.wadolabs.com/2009/03/wcf-exception-handling-with-ierrorhandler/