Configuring W3C's Unicorn to use a proxy server - java

I've been trying to setup W3C Unicorn on Ubuntu 10 using Tomcat6 but running into a few problems with proxy servers.
I've got Unicorn configured (via tomcat) to use a proxy server using java's -Dhttp.proxyHost and -Dhttp.proxyPort. This works fine and Unicorn is able to download the files it needs.
The problem is that we're trying to use it to validate content on an internal network which requires bypassing the proxy server. I've tried using -Dhttp.nonProxyHosts but nothing seems to be working. Unicorn just keeps giving the following errors whenever I try to validate using a local URL:
From the HTML validator:
HTTP Error
Unexpected HTTP response 500 Can't connect to some.internal.dom (Bad hostname 'some.internal.dom') while trying to retrieve http://some.internal.dom:4000/
From the HTTP validator:
Checker Error
Could not connect to the server (No address associated with hostname)
And from the Feed Validator:
Server returned (-2, 'Name or service not known')
An error occurred while trying to validate this feed.
I've tried everything I can think of but just don't seem to be able to get the nonProxyHosts to work. Any suggestions?
Thanks

Discovered after some investigation that Unicorn doesn't actually provide the validation services, it redirects requests to the W3C (or any other configured) validation service. This means the local proxy configuration was irrelevant as the request was being passed to W3C who weren't able to connect to our internal network (obviously), which explains why we were getting the error messages despite the proxy configuration working.
Each of the W3C validators can be downloaded and installed independently, and Unicorn can then be configured to connect to those instead of the official W3C validators.
Took a lot of digging to work this out - the W3C Unicorn site needs to explain things a bit clearer!

Related

Unable to capture request responses of metro apps - proxy configuration

I am new to using Fiddler and I have a windows 8 metro application to be tested. I want to use fiddler to see the requests and responses from that application. I have configured fiddler by running AppContainer Loopback Exemption Utility and checking the box against my app name. Also I have unchecked all use a proxy server for my LAN (but fiddler some how checks it though) ....... Anyways I was able to see the requests sent by IE and desktop apps, but unable to see the requests of metro apps ...... Please tell me how to solve this issue
How is "java", which you tagged in your question, involved here? Metro apps are not written in Java.
Fiddler works by acting as the system's proxy. If you manually change the system's proxy configuration, Fiddler will not capture anything.
You should follow the steps described here: https://groups.google.com/forum/#!topic/httpfiddler/SsZnGxdxklg to get information which can help resolve your issue.

Unable to access files from MarkLogic Java API

In the process of showing demoing some new Java code that accesses a local MarkLogic server, I ran into the following error. It pops up any time I try to either load a file, or access its metadata:
Only XML and JSON error messages supported by MarkLogic server.
This is getting triggered in calls to TextDocumentManager.readMetadata() and TextDocumentManager.read(). The code works fine on my machine but NOT on my supervisor's (he's the one seeing the error), which makes me think I tweaked something in the database configuration during development but didn't write it down. Unfortunately, I can't think of what that would be. Does anybody have any suggestions?
The message indicates that the server responded with an error without a Content-Type header declaring error content as JSON or XML.
Thus far, we've seen that Java exception only when the server was not initialized as a REST server.
So, please check your connection parameters. If in doubt, use an HTTP client like curl to make the equivalent request of the REST server to verify that the request is accepted.
If the REST server seems to be operational, you can also turn on error logging on the REST server to help debug the Java client.
To answer the followup question (StackOverFlow timed out on the initial answer):
There's a UI for creating a REST server in InfoStudio database configuration.
Go to port 8000 at the /appservices/ path.
Select the Database from the drop down and click Configure
Add a REST API Instance near the bottom of the page
There's also a REST interface for the admin user (not the REST admin user) to create REST instances on port 8002. For information about those services, please see
http://docs.marklogic.com/REST/client/service-management

Not able to access webservice from same network java

My webservice is running on jboss and client is on the tomcat
both client and webservice is running perfect on my local machine.
but if i setup client on another machine, the client program giving an error message 404 not found
I have shared my jboss over network and i am able to access webservice wsdl from another machine using http:192.168.1.26:8080/FalconServer/SearchService?wsdl
I set the same url in Client code.
but it won't work, any help
I wanted to put this as a comment, but i dont seem to find a comment button.
Did you start your jboss binding to your ip address. One way to do that:
run -b

How do I set up Glassfish to go via a proxy server?

I have been having issues with running a Glassfish v2.1.1 instance on my local machine from within the office, where we have a proxy server for outgoing connections. My initial workaround has been to work from home.
I am calling a SOAP service on a HTTPS server outside of the company. As Glassfish is not going via the company's proxy server, I get the following error when trying to initialise my SOAP clients:
javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.hostname.com...
and
Caused by: java.net.UnknownHostException: www.hostname.com
I have proxy environment variables set on my command line, as well as my system proxy settings all working correctly so that I can get to the WSDL with the browser. How should I configure Glassfish?
I had a lot of trouble finding an answer to this, as the topic isn't covered in a lot of detail on the web. One link told me how to configure the HTTP proxy, but mentioned nothing about HTTPS, so it took me a while to figure it out.
Open up the admin console on your Glassfish server and go to:
Application Server -> JVM Settings -> JVM Options. Click "Add JVM Option" 4 times and enter the following 4 options
-Dhttp.proxyHost=proxyhostname
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=proxyhostname
-Dhttps.proxyPort=8080
Where proxyhostname and the port number are correct for your setup. Then you need to restart the server.
Note that I couldn't find any options for setting up the proxy from a PAC file, nor for proxies which require auth. In this case, you may need to install a local auth proxy handler like Authoxy for Mac OS X, which turns your localhost into a non-auth proxy and masks the authentication request from the central auth proxy.
Also, this link was good for various proxy options to the JVM:
http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
You have to explicitly set the proxy server. Several options are available depending on the Glassfish version. In general you can set the proxy by either using JVM arguments or the Glassfish Admin console. An intro for GF3 is available here (sorry for only providing a link, but I do not want to repeat all the details here).
Just to make the answer complete, if the proxy requires user name and password, set the following in Glassfish:
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword
The host cannot be resolved, are you sure you use a hostname resolvable by an internet DNS server or are you using something that can only be resolved from within your network or even worse, a hosts entry local to your machine?
Aside from that, the proxy server might be denying you access to some ports, but this is probably not your problem right now. If the proxy allows access to port 80, try running your Glassfish on port 80 as well if you get any connection timeout errors.

407 unable to tunnel through proxy

We have one webservice which invokes third party webservice. To test this implementation we have different environments.
Local Developer Machine: When we run the application, everything works fine and our webservice is able to hit the third party URL. (Local Machine uses Windows OS)
Local Development Server: After deploying the application on development server, we are not able to access the third party URL and get Http Proxy 407 error. (We are having Linux, with IBM J9 JVM.)
To get around this problem, we tried setting -Dhttps.proxyUser XXX -Dhttps.proxyPassword XXX, but we continued to get the error. The second option we tried is using Authenticator.setDefault(new CustomImplAuthenticator()). But surprisingly, the JVM didnt invoke getPasswordAuthentication and continued to throw error.
We ran the same application again on local developer machine with authenticator.setdefault code. We could access the URL as said earlier, but this time again JVM didnt invoke getPasswordAuthentication method. After searching over net, we found that through NTLM the authentication data is resolved and hence we feel that the code is working on windows.
Can anyone let me know what settings, we should configure on application deployed in Linux box so that at least implementation assigned for Authenticator.setDefault will be invoked.
It depends on how you build up your http connection.
if you for example use the Apache HTTPClient you can set the proxy configuration into the DefaultHttpClient by invoking setProxyAuthenticationHandler.
Your implementation that does the http call needs to know about the proxy.

Categories

Resources