embedded-file on PDF generation fails with 403 - apache-fop

i try to embedd some files into the pdf using Apache FOP.
So far so good. But the attachements are only available using basic auth.
When i run my code i get an exception
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://sample.atlassian.net/rest/api/3/attachment/content/10015
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1997)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at java.base/java.net.URL.openStream(URL.java:1161)
at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:224)
at org.apache.fop.apps.io.ResourceResolverFactory$TempAwareResourceResolver.getResource(ResourceResolverFactory.java:152)
at org.apache.fop.apps.io.ResourceResolverFactory$DefaultResourceResolver.getResource(ResourceResolverFactory.java:121)
at org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)
at org.apache.fop.render.pdf.PDFRenderingUtil.addEmbeddedFile(PDFRenderingUtil.java:668)
at org.apache.fop.render.pdf.PDFDocumentHandler.handleExtensionObject(PDFDocumentHandler.java:329)
The embedding code looks like
#foreach($attachment in $issue.attachments)
<pdf:embedded-file filename="${attachment.id}-$xmlutils.escape($attachment.fileName)" src="url(${attachment.url})"
description="Attached to [$xmlutils.escape($issue.key)]"/>
#end
is there anything i could do, i could download the files and provide them as lokal files if that is possible? or could i provide an custom resource resolver, that also does authentication?
Help is appreciated
Regards
Oliver

Related

While running recorded simulation in Gatling, I got file not found error

now I'm trying to conduct load test with gatling.
I have been trying create gatling's simulation script via gatling recorder and
it was going well.
but, when I executed that, I encountered file not found error below although there are files
(in this case /step1/0006_request.json is exist)
request_6: Failed to build request: Resource /step1/0006_request.json not found
there are many json files and that error occurred some of specific post requests.
every requests which is failed are composed following setting.
using request header 'headers_6' below
using RawFileBody method
(even if this is obvious thing because content-type is 'application/json')
I already have been using 12 hour over and I have to finish my task in a timely manner.
I'm so sorry about that I can't share my application which is target of this issue.
if anyone have any idea or kindly want to more detail please ask me.
val headers_6 = Map(
"Content-Type" -> "application/json",
"Origin" -> "applicationServerURL")
.exec(http("request_6")
.post("requestUrl")
.headers(headers_6)
.body(RawFileBody("/step1/0006_request.json"))
.resources(http("request_7")
additionally, I checked json files which were created by gatling recorder on 'resource' directory, them contains only one char 'X'.
this means Gatling recorder doesn't capture request json file's content?
env:
Gatling version gatling 3.5.1
Used Browser: FireFox
I just solved this issue.
this issue was caused by very simple fact.
firstly, I encountered error message below
request_6: Failed to build request: Resource /step1/0006_request.json not found
and I have to check the file paths although this script was auto created by gatling recorder(do not trust gatling tool).
The auto created file path was absolute path and start with ‘/’. And the script started to work once I remove the ‘/’.
I referred other post on stack overflow, and it was written that file path must be written with absolute path if you are using gatling version 3 or later version.
I hope my reply can be informative to someone who may be having same issue as me.
Using 'relative path'.
//As is
.exec(http("request_6")
.post("requestUrl")
.headers(headers_6)
.body(RawFileBody("/step1/0006_request.json"))
.resources(http("request_7")
//To be
.exec(http("request_6")
.post("requestUrl")
.headers(headers_6)
.body(RawFileBody("step1/0006_request.json"))
.resources(http("request_7")

SOAP API Automating testing with ROBOTFRAMEWORK

Good day,
I am trying to use robot framework to test a soap based api. I tried using the RobotFramework-Soap library first. I tried a sample case and it works but as soon as I put in my api link it does not work. Im not sure if it is because my api link contains an api.
N.B. due to confidentiality I am unable to post the actual api link. But it is in the format shown below.
*** Settings ***
Library SoapLibrary
Library OperatingSystem
*** Test Cases ***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
${response} Call SOAP Method With XML ${CURDIR}/request.xml
${text} Get Data From XML By Tag ${response} AddResult
Log To Console ${text}
Save XML To File ${response} ${CURDIR} response_test
When I run the above test. It fails with following error:
ConnectionError: HTTPConnectionPool(host='xxx_cert', port=8000): Max retries exceeded with url: /SomeService?xsd=xsd0 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
I even tried using the suds library as well. and when i do a simple test as follows:
***Test Cases***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
I get the following error: URLError: urlopen error [Errno 11001] getaddrinfo failed
I did some searching and I found that it could be related to the port. But Im not sure how to resolve this issue.
Any assistance would be greatly appreciated.
Thanks,
Lee
The solution was to edit the local host file to cater for the web service. That seemed to solve all the problems.

Setting up SimpleSAMLphp as a SP for CodeIgniter

I have to continue on an already existing CodeIgniter 3 application (not written by me) which contains multiple applications for different customers, the project structure looks a little like this:
root/
applications/
customer1/
config/, controllers/, models/, views/, ...
third_party/
SimpleSAMLphp/
config/, metadata/, www/, ...
lib/
_autoload.php
customer2/
...
assets/, bundle/, ...
customers/
customer1/
assets/, index.php, ...
customer2/
...
system/
vendor/
composer/
autoload.php
Now for one of the applications I have to replace the ion_auth system with an SSO (setup as a Service Provider from their IdP metadata). I googled a lot and tought SimpleSAMLphp would be my best option.
But I am really struggling just even putting the SimpleSAMLphp SP API into my application and the documentation isn't great.
-I "include_once" the third_party/SimpleSAMLphp/lib/_autoload.php file in the customers/customer1/index.php file (before require_once BASEPATH...)
-I modified third_party/SimpleSAMLphp/lib/_autoload.php so it finds the vendor/autoload.php file
I expect to be able to use the methods of the SimpleSAMLphp library but instead I get the following errors:
-If I follow the code in this guide:
Fatal error: Call to undefined function SimpleSAML\Auth\Simple()
-If use include APPPATH . 'third_party\SimpleSAMLphp\www\index.php in my controller just above the code from above tutorial:
Fatal error: Class 'SimpleSAML\Error\Assertion' not found in
What am I doing wrong in my setup?

Can I use a URL with CFZIP action=read?

When I use Coldfusion 10, locally, I can read a zip file's text file content using:
<cfzip action="read" file="http://someurl.com/somezip.zip" entrypath="sometext.txt" variable="somevar" />
But on my Railo VPS, this produces an internal server error 500 on IIS7.5
Can anyone tell me where I am going wrong with Railo?
Not sure about Railo, but according to the <cfzip> doc, ACF does not support reading off http://, only ram://. You should use <cfhttp> to download the content first.

The resource not available error in eclipse ,jsp and tomcat and mysql

I am using eclipse indigo(javaEE) and apache tomcat 7.0.23. the jsp code
pstatement = connection.prepareStatement(queryString);
pstatement.setString(1, name);
pstatement.setString(2, city);
pstatement.setString(3, phone);
updateQuery = pstatement.executeUpdate();
is giving error as the requested resource jsp1/prepared_statement_query.jsp is not available.
The simple .jsp file executes properly and shows the successful connection, but not for insertion into the database. I am not getting whether there is problem with the database connection or the running of the server?
Is it any kind of 404 error? is the file "prepared_statement_query.jsp" not in the place where it should be?
If the error is - "404 Requested Resource Not Found" then find the file in proper place.
And Kindly post the complete stack trace for better understanding of the issue.