Using Endpoints in an iOS Client: What is "output of ServiceGenerator"? - java

I am following the instructions at https://developers.google.com/appengine/docs/java/endpoints/consume_ios to connect my iOS app to my app-engine endpoint. In subsection Adding required files to your iOS project at step 3 I got stuck because I don't know what also add the output of ServiceGenerator means. Will someone who has done this before please help?

You can obtain the output of ServiceGenerator following points 3,4 and 5 of Compiling the client library generator and generating your library
I'll try to explain how to do it and why:
before you can generate your iOS client library, you have to compile the tool that generates it, that's called ServiceGenerator.
To compile it, as said in the documentation, open the XCode project ServiceGenerator.xcodeproj and build the only target you have.
You'll use this tool from your terminal to generate your APIs, but for doing that you need an rpc-discovery document: a file containing some metadata that describes your APIs.
Here an example to generate a discovery rpc file from a terminal using the tool endpoints.sh
$ {your_path_to_appengine_sdk}/endpoints.sh get-discovery-doc -f rpc your.package.yourAPIclass
Then you can generate your API client files with ServiceGenerator:
{your_ServiceGenerator_path) your_rpc_discovery_file.rpc --outputDir {your_output_directory}
And of course... now you have to include the files in your iOS project!

Related

Business Objects 'bcm.jar' error when exporting Java app

I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:
java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM
I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth);
Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)
EDIT: I would be happy to provide clarification or further detail upon request!
Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.
Have you included the cryptojFIPS.jar? Leaving it out can cause the error.

WS02 generates POM but no source code

Having recently upgraded from WS02 3.1.0 to 5.2.1 I also upgraded the associated axis2 and rampart versions to 1.5 and 1.6.2 respectively.
The WSo2 server runs up and creates my list of services and they are all present on the WSO2 console page.
My problem is that, due to the upgrade (axis2), I now have to regenerate the stubs that support our test harness in order to test those services as some classes/interfaces have changed and methods (e.g. org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter) are no longer present.
According to the notes left by the originator of the current stubs I need to open the list of services and then copy the WDSL2.0 link. Then open the WDSL2Java page on "Tools", paste the link into the uri field, select the version as 2.0 and generate. This is broadly what the WSO2 help page suggests too.
However, when I follow this procedure, this generates a .zip file which contains only a single .POM file (which has a link to the WSDL file in it).
The "generate" page is showing a set of MAVEN information above it which doesn't appear on the help page explanation.
My project is not MAVEN based so my question is how to get the source files generated in the same manner as they were, seemingly, created with WSO2 version 3. The WSDL2.0 file opens when I enter the URL into a browser and contains the details of the associated classes/methods as expected so that seems to be OK.
Is there some configuration I can tweak to turn off the MAVEN POM generation?
Having spent over a day on this I would really appreciate any help.
Greg
Finally found a solution to this after much experimentation:
Start your services with WSO2
Login to the WSO2 console web page and list the services
From the WSDL2 column copy the link to the WSDL file
From the cmd line navigate to axis2/bin
Enter WSDL2Java -uri [paste the url of the WSDL file here] -sd adl -wv 2.0 -o [destination folder for the generated code here (optional)]

LatinIME dicttool for use with a V401 Binary Dictionary

I’m trying to convert a version 401 binary dictionary -- a directory called PersonalizationDictionary.en_US.dict -- to human readable .xml.
The command line utility dicttool_aosp in packages/inputmethods/LatinIME/tools/dicttool can do it like so:
dicttool_aosp makedict -s sourcedict.dict -x output.xml
I’m unable to compile the Android Lollipop version of dicttool, since dicttool has native C++ dependencies that don’t play nice with my Mac. Note this line in the NativeLib.mk file of dictool:
HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11.
I am hoping someone with a compatible setup can compile this utility for me using “make dicttool_aosp” from the root of the AOSP source tree. I've spent the past few days looking for compiled versions of it, and while I’ve found many makedict.jar files online, they are too old to support my newer V401 binary dictionary. The main difference between the V401 and older versions is that a V401 is split up into multiple files with extensions like .bigrams, .freq, .header, whereas the older dicts are contained in a single file.
Thank you, please let me know if I can clarify anything!

org.apache.axiom.om.util.AXIOMUtil cannot be resolved

I'm trying to generate some stubs for a WSDL (using xmlbeans) and keep running into some issues. I'm using the following page:
http://axis.apache.org/axis2/java/core/docs/userguide-creatingclients-xmlbeans.html
The only part of these steps that I'm skipping is the "client.java" part because I already have another project ready I want to plug the resulting jars into. A quick run down of my steps are as follows:
My WSDL is a crmonline instance, so I run something like this:
C:\Work\aaa2>WSDL2Java -uri
https://mycrmorgname.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl
-p crmsdk -d xmlbeans -s -o c:\mystubfolder
I build the project using "ant"
In my "client" project I reference the 2 jars created in .\build\lib
My project builds fine once I add all my axis2 / apache references etc, but when I launch it through playframework I get errors when I hit the first page. The first error seems to be:
17:48:45,289 ERROR ~ Error in ControllersEnhancer.
controllers.ProfileController.editProfile has not been properly enhanced
(fieldAccess javassist.expr.FieldAccess#212ca458).
or something similar to that. Scrolling down through the error I can see that I'm getting this:
The file /app/models/MyDynamicsClient.java could not be compiled.
Error raised is : org.apache.axiom.om.util.AXIOMUtil cannot be resolved
Now, I haven't even hit any of my web services yet, or even instantiated any of my classes ... I'm at a loss as to why this is happening. Or to be more accurate, what exactly am I messing up! Am I missing a reference to something? Doing a search on AXIOMUtil tells me this should be in Axiom-api (version I have is Axiom-api-1.2.10.jar). I have this referenced and doesn't seem to help. Or maybe I'm doing something else wrong someplace?
Some details on versions:
Axis2 1.5.4
Apache-ant 1.8.3
Any help would be very much appreciated!!
Ok, after trying a lot of different things and rereading the sites/instructions I realised what I was doing wrong. Or at least I figured out a couple of things that I started to do differently that fixed the problem.
Firstly, I was using jar files from another sample project for the apache http components. I don't know if this had an impact, but I downloaded a fresh version of this anyway and referenced those JARS instead.
Also, instead of creating jars in my "stub" project and referencing those I copied all the generated stubs/classes directly into the existing client project. I have a feeling this might have been what fixed my problem. Or maybe a mix of this and the previous step I did!
So my new steps are as follows:
Ensure you have all the correct versions downloaded for required components. In my case I have the following:
Apache Axis 2 v 1.5.4
Apache HTTP components client 4.1.3
Apache-ant 1.8.3
Copy all the JARS from the Axis2 and HTTP Components libs into your client project and reference them.
Use WSDL2Java to create your stubs and classes within it's own project.
Ensure the project builds using Ant
Copy all the generated class files within the src folder into the source folder of your client.
Fix any other reference isssues and Build
Thankfully this got me going.

Amazon Product Advertising API does not Match Documentation (Java)?

Hey all, got a question. I'm using the tutorial for Amazon Product Advertising API (here) for Java. I've generated the client code via the WSDL they provide. When going through the code for an ItemLookup, I get to a section where I reference AWSECommerceServicePortType.itemLookup() by passing in an ItemLookup object, I get a compile error. It seems that .itemLookup() is actually looking for quite a number of params - in other words, the method signature does not match the tutorial. What am I missing? Thanks in advance!
To generate the Product Advertising API Client Side Library stubs
1. Go to the directory where you want to generate the stubs and create a "build" directory and a "src" directory. All of the generated source code will go under the "src" folder.
2. Create a custom binding to disable "Wrapper Style" code generation.
<jaxws:bindings
wsdlLocation="http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
This step is necessary because the IDE does not support wrapper style generated code.
3. Run the command:
wsimport -d ./build -s ./src -p com.ECS.client.jax http://ecs.amazonaws.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml .
You can find the generated stubs in the path, com.ECS.client.jax .
Extract from the docs (page 10 from the pdf file)

Categories