AXL API - Extremely long processing time of CS file - c#

Just need a point in the right direction with this one.
I've created the Cisco Unified Call Manager API via the instructions provided by Cisco, the API for CUCM is called AXL.
It's currently in my C# WPF project and works just fine (i've retrieved some phone data successfully), the issue is that the API is in a single CS file that's 345K lines long. This is causing an extremely long delay when I attempt the first action using the API (after it has compiled).
As one user on the Cisco forum advised:
There is a very high chance that your problem is with the time that it takes the .net framework to generate the xml serialization assembly.
Pre-generate the xml serialization assembly when using AXL on .net and your first response will be MUCH faster.
I've tried to pre-generate it using the instructions from user brain backup in this thread. Unfortunately the first use of the API is still around ~45 seconds (it did reduce it by about a minute). I'm not extremely savvy with the debugging tools within Visual Studio so unsure how to check what exactly is causing the issue (but it certainly looks like an issue related to generating the XML).
I was wondering if anyone could recommend of a way to remove the unnecessary methods from the CS file (99% of it won't be used anyway) without having to manually re-create it. Any type of tool that can pull/delete methods and their dependencies from a CS file would be absolutely brilliant.

There is a way to check whether you method has been used or not and if used how many times and where check this out.
https://visualstudiomagazine.com/Blogs/Tool-Tracker/2014/12/Finding-Method-Property-Variable.aspx

It might make sense to pare the AXL WSDL itself and re-compile - as mentioned, it's unlikely you'll ever use anywhere near the whole schema.
You should be able to just edit AXLAPI.wsdl and remove all of the and elements except for the items you are actually useing.

Had the same issue, it was almost unusable with the delay. Two things that I have found to get around this with almost instant results.
Don't use the WSDL. Write your own methods to handle SOAP requests. Takes time and can be error prone but results are almost instant.
Use a tool that can handle large text files, like Notpad++ to open your WSDL generated code file and take only what methods out that you need. This is the method I've choose and it works great.
Also, I believe you could just use the executeSQLQuery methods and cut out a good portion of the rest of the code but I've yet to try it. Each method above I have tried without pregenerating the xml serialization. I found the problem to be with the generated C# axl code file size.

Related

Early Bound Class Generation, how to make seperate files with CrmSvcUtil?

We're in the process of upgrading from CRM 2011 to CRM 2016 and as such are rewriting and restructuring quite a lot of our back end code. One of the things we'd like to do is move the Early Bound classes from one gigantic file with all of the classes in, to a single class per file.
I know this was available in CRM 4.0, and that it's doable via the XrmToolBox using the Early Bound Generator plugin, but I can't figure it out for the life of me!
Here is my command line for running CrmSvcUtil:
"C:\CRM_SDK\sdk\bin\crmsvcutil.exe" /url:http://XXX/XRMServices/2011/Organization.svc /o:"C:\CRM_SDK\sdk\Bin\Entities" /n:XXX.crm /serviceContextName:XrmServiceContext /domain:XXX /username:XXX /password:XXX
Currently this just outputs 1 file, but I want somewhere in the region of 250 files!
Any help would be appreciated!
The Early Bound Generator has custom code that runs as a part of the write process of the CrmSvcUtil that splits apart the file, post generation. There is no supported method for doing it via the CrmSvcUtil without custom code. Any reason you don't just use the Early Bound Generator? You can run it in command line mode if you're wanting to make it part of the build process. It actually spits out the required command line when you generate the entities/optionsets/actions.

Custom WMS Service

I'm doing an program, which is running on an local system, with no internet access. Is it possible to create my own custom Web Map Service (WMS) server, using C#. I no that there are free open source system's. But i like to have full control.
Thanks Morten Starck
That is very possible, but you might be in for a headache or two before you are done. The implementation specification and more is available from the Open Geospatial Consortium at the url below.
http://www.opengeospatial.org/standards/wms
It's quite a large specification but you might be able to get away with implementing only the parts you really need and leaving some of the more specific stuff out. You will of course also need to parse and render the map data from some source which might be your largest problem (for which I really would suggest you have a look at SharpMap, http://sharpmap.codeplex.com/ instead of rolling your own).

Best way to record method calls to a file in C#/.NET?

I'm trying to write a visualiser for some code which generates graphics for barcodes and labels. The way I want to do this is by recording the methods+parameters being run to a file, so I can play them back and see the visual output generated at each stage (so a kind of visual debugger to help me fix issues with measurements in the drawing)
I have access to the methods, and I can put anything I like in them - but I'm stuck on the best way to record the method signature being called and the parameters, especially since a lot of them are overloads etc.
Is there anything simple that will help me serialize/record actual method call information? (with a view to replay it back, so I need to programmatically load the information and call it) Perhaps something reflection-related?
Note: I'm an intern on the project I'm working on, and I'm probably not allow to introduce new assemblies etc. into the build, so I think aspect-based things requiring libraries are out. (At the same time, I'm not just asking a Q. I should be figuring out myself - this is more an additional thing I'm doing during my lunch break to help my main task)
It might be a good idea to start from an existing profiler as a base - e.g. from http://code.google.com/p/slimtune/
Note that profilers themselves are quite complicated - for .Net they require some C++/COM knowledge - but if you start from a base like slimtune, then hopefully you'll be able to avoid this core code and will instead be able to focus on your own visualisation requirements.
Recording the method name itself is easy, parameters will be more difficult. I think the only way to generically retrieve the parameters is to use reflection--the alternative is to have an ungodly amount of logging code where you explicitly log every parameter.
Also consider that you'll need all parameters to be serializable, and depending on how you want the file to be used (by a program vs. human readable) you might have to implement quite a bit of boilerplate serialization code.
You should really consider existing profiling tools and testing tools rather than thinking of inventing something new. It sounds like performance tests or integration tests may be more valuable than a "playback" utility.

Help Conceptualizing XML HTTP POST Automation through Application Layer

For this post, I'm looking for more conceptual help than a specific technical solution (although anything helps).
Basically, I've been asked to automate an XML HTTP POST through an application layer. I've never done anything like this before, so I'm a bit confused where to even start on a high level. It would be great if someone could share with me what steps I would need to take to accomplish this task. Here is some more background information:
Currently, our company uses an application (we'll call it Program.exe) on a daily basis to design front-end interfaces with a visual editor. Once the interface is completed, Program.exe creates JSP files and submits them to the server. Unfortunately, the process of creating and sending the files takes an awfully large number of clicks, so management would like to automate this process by running a script that would take the project files from Program.exe, convert them to JSP and accurately submit them through the application layer of Program.exe to the appropriate server.
So far I have used WireShark to sniff the packets of a simple transaction using Program.exe and discovered a number of HTTP/XML POST packets that contained XML data with information like "Current File Name" "User name" and more. Curiously, all of these data items were submitted in different packets, not all in one. There are also multiple references to SOAP. (I have almost no knowledge of SOAP, except that it exists)
At this point, this is all of the information I have. I am unsure what steps I should take from here. I would really like to understand this process on a high level, so any conceptual information would be greatly appreciated.
Finally, we use C# primarily for these sorts of tasks, so if someone would like to share a technical solution feel free to use C#.
Thank you all very much.
I would tackle this by completely ignoring the expected method of solving the problem (generating an HTTP POST) and instead focusing on what the actual problem is.
What are your inputs? A bunch of JSP files by the sound of it.
What are your outputs? The same bunch of JSP files.
What has to be accomplished? Moving the inputs from one know location to another.
Now with a well defined problem, a solution is much more likely to clearly present itself.
For example, by looking at the problem I've defined I would think that XCopy would be an elegant solution to the problem.
Any time I get handed a solution and then told to go solve a certain problem, I am always highly suspicious of the tool I've been given. If they knew that this was the best solution to the problem, why didn't they do it themselves?
My advice: Find your own solution.
Hope that helps!

Migrating C# code from Cassandra .5 to .6

I have some some simple code derived from an example that is meant to form a quick write to the Cassandra db, then loop back and read all current entries, everything worked fine. When .6 came out, i upgraded Cassandra and thrift, which threw errors in my code (www[dot]copypastecode[dot]com/26760/) - i was able to iron out the errors by converting the necessary types, however in the version that compiles now only seems to read one item back, im not sure if its not saving db changes or if its only reading back 1 entry. the "fixed" code is here: http://www.copypastecode.com/26752/. Any help would be greatly appreciated.
First of all, let me say that you should definitly use TBufferedStream instead of TSocket for the TBinaryProtocol, that will make a huge impact on your application performance.
For the Apache Thrift API documentation that BATCH_INSERT methods is deprecated, so it could have introduced a misleading bug on that operation that actually only insert the first column. Said so, why don't you try to use BATCH_MUTATE instead?
By the way, why are you trying to use Thrift directly? There are some nice c# clients for Cassandra that are actually performing really well. You can find the whole list at http://wiki.apache.org/cassandra/ClientOptions.
I'm the author of one of them are is pretty much updated with Apache and its being used by some companies on production environment. Take a look at my homepage.

Categories

Resources