Maven cxf-codegen-plugin with NTLM Authentication - fails with java.io.IOException: Server returned HTTP response code: 401 for URL - cxf

I'm trying to generate java code using cxf-codegen-plugin for a SOAP webservice that is secured over NTLM. I'm not sure how do pass on the username/pwd/domain information to maven to connect to the remote server while generating the java code. I could open the wsdl using the browser using the username/pwd/domain combination I have. However, I'm wondering how to do it via command-line by passing some extra vm args to - mvn package. Or is there any other plugin config that I can do which helps me to do this?

Related

Connecting to an external HTTP api behind a proxy from nifi

I have a apache/nifi:latest instance spun inside an Amazon Linux 2 EC2. For reference, see this guide: here
I have a QuerySalesforceObject ver. 1.18.0 that makes use of StandardOauth2AccessTokenProvider.
The oauth2 provider url is configured at https://test.salesforce.com/services/oauth2/token
I can curl this url from the box and from inside the docker container just fine (I don’t get a timeout).
[root#ip-10-229-18-107 \~\]# docker exec -it nifi_container_persistent /bin/sh
printenv | grep -i proxy
HTTPS_PROXY=http://proxy.MY_DOMAIN.com:3128
no_proxy=localhost,127.0.0.1,MY_DOMAIN.com,.amazonaws.com
NO_PROXY=localhost,127.0.0.1, MY_DOMAIN.com,.amazonaws.com
https_proxy=http://proxy.MY_DOMAIN.com:3128
http_proxy=http://proxy.MY_DOMAIN.com:3128
HTTP_PROXY=http://proxy.MY_DOMAIN.com:3128
curl https://test.salesforce.com/services/oauth2/token
{"error":"unsupported_grant_type","error_description":"grant type not supported"}#
But when I run the task, oauth2 fails with an error
java.io.UncheckedIOException: OAuth2 access token request failed
Caused by: java.net.SocketTimeoutException: connect timed out
This leads me to believe the proxy settings are not being honored by the class. How can I fix this?
Here’s more info on this class: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-oauth2-provider-nar/1.17.0/org.apache.nifi.oauth2.StandardOauth2AccessTokenProvider/index.html
The standard way to interface with HTTP resources with a proxy in Nifi is via StandardProxyConfigurationService: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-proxy-configuration-nar/1.19.1/org.apache.nifi.proxy.StandardProxyConfigurationService/index.html
If a component does not have this property, then it means it does not support it.
You can try bootstrapping proxy settings into nifi with /opt/nifi/nifi-current/conf/bootstrap.conf. But there is no standard and support of proxy is not guaranteed. Implementation (bugs and all) depends on the library. aws-java-sdk ver. 1x, for example, has a bug where nonProxyHosts is not honoured. https://github.com/aws/aws-sdk-java/issues/2797
java.arg.18=-Dhttp.nonProxyHosts="foo|localhost|*.bar.org"
java.arg.19=-Dhttp.proxyHost=proxy.foo.com
java.arg.20=-Dhttp.proxyPort=123
java.arg.21=-Dhttp.proxyUser=foo
java.arg.22=-Dhttp.proxyPassword=bar
java.arg.23=-Dhttps.nonProxyHosts="foo|localhost|*.bar.org"
java.arg.24=-Dhttps.proxyHost=proxy.foo.com
java.arg.25=-Dhttps.proxyPort=123
java.arg.26=-Dhttps.proxyUser=foo
java.arg.27=-Dhttps.proxyPassword=bar

Using embedded jetty with camel-cxf

I have a couple of rest routes defined in my Camel project and now I'm trying to add a SOAP service to my project using the same jetty embedded server.
I have something like this:
restConfiguration()
.component("jetty")
.host("0.0.0.0")
.port(8080)
;
CxfEndpoint cxfEndpoint = new CxfEndpoint();
cxfEndpoint.setCamelContext(getContext());
cxfEndpoint.setServiceClass(TestService.class);
cxfEndpoint.setAddress("http://0.0.0.0:8080/test");
from(cxfEndpoint)
.log(LoggingLevel.INFO, log, "test");
When I try to run the application, I get this error message:
Web server failed to start. Port 8080 was already in use.
Look like it's trying to start 2 instances of Jetty using the same port and that's why it's failing.
I would really like to make the cxf endpoint work with the embedded Jetty used for my other services. Is there any way to do that?

Not able to integrate versionone with bugzilla

I am facing error during bugzilla integration with versionone.
C:\Apache24\htdocs\bugzilla-4.0.15\bugzilla\extensions>perl TestV1Service.pl http ://bugmachine/bugzilla-4.0.15/bugzilla/index.cgi username#gmail.com secret
Connect to Bugzilla instance located at http: //bugmachine/bugzilla-4.0.15/bugzilla/index.cgi
Using Credentials username#gmail.com/secret
Can't call method "paramsall" on an undefined value at TestV1Service.pl line 77.
C:\Apache24\htdocs\bugzilla-4.0.15\bugzilla\extensions>
Process of integration:
Downloaded V1BugzillaIntegration.8.3
renamed V1BugzillaIntegration.8.3\BugzillaScripts\4.0.x\Bugzilla\extensions\V1Integration folder to
to V1
Copied V1 to C:\Apache24\htdocs\bugzilla-4.0.15\bugzilla\extensions
System :
bugzilla version 4.0.15
perl 5.16.1
OS windows7
SOAP-Lite
Test-Taint and
JSON-RPC are installed.
You are not hitting the right xmlRpc endpoint. The goal of running TestV1Service.pl is to test your XMLRpc Web services. You have
http: //bugmachine/bugzilla-4.0.15/bugzilla/index.cgi Likely your main BZ page.
Try and hit
http: //bugmachine/bugzilla-4.0.15/bugzilla/xmlrpc.cgi instead.
You could also get the latest VerisionOne/Bugzilla integration which is 8.4.2. This works with up to BZ 4.4.

Google App Engine Bulkloader “Authentication Failed”

I'm trying to use the bulkloader to load my data to the App-Engine server. I run the following command using Python 2.5:-
appcfg.py upload_data --application=myappname --kind=mykind
--filename=data_archive.csv --url=http://myappname.appspot.com/remote_api
But its failing with this Authentication error:-
[INFO ] Connecting to myappname.appspot.com/remote_api
[ERROR ] Exception during authentication
URLError: <urlopen error [Errno 10061] No connection could
be made because the target machine actively refused it>
[INFO ] Authentication Failed
My idea is to do a bulk download from my development server and then use this dump to do a upload to the app-engine server. The bulk download worked fine. I used this format for this:-
appcfg.py download_data --application=myappname --kind=mykind
--url=http://localhost:8888/remote_api --filename=data_archive.csv
But the bulk upoad fails. A couple of things: the bulk download asked me for a userid and password, but the bulk upload does not. Also, I don't currently have a app.yaml file which I see mentioned a lot - do I need one to do this ?
Thanks in advance for any help.
M.
EDIT
For anyone else struggling with this, the problem was indeed being behind the proxy server, but there was another 'error' with what is above. The app-id needs the "s~" bit added to it.
appcfg.py upload_data --application=s~myappname --kind=mykind
--filename=data_archive.csv --url=http://myappname.appspot.com/remote_api
This isn't an authentication issue - that message is a red-herring - your machine is unable to contact the App Engine app at all. Do you have a proxy you need to transit through in order to make external connections?
You do not need --application=s~myappname when using bulkloader - Google have mentioned before:
Warning! Do not use the --application= flag to get the application ID
when using the bulk loader. Instead, use --url=.
For more detail take a look here:
https://developers.google.com/appengine/docs/python/tools/uploadingdata
app.yaml is how it finds your server. I am not sure how you can try and upload without one.
In addition to having an app.yaml that points to the production server, the production server also needs to have remote_api turned on (in it's app.yaml and in the version you are trying to reach):
builtins:
- remote_api: on

WSDL2Java tool error Apache CXF

We get the following error when we use WSDL2Java tool to generate stubs. The webservice is up and running.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsd
l definition from : http://scheduler.heartbeatsoftware.com/scheduler/WebServices
/SampleSNMWebService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.IllegalArgumentExce
ption: InputSource must have a ByteStream or CharacterStream
If we donwload the wsdl and generate stubs from that wsdl, they are generated. But the java client using those stubs throws the same exception as above
Strangely when we deploy the same webservice on our LAN such a problem is not encountered stubs are generated sucessfully and the subsequent java client works well.
The webservice is created using apache cxf version 2.2.5 and hosted on tomcat 6
Any pointers would be appreciated
regards
Sameer
Found solution. Just need to modify the wsdl.java.bat to include proxy settings
-Dhttp.proxyHost= -Dhttp.proxyPort=8080

Resources