Reply to Post
Skilled Spy
2 Posts
Member since ‎08.14.2008

Issues (and solutions!) with Java HTML 5 SDK Kitchen Sink

 

I downloaded the HTML5 SDK 2.1 r15 yesterday and ran into a couple of issues getting the Kitchen Sink samples to work.  This post outlines the issues and my solutions to those.

 

Environment:

- build using Eclipse Indigo

- Java server runtime deployed on CloudBees

 

Issue #1: web.xml error at startup

 

After building the war file in Eclipse and uploading, I received the following error at startup:

 

Aug 15, 2012 5:16:55 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
SEVERE: Parse error in application web.xml file at jndi:/localhost/WEB-INF/web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> att/notifications in servlet mapping

 

Fix for Issue #1:  Pretty easy.  Add a leading slash to att/notifications in the web.xml:

Go from this:

  <url-pattern>att/notifications</url-pattern> 

 To this:

  <url-pattern>/att/notifications</url-pattern> 

 

 

Issue #2: Test.wav file not found for speech test

 

When I tried to run the speech example, it returned "Results - Success - Null".  Looking at the logs, I saw 

INFO: AttDirectRouter: {"error":"Test.wav (No such file or directory)","action":"ServiceProvider","method":"speechToText","tid":1,"type":"rpc"}

 There were really two problems here:

  1. The .war file doesn't include Test.wav sample sound file
  2. Where should you put Test.wav?

I first tried to put the Test.wav into the root of the .war file, but that didn't work, possibly because of how CloudBees handles the war file or where its default working directory is.

 

My solution to issue #2

 

My solution was pretty complex.  Hopefully the dev team can find something a little cleaner:

 

1. Copied the test.wav file into the .conf folder

2. Modified the build.xml so it would copy the test.wav into the classes directory in the .war file.  (2nd "include" line below)

 

      <classes dir="conf">
            <include name="**.properties"/>
      		<include name="**.wav"/>
      </classes>

 3.  Modified the code for FileMapper.getFileForReference() and ServiceProviderSpeech.sendSpeech() to use the getResource() method to find the file, rather than new File().  It's about 20 lines of code and perhaps too complicated for this post, but I'm willing to share if anyone wants to see it.

 

Hope this helps anyone who might have run into these issues.

 

Thanks,

Jason

Expert Spy
padma
7 Posts
Member since ‎08.22.2012

Re: Issues (and solutions!) with Java HTML 5 SDK Kitchen Sink

Hi Jason,

I tried to execute the sdk but i am not succeeded because of some issues.

 

In properties file(att-api.properties) i changed the scope to TL as i am more concerned on location based services but i received a error stating "Invalid Scope" then i changed the scope to "SMS" now i am able to see the home page with list of options and i selected SMS.

 

But when i clicked "Send SMS" button i got a 404 error and in my error console i found "Failed to load resource: the server http://localhost:8080/att/direct_router responded with a status of 404."

 

Can you tell me

1. Why i am not able to run the application with scope as TL?

2. What is the reason for 404 error? Currently i created the WAR using eclipse IDE and placed the WAR in my tomcat server and started the service. Did i missed anything ?

Novice Coder
mfierro
2 Posts
Member since ‎09.13.2012

Re: Issues (and solutions!) with Java HTML 5 SDK Kitchen Sink

TL is an authorization scope. The clientModelScope variable specified on the att-api.properties holds the scopes for client model scopes to be used on the application. When the application registers itself, it obtains a token which is valid for the given scopes specified on that variable. 

By default, all the client scopes are set:

 

clientModelScope=WAP,SMS,MMS,PAYMENT,SPEECH

 

TL, on the other hand, is as I said an Authorization scope, this means that you have to ask the user consent to use his/her information. Authorization retrieves a different token, using OAuth, based on the current user by displaying a consent page.

 

This scopes (TL, MIM, and MOBO) are configured on the Provider.js. They are used when Provider.

authorizeApp() method is called. 

 

authorizeApp({

  scope: /*Your scope: you can use TL in here */

  success: /*your success cbk*/,

  failure : /*your failure cbk*/  

});

 

in case you don't pass the scope, all the possible scope will be passed as parameter to get authentication.

 

 

 

 

  • of 1