These are my environment variables:
System variables:
JAVA_HOME C:\Program Files\Java\jdk1.8.0_20\
Path:
...;C:\Program Files\Java\jdk1.8.0_20\bin;...
I key the following in the command line:
c:\wsimport>wsimport http://www.webservicex.net/geoipservice.asmx?WSDL -Xdebug
I receive the following message
[DEBUG] Authorization file "C:\Users\myPC.metro\auth" not found. If
the WSDL access needs Basic Authentication, please provide
authorization file with read access at C:\Users\myPC.metro\auth or
use -Xauthfile to give the authorization file and on each line
provide authorization information using this format : http[s]://user:password#host:port//
parsing WSDL...
Where my configuration is incorrect?
I am not sure what happened but it's working now. It seems like my issue was perhaps related to my internet connection. I was online but the connection was pretty slow. Now everything's back to normal and my wsimport command is working.
Related
I have a problem connecting to an old project HSQLDB (need to migrate it to MySQL). The DB is standalone, file based. I'm using hsqldb-2.4.0 to connect.
Tried to follow all instructions and this forum tips to no avail. Getting authorization error java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification
This is what I do
1) start service
java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:db.hsqldb -dbname.0 xdb
--> seems to start correctly
2) trying to connect
java -cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --driver org.hsqldb.jdbcDriver --URL jdbc:hsqldb:hsql://localhost/xdb --user "SA"
--> invalid authorization
My understanding from the script is that a default username/password (SA/no password) was used:
CREATE USER SA PASSWORD DIGEST '67a2fc38c682b3d55125dbc9d0bd26a3'
(not sure how to check it otherwise)
Any help/ideas are greatly appreciated.
The DIGEST is not for the default, empty string, password. Before starting the server, edit the .script file and change the digest to 'd41d8cd98f00b204e9800998ecf8427e', which is the digest for empty string passwords.
In the Java API example they create a Datastore by using DatastoreHelper.getOptionsfromEnv
But this creates the warning
WARNING: Not using any credentials
and leads ultimately to:
DatastoreException(null): beginTransaction 401
I set my environment variables to the following:
export DATASTORE_DATASET={Project-ID}
export DATASTORE_HOST="https://www.googleapis.com/datastore/v1/datasets/{Project-ID}"
export DATASTORE_SERVICE_ACCOUNT="{email address}"
export DATASTORE_PRIVATE_KEY_FILE="{path to local p12 keyfile}"
But still when I try to see what the credentials are:
println("Datastore helper: " +DatastoreHelper.getOptionsfromEnv
.dataset(datasetId).build().getCredential)
I get null, what could be missing?
Also is there either a way to set the Credentials inside the project (instead of using the getOptionsfromEnv)?
The problem was that even though I used
source ~/.bash_profile
to refresh my environemnt variables and the echo command showed me that they were indeed updated, apperently I needed to restart my terminal (using Mac OSX) for them to be also updated for sbt and Scala.
I am not sure why this is the case and if this is Scala specific but now I managed to authenticate and communicate with the server.
I managed to figure it out by using the local installation of the Datastore Server and continuing to have the same problems.
Trying to learn the Java interface to Xively. The following simple test fails with a 401 status code:
Feed myFeed = XivelyService.instance().feed().get(2126903832);
The exception statement is
com.xively.client.http.exception.HttpException: Http response status
indicates unsuccessful operation[Status code: 401.; Reason:
{"title":"Unauthorized","errors":"You do not have permission to access
this resource"} ]
The following console line leads me to believe that I'm not setting up the API key correctly:
2013-10-21 18:58:17,925 506 DEBUG [DefaultClientConnection.java:
276] (main:) >> X-ApiKey:
The Developer docs says replace <your api key> in config.properties with my API key. I did that, but it doesn't seem to make any difference.
I installed the library with Maven to my default Maven repo and point to it in Referenced Libraries. I am trying to build the whole thing in Eclipse.
My specific question is where is the config.properties the ApiConfig is reading?
I had this problem too. The problem was that I had double quotes in the config.properties file. The line should read:
api.key=yWYxyi3HpdqFCBtKHueTvOGoGROSAKxGRFAyQWk5d3JNdz0g
I trying to figure out how to write CGI scripts in Java.
I followed this examples -> http://www.javaworld.com/jw-01-1997/jw-01-cgiscripts.html?page=1
It provide cgi_lib.java, hello.html and hello.java
Everything seems fine, but in the html part.
The action is pointed to cgi_lib/hello.cgi
There's no cgi provided. So I tried with cgi_lib/hello.java, and it print the entire source code in the hello.java.
Then i tried to edit the hello.java extensions into hello.cgi, and tried again.
The browser returns me error 500.
What is the problem?
Is it that, there's some specific method to compile the hello.java into hello.cgi?
The script in hello.cgi is different from hello.java?
Please help.
Thank you.
UPDATE
I added hello.cgi
#!/bin/sh
java -Dcgi.content_type=$CONTENT_TYPE -Dcgi.content_length=$CONTENT_LENGTH - Dcgi.request_method=$REQUEST_METHOD -Dcgi.query_string=$QUERY_STRING -Dcgi.server_name=$SERVER_NAME -Dcgi.server_port=$SERVER_PORT -Dcgi.script_name=$SCRIPT_NAME -Dcgi.path_info=$PATH_INFO hello
So is the $CONTENT_TYPE, $CONTENT_LENGTH,... remain the same? Or should I enter something?
Just to make things clearer.
I put the the cgi_lib, hello.java and hello.cgi in the C:\xampp\cgi-lib
And the hello.html in C:\xampp\htdocs\test
When I tried to connect it returns me this
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
couldn't create child process: 720002: hello.cgi
If you think this is a server error, please contact the webmaster.
Error 500
localhost
Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
I had check the httpd.conf in c:\xampp\apache\conf and configure according to this
LoadModule cgi_module modules/mod_cgi.so
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
Seems to be already enable.
So whats the problem right now?
The contents of hello.cgi is shown at the top of page 2 of the article.
#!/bin/sh
java -Dcgi.content_type=$CONTENT_TYPE -Dcgi.content_length=$CONTENT_LENGTH -Dcgi.request_method=$REQUEST_METHOD -Dcgi.query_string=$QUERY_STRING -Dcgi.server_name=$SERVER_NAME -Dcgi.server_port=$SERVER_PORT -Dcgi.script_name=$SCRIPT_NAME -Dcgi.path_info=$PATH_INFO hello
The article says that you will execute the java jar from within a cgi script. You need to make sure that this script is set up to execute your jar file by making the correct calls to the java executable with your hello.jar file as the parameter. Also make sure your web server is configured correctly to allow the execution of cgi scripts.
You also have to chmod of your cgi and java files so others can execute them.
I am trying to generate the java help classes that I need for a client (a.k.a consumer) for a SSL-protected web service (on Microsoft Biztalk) that is external to our company network. We can access it only over a proxy and we cannot change anything about the Webservice itself.
This is my command provided to the wsimport tool:
wsimport -keep -httpproxy:theProxy.net:8080 -s c:\generatedWebService_wsImport\ -p the.java.package.I.want.to.call.it -Xauthfile c:\generatedWebService_wsImport\auth https://meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
and this is the content of my auth file:
https://user:pwd#meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
And this is the error I get:
[ERROR] Server returned HTTP response code: 401 for URL: https:
//meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL,
"https:
//meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL"
needs authorization, please provide authorization file with read
access at C:\Documents and Settings\s6424.metro\auth or use
-Xauthfile to give the authorization file and on each line provide authorization information using this format :
http[s]://user:password#host:port//
Of course the proxy and credentials are different as in this post. The password contains a special character ! (exclamation mark).
Can someone help me with a working example under similar conditions. I had already searched a lot but couldn't find anything that would have helped me.
Is there somewhere a downloadable source code of the wsimport tool? This would be as the last resort to use.
Try to open https://user:pwd#meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
with your browser and save to local folder. Later you can use a wsimport like this:
wsimport -keep -s c:\generatedWebService_wsImport\ -p the.java.package.I.want.to.call.it /home/user/Download/example?WSDL
Regards,
in your request, you used
https://meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
in your auth file, it is
meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
try removing the port number, change it to
https://user:pwd#meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL