Topic
12 replies Latest Post - ‏2011-02-08T09:51:41Z by SystemAdmin
SystemAdmin
SystemAdmin
38 Posts
ACCEPTED ANSWER

Pinned topic Consuming SOAP Web Services without using Adapters

‏2011-02-02T13:54:06Z |
Hi

I was reading about the adapter stuff while evaluating the Worklight platform and I wondered if the only way to consume web services is to have adapters? Here's a few questions:

1. Adapters are actually running on the server that is hosting the Worklight Server?
2. for a web service a HTTP adapter is actually half-way between the mobile application and the web service itself? In essence the adapter is in fact the consumer of the web service?
3. The mobile application never acts as a direct consumer of a web service?

If I wanted to create a mobile application that directly consumes a web service I guess I would either create the underlying native SOAP/HTTP client API as a PhoneGap Plugin and then expose this to the JS layer or (more probably utilize a JS SOAP library)?

Thanks

James
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-02T20:24:14Z  in response to SystemAdmin
    1. Adapters run in the process of the WorkLight server.
    2. A web service is called from the adapter and is indeed the consumer of the web service. The adapter can then manipulate the data, call a few other services and then return a succinct message tot he mobile client
    3. The mobile application is an HTML application and can thus call via AJAX anything it wants. However, this is not a good practice if you want to connect to enterprise resources and enjoy SSO, caching etc.
    To call directly you can use any of the methods describe below or instead of SOAP you can use restfull services and use a simple URL to get a JSON object.
    SOAP will typically return XML, adapters usually return JSON which is better for JavaScript consumers.

    In addition, adapters are used for push-notification to the mobile clients
    Hope this helps
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T14:41:07Z  in response to SystemAdmin
    Thanks for the response. A couple of questions come out of it:

    1. Is it possible to write our own bespoke Authenticaticator (both client and server side components?
    2. How does a WL client communicate with an adapter? Is it using SSL? Is this configurable / custimizable?

    For both of the above (in the event that the answer is yes) are there examples of doing this?

    Thanks

    Jim
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T14:53:55Z  in response to SystemAdmin
    Authentication customization
    (1) Client side - of course
    (2) Server side - Yes, but we have to diagnose the exact flow. For some flows you will have to work more closely with us. We are working to release it as public APIs, but for now its a bit more internal. There is a guide on the site called "Authentication configuration guide" which is the basis. Beyond that you need to add a custom java class

    WL cliient uses http or https to communicate with an adapter. To your choosing. When you use https you typically terminate it on an apache in front of the worklight server.
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T16:28:29Z  in response to SystemAdmin
    OK, that's useful to know thanks

    Additionally is there any built-in support for:

    1. Client-side analytics (measuring where the user clicks)
    2. Field/Error reporting (for example submitting crash reports, debug traces, etc)
    3. What actually goes in the reports that appear in the Worklight console?

    Thanks again

    James
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T16:45:53Z  in response to SystemAdmin
    Small questions, heavy subjects
    1. Client-side analytics (measuring where the user clicks)
    This is applicative in the sense that when you use your code -- you insert JavaScript segments for Google analytics, Omniture etc.
    The platform provides server side analytics in the sense that every call to the server is stored together with additional origin and state information. We provide a raw data feed that can be added to the enterprises BI solution to provide crosscuts by device, date, session (following on what the user does along a session etc). We also provide an API on the device side to log custom data to this feed.
    2. Field/Error reporting (for example submitting crash reports, debug traces, etc)
    We provide the usual debug logs on the server side (log4j, info, warn, error etc).
    We are currently working on logging client errors to be aggregated in the database for dissection.

    3. What actually goes in the reports that appear in the Worklight console?
    The reports that are part of the console are minimalistic out-of-the-box reports for those customers that do not use the raw data feed + BI described in #1 above.
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T16:56:45Z  in response to SystemAdmin
    Great answers - almost have everything now - just a couple more things:

    1. You mentioned that it is possible to configure the connection between the mobile client application and the server-side adapter to use HTTPS. How is this done? Does this need to be setup in the application-descriptor.xml file? Can the connection to one adaptor be over HTTPS and another adapter used within the same mobile client App be over HTTP?

    2. Are all authentication requests made over HTTPS?

    Sorry for all the questions

    James
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T17:05:40Z  in response to SystemAdmin
    >> 1. You mentioned that it is possible to configure the connection between the mobile client application and the server-side adapter to use HTTPS. How is this done? Does this need to be setup in the application-descriptor.xml file?
    Yes: There is a tag for the server full URL:
    <worklightRootURL>http(s)://somewhere.com:8080</worklightRootURL>

    >> Can the connection to one adaptor be over HTTPS and another adapter used within the same mobile client App be over HTTP?
    Not that I know of. At the end of the line the call to the adapter is a parameter in a specific URL of an application.
    In any case, as you can see above, the setting for a specific app on the client side is either/or and not both.

    >> 2. Are all authentication requests made over HTTPS?
    I assume you are talking about client authentication requests. This is the same as answer to #1 above.

    >> Sorry for all the questions
    No worries. Keep on asking

    James
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T17:25:55Z  in response to SystemAdmin
    Once again many thanks

    Can I ask if client authentication requests are made using AJAX or are within the native WL PhoneGap plugin code?

    James
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-03T18:55:17Z  in response to SystemAdmin
    Its all Ajax
    Note that we also hybrid technology in which you can write code that is mixed native and web (say 90% of the code is web, but you also add an augmented reality native screen that will play seamlessly with the rest). The native page can also call the WorkLight server and we provide native API (Java for Android, Objective C for iPhone)
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-04T09:25:41Z  in response to SystemAdmin
    I see, the reason I asked was that I noticed in the iPhone Environment Native code that there are classes for making web requests (ASIHttp) and the WLClient source appears to be invoking Adapter procedures:

    -(void) invokeProcedure:(WLProcedureInvocationData *)invocationData withDelegate:(id <WLDelegate>)delegate options:(NSDictionary *)options;

    Yet in the wlclient.js it's Ajax:

    this.invokeProcedure = function (invocationData, options) {

    ...

    new Ajax.WLRequest(REQ_PATH_BACKEND_QUERY, requestOptions);

    };
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-08T06:19:38Z  in response to SystemAdmin
    Not sure if this is what you meant, but we also support "Hybrid Apps". Basically a mixture of a web app and native pages which work seamlessly.
    So, apart from the JavaScript API which is used for the web part of the App, we also provide a Native API to the WorkLight Server which allows calls to the server from native Objective C code (or Android-Java code).
  • SystemAdmin
    SystemAdmin
    38 Posts
    ACCEPTED ANSWER

    Re: Consuming SOAP Web Services without using Adapters

    ‏2011-02-08T09:51:41Z  in response to SystemAdmin
    Thanks, yeah after I wrote that I realized that the Native SDK was something applicable to native code

    Thanks for all your support

    James