xml to wbxml conversion for activesync in iOS - xcode

I have been trying to built an app which will communicate with MS-ActiveSync Exchange. I am stuck at the provisioning part. I need to send a post HTTP request with WBXML content in body. But I could not find anything anywhere to convert xml to wbxml for active sync.
There are some C based libraries available like wbxml2, but can I use them for active sync. There are no code pages provided in the library as mentioned in MS-Activesync Exchange documentation. Please help!!!

Use libwbxml. The package has xml2wbxml and wbxml2xml. Code pages are included.
save this as prov.xml:
<?xml version="1.0"?>
<!DOCTYPE ActiveSync PUBLIC "-//MICROSOFT//DTD ActiveSync//EN" "http://www.microsoft.com/">
<Provision xmlns="Provision:">
<Policies>
<Policy>
<PolicyType>MS-WAP-Provisioning-XML</PolicyType>
</Policy></Policies></Provision>
then:
xml2wbxml -a prov.xml -o prov.wbxml
You can manipulate wbxml as text.
In https://code.google.com/p/tz-push/
In javascript:
prov.wbxml = string.fromCharCode(0x03,0x01,0x6A,0x00,0x00,0x0E,0x45,0x46,0x47,0x48,0x03,0x4D,0x53,0x2D,0x57,0x41,0x50,0x2D,0x50,0x72,0x6F,0x76,0x69,0x73,0x69,0x6F,0x6E,0x69,0x6E,0x67,0x2D,0x58,0x4D,0x4C,0x00,0x01,0x01,0x01,0x01)

wbxml2xml and xml2wbxml are command line programs included with libwbxml. I know nothing about IOS development.
Have a look at https://tz-push.googlecode.com/files/towbxml.js it is xml to wbxml converter written in js. (Can be run in Thunderbird/Workspace or Firefox/Sratchpad.) I know this is not what you want but the code may point you in the correct direction. It uses Sax. So if you have a sax parser available should be easy to port.

Related

Generating Dynamic SSML from "HTTP Request" to be used on a "Get Input"

I'm wondering if anyone can be of assistance.
I am trying to generate some dynamic Amazon Polly SSML to be used on the Plivo PHLO platform. When someone dials into a particular number, they should be greeted with a custom message (in a particular language) and prompted to enter a number.
I have an HTTP request that hits my API, which receives the request and generates the SSML using Plivo's PHP Server SDK.
$response = new Response();
$speak_elem = $response->addSpeak($result['text'], ['language'=> 'en-US, 'voice'=>"Polly.Joanna"]);
Header('Content-type: text/xml');
die( $response->toXML() );
It seems to me that this HTTP Request is working perfectly and returning perfect SSML. When I copy and hard-code-paste the SSML into the Get Input node, it works OK.
<?xml version="1.0" encoding="utf-8"?>
<Response><Speak language="en-US" voice="Polly.Joanna">Welcome To 101 Broadway. For English, press 1.</Speak></Response>
However, when I try to add a Get Input component and link it's "prompt" audio to the resulting SSML, I am getting an error that says Invalid SSML (See Screenshots at the bottom).
WHAT I'VE TRIED
I've tried returning the SSML in plain XML and using {{HTTP_Welcome.response}}
I've tried returning the SSML as text in a JSON object called SSML and using {{HTTP_Welcome.response.SSML}}
I've tried returning the SSML both with and without the xml tag.
I've tried returning the SSML both with and without the Result tag.
I've tried taking a break and coming back to it. Hey, you never know.
No matter how I return the SSML, and how I try to link it to the Get Input prompt, I am unsuccessful. I'm starting to wonder if this is even possible?
Any help would be immensely appreciated. Thanks!
SCREENSHOT 1
SCREENSHOT 2
My name is Mohammed Huzaif, and I work for Plivo as a Developer Evangelist.
Unfortunately, the "GetInput node" in PHLO does not yet implement the feature you are searching for. The best option is to use a standard speak which is customisable in your way, which may have a less natural feel than SSML.
Currently, I've narrow information about your use case as of now but If you still want to use a custom SSML, I'd recommend utilising a framework instead of PHLO to design your call flow. Here's a tutorial that covers a few use cases by Plivo in several frameworks to help you develop one.
If you experience any problems, please feel free to contact our support team.

FHIR .NET API How to support Unknown Member in Resource?

I am working with a FHIR server that has Customized member in the resource.
Say if we receive a Patient with the following
xml = "<Patient xmlns='http://hl7.org/fhir'><hasSuperPower></hasSuperPower></Patient>";
How do I add the extra tag support in the FHIR .NET API so I can work with this Customized Resource? (so that the Deserilizer can process it and put it in a Patient Object.)
I have read from Mirjam Baltus 's post that the Model classes can be enhanced because they are all declared as "Partial class". Does
this mean I have to work with the FHIR API source code and add my own Partial class there and then re-compile it?
Would there be a way that I can just use the DLL from Nuget without have to touch the source code?
Why would you use a customized element rather than the standard extension element? Adding custom elements in this way is not compliant with the standard, won't work with any of the public test servers, won't interoperate with other FHIR systems and won't work with the reference implementations. Have you looked at the extensibility portion of the spec?
I've answered this in the Google forum as well, and agree with Lloyd.
If you receive a Patient with a <hasSuperPower> tag, that is not a FHIR compliant Patient.
FHIR has an excellent way to communicate data that doesn't fit in any of the standard fields, called extensions. If you use these, there is no need to write extra code to handle non-FHIR resources, and you can just use the existing libraries without having to change anything to them.
The superpower ability could look like this, and be FHIR compliant:
<Patient xmlns="http://hl7.org/fhir">
<extension url="http://mirjams.example.org/fhir/StructureDefinition/super-patient">
<valueBoolean value="true"/>
</extension>
</Patient>
I'd also like to point out this blog by Brian Postlethwaite about custom resource properties: https://brianpos.com/2018/05/03/code-generation-fhir-custom-resources/

Streaming json in nativescript

has anyone used the streaming json in nativescript? I found this http://oboejs.com/why but it seems not to work. I'm using nativescript 1.6, any suggestion would be appreciated really much. Thank you.
There is no library to my knowledge currently built for NativeScript that allows streaming JSON. Just for clarification sake you can easily pull JSON from a server and parse it using the built in fetch/http api's, right now -- but their is no way to have it start parsing the json as it downloads in chunks built in.
You can attempt to modify the npm node module to build for NativeScript.
Or thinking outside the box a bit; you can also use the web based version of that module inside the nativescript-webworkers and have it pull and process your JSON and communicate the json messages back to the NS environment. The WebWorkers module actually wraps the native platform's web browser module so it can run all browser based JS code.
Disclaimer: I'm the author of the open source NativeScript-WebWorkers.

Send Email with pdf file as attachment in rhomobile

I want to send email using mailto tag with a single pdf file as attachment.
mailto tag opens the mail window with passed arguments like to and subject using:
Mail to Manager
But, attachments as a parameter isnt working.
Please suggest how to send pdf attachment in rhomobile.
Thanks
I think that you need to add the physical path to the PDF file for it to work (otherwise it may not know where the file is). This post on a forum says as follows:
The only problem is that this "mailto" command executes on the
client machine, therefore it tries to locate the attachment file by
a physical path, and not by a virtual path.
That is,
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="\myhost\myfolder\myfile.lis"
works ok, but only for local users (those connected to the same
network as the "myhost" machine).
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="http://myhost:myport/my_location_virtual_path/myfile.lis"
does not work, it does not recognize such a syntax as valid for
the attachment file.
In your case you would properbly need to look at this part of the Rhomobile docs (on file system access) to get the right path to your file.
EDIT:
From you comment I can see that you are trying to make it work on iOS (due to the iOS specific path).
In this discussion (from Rhomobile's Google Group) it is explained that mailto doesn't support attachments on iOS. It says as follows:
Don't know about other platforms, but you cannot do this on iOS. mailto: does not support attachments on iOS.
You can do it using a native API, MFMailComposeViewController.
This is a complete controller with UI, so you would have to write a Native View Extension to use it:
http://docs.rhomobile.com/rhodes/extensions#native-view-extensions
EDIT 2:
I've looked around and it seems that mailto doesn't support attachments on Android either. This is because Android supports the RFC 2368 mailto protocol, which doesn't include attachments. Here is a reference to the Android mailto url parser.
I would suggest that you do as suggested for iOS, write a native extension. I think this post would be relevant for you.

How to view the raw XML or Json response using LinqToTwitter?

How can I view the raw XML or Json response when doing a search for users using the LinqToTwitter library? I'm using the SingleUserAuthorizer for oAuth.
If you have any ideas using other libraries or even a simple oAuth framework, I'm open to suggestions.
Thanks.
TwitterContext has a RawResults property you can use.
If this is just for debugging purposes, I'd use Wireshark or Fiddler - that way you get to see the complete HTTP requests/responses.

Resources