Q) Should I bundle and upload message-flow.jar and expressions.jar with my JavaCallout or can I expect the API is already present in the Apigee runtime? I believe I read somewhere in the documentation I have to upload them, but I cannot really believe this (you also would not package the servlet API with a .war file). So I request clarification ??
No, you should not include message-flow.jar and expressions.jar with your bundles that use Java callouts.
You can see this in the cookbook example, as well as every other Java callout example. None of them bundle those JARs.
Also, the documentation page says this:
- If your Java Callout relies on additional third-party libraries packaged as independent JAR files, then place those JAR files in the
/resources/javadirectory as well to ensure that they are loaded correctly at runtime.
@Dino where is /resources/java
Yes, in your api bundle.
I can’t find the documentation for the structure of an API Proxy bundle file. I believe it’s documented, but I couldn’t find it when I searched just now.
In the absence of that, here’s an example.
Length Date Time Name
--------- ---------- ----- ----
0 09-21-2020 20:52 apiproxy/
342 11-14-2018 10:52 apiproxy/totp.xml
0 09-21-2020 20:52 apiproxy/resources/
0 09-21-2020 21:05 apiproxy/resources/java/
10660 09-21-2020 21:05 apiproxy/resources/java/apigee-google-authenticator-totp-20200921.jar
5827 09-21-2020 21:05 apiproxy/resources/java/java-otp-0.2.0.jar
0 09-21-2020 20:52 apiproxy/policies/
423 09-21-2020 20:52 apiproxy/policies/Java-TOTP-Test-sha1.xml
480 09-21-2020 20:52 apiproxy/policies/Java-TOTP-Test-sha512.xml
306 11-14-2018 15:15 apiproxy/policies/AM-GenerateResponse.xml
480 09-21-2020 20:52 apiproxy/policies/Java-TOTP-Test-sha256.xml
431 11-14-2018 15:14 apiproxy/policies/RF-InvalidRequestMissingTotp.xml
421 05-30-2017 08:45 apiproxy/policies/RF-UnknownRequest.xml
683 09-21-2020 19:40 apiproxy/policies/AM-Variables.xml
327 09-21-2020 20:52 apiproxy/policies/Java-TOTP-1.xml
278 11-14-2018 15:15 apiproxy/policies/AM-VerifyResponse.xml
409 11-14-2018 15:14 apiproxy/policies/RF-InvalidTotp.xml
447 11-14-2018 15:14 apiproxy/policies/RF-InvalidRequestMissingFakeTime.xml
167 12-06-2017 08:53 apiproxy/policies/AM-CleanResponseHeaders.xml
0 11-14-2018 15:15 apiproxy/proxies/
3764 11-14-2018 15:15 apiproxy/proxies/endpoint1.xml
--------- -------
25445 21 files
The JAR files belong under apiproxy/resources/java . The main jar file for your callout goes there, as well as any dependencies the callout relies on.
Ref: https://docs.apigee.com/api-platform/samples/cookbook/how-create-java-callout
- If you wish, verify that the JAR file
edge-custom-policy-java-hello.jarwas copied tojava-hello/apiproxy/resources/java. This is the required location for JAR files that you wish to deploy with a proxy.
Can I use a . war file in java callout policy instead of. Jar file?
No. JAR file.