Implementing ONVIF WS-BaseNotification - Unable to load wsdl - wsdl

I'm trying to implement ONVIF WS-BaseNotification mechanism using python and requirement is like this.
Subscribe for events from an ONVIF compliant camera
Upon receiving notifications, from camera parse the notification
message and extract motion event from there.
Here is what my plan:
Download the wsdl from here
Convert the wsdl to python file using wsdl2py
Use the NotificationConsumer server and client classes to
send/receive soap messages.
Currently I'm stuck at #2, where I'm not able to convert the wsdl file properly.
When I try to generate the python classes, what I get is 2 classes: 1 is WS_BaseNotification_services.py and other one is WS_BaseNotification_services_types.py.
In WS_BaseNotification_services.py, I can see nothing but the header part like this:
############################################
# WS_BaseNotification_services.py
#generated by ZSI.generate.wsdl2python
#
and In WS_BaseNotification_services_types.py, all the types are coming up.
I think there is some issue with wsdl file as I've even tried loading this wsdl in SOAP-UI, but got error like this:
Any idea on what went wrong.

This issue is now solved. We need to edit the wsdl file to include Bindings also.

Related

Is it possible to directly parse API protobuf files in iOS?

I am making an app that shows the real-time location of local buses. I have an API that returns the .pb (protobuf) file with Vehicle Positions. I am handling proto buffers for the first time and I have no idea why we can't parse them like JSON file.
I saw a library named "Swift-Protobuf", but in its documentation. They are asking to run a command to convert protobuf file into a swift object. But as I am making API calls every minute that returns the protobuf file. How can I run that command every time?
$ protoc --swift_out=. my.proto
I just want to parse those .pb files into a swift object. So that I can use the data on my project.
They are asking to run a command to convert protobuf file into a swift object. But as I am making API calls every minute that returns the protobuf file. How can I run that command every time?
I think you've misunderstood the documentation: you don't need to run protoc --swift_out=. my.proto for every .pb file you receive; you use that command to generate code that knows how to read and write data according to the schema that you define in a .proto file. You can then take that generated code and add it to your iOS project, and after that you can use the code to read and write protobuf data that matches your schema.
I am making an app that shows the real-time location of local buses.
So before you can get started, you're going to need a .proto file that describes the data format used by whoever provides the bus location data, or you'll need whoever provides that data to use SwiftProtobuf or similar to generate a Swift parser for their .proto file.
...I have no idea why we can't parse them like JSON file.
Well, the point of the protobuf format is to be language-agnostic and faster/easier to use than JSON or XML, and one of the design decisions that Google apparently made is to sacrifice human readability for size/speed. So you could write a parser to parse these files just as you would JSON data, but you'd have to learn how the format works. But it's a lot easier to describe the data you're sending and have a program generate the code. One nice aspect of this arrangement is that you can describe the schema once and then generate code that works with that schema for several languages, so you don't have to write code separately for your iOS app, your Android app, and your server.

FTP with Swift 4/5 (with/without extra framework)

First of all: I know about the security concerns regarding ftp, so please no discussion about this here - ftp has to be used.
My app has to log into a server with ftp (with username/password), search for and download a file, delete it from the server, then upload an edited version.
I've been searching for tutorials on how to even get a connection to a server via ftp but all I found were Apple's documentation from 2012 here and their documentation about the different functions here (and a bunch of weird "Swift FTP" biking videos on youtube...). Every other example I found (usually <2015) uses some additional framework or library but there don't seem to be any proper tutorial for Swift 5 or even Swift 4.
Is it even still possible to use FTP with Swift 5 (is it still supported?) and if so, how? Or is there simply no point trying to get any of Apple's stuff to work and better to just use an extra framework like FileProvider?
At first I was using FileProvider, unfortunately the library is pretty buggy currently, with functions being called twice (which you can kind of prevent by using a "firstTimeCalled" bool check) and if the server's slow(-ish), you also might not get e.g. the full list of files in a directory because FileProvider stops receiving answers before the server's actually done.
I haven't found any other FTP libraries for Swift that work (and are still supported), so now I'm using BlueSocket (which is able to open sockets, send commands to the server and receive commands from it) and built my own small library that can send/receive,... files (using the FTP codes) around it.

Saxon CE 1.1 - Using result-document to create a output file

I've been playing with Saxon-CE_1.1 over the last few days and have managed to create a little application that allows users to classify pictures according to a data dictionary using a select dialog. All was going really well until I tried to use the result-document() function in it's "classic" way, to create a new file in the file system containing the choices the user has made.
XML Quire is returing with a severe error stating:
XpathException in mode: '{http:saxonica.com/ns/interactiveXSLT}onclick' event: [object MouseEvent]: Expected '?select=' ir '#' at start of result document href found "filename.xml
This error seems, to me, to be stating that I must pipe the results back into the HTML using # or ?select/
Is it still possible to create "external" output using SaxonCE? If so how can I accomplish the task.
Until recently it has not been possible to read or write files in the local client machine from Javascript code running in the browser, and if Javascript can't do it, then Saxon-CE can't do it either.
This may change soon with the HTML5 FileSystem API, but as far as I'm aware support for this is still very patchy. When it appears to be more stable and widespread, we can certainly look at implementing both doc() and xsl:result-document to access local filestore (or indeed, implementing the EXPath file module).

Send csv file through REST in rails

I have to send .csv file to remote server through REST in rails.
I had tried post_form of Net::HTTP and made form as multipart true, by this file get transfer (seen in parameters at both side) but at server side i am not able to read it.
It gives error "No such file or directory."
Please any can tell me is there other way to transfer file.
After finding on this and tried many things i got good solution from that i can send csv file by REST web service.
here is solution...
https://github.com/jwagener/httmultiparty
Also can use REST Client for testing purpose.

Creating BlackBerry method stubs using wscompile on WSDL from ColdFusion

I have been working on a BlackBerry application that consumes web services from ColdFusion 7. The Java ME SDK and the Java Wireless Toolkit both require that the generated WSDL be of the document/literal type.
Fortunately, I have input on the web service development so I tried setting 'style="document"' in the cfcomponent tag. This generated a document/literal style WSDL but now wscompile generates the following errors in several places:
Found unknown simple type: javax.xml.soap.SOAPElement
Found unknown simple type: java.util.Calendar
Any ideas why this is happening?
The WSDL does get parsed correctly by the JWSDP tool but the stubs use namespaces that are not available in the J2ME platform. I would have thought ColdFusion WSDL would work more easily with other products in the Java family.
If the service doesn't change much (so the WSDL won't change much) you can save the WSDL as a text file and modify it however you like. My suggestion -- again, assuming the service is more or less finalized -- would be to take the style declaration out of the cfcomponent tag and generate the WSDL, then save it as a plain text file and modify it as necessary to be consumed by the BlackBerry application.
It turns out that the issue was related to the data types of method parameters and return types that was causing the issue. The WSDL was valid and the version of wscompile for J2SE was able to parse it correctly. But due to the reduced API capabilities on the mobile platform, certain data types cannot be parsed with the J2ME version of wscompile.
I did need to keep the 'style="document"' declaration in the cfcomponent tag on the ColdFusion web service since the stub generator for J2ME will only parse document/literal type WSDL files.
http://developers.sun.com/mobility/midp/articles/webservices/ provides a reference for the data types supported in JAX-RPC for Java ME.

Resources