apache if header contains then pass it to another url(jboss server) - regex

I want to check a http header in request, which is received on apache 2.2 and if it contains that header I would like to fire a new request to jboss whose ip is different from apache server's. Is this possible?
I have seen this doc
enter link description here
In the above link I can check if header exist, but how to create new request to another server with same header forwarded.
Any help is appreciated.

What you suggest would send a redirect response to the browser, and it would be the browser who would end up visiting your Jboss server.
I'm not sure if that's precisely what you want, but sounds like what you want is to get Apache to do that request to Jboss and then send the response to the browser. This would be the typical scenario with a web server (apache) and an application server (Jboss) where you normally don't access the application server directly.
What you want to make this work in apache is a reverse proxy.

Related

Wsdl file changed on new server

We have deployed our webservice in liberty server.Earlier it was on IBM WAS. After deploying in liberty, we came to know that Webservices is running on CXF webservice framework. In WAS, it was Axis framework.
Another difference is that , changes happened in wsdl url & content. The old wsdl url is http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and it contains xsd schema definition.
In the liberty server above wsdl url is not working and throwing file not found. But if we try to invoke http://localhost:8080/Hello/HelloServices?wsdl it's working.
Could anyone tell why old url is not working in New server. Is it due to server or inbuilt cxf framework in server.
Another team is using wsdl url to consume this webservice, with this new url they are not able to achieve it.
Any thoughts or suggestions are appreciated..
Thanks in Advance
The main reason for this is the change in the JAX-WS implementations used by the different WebSphere profiles. CXF, unfortunately, hard codes the WSDL url to append ?wsdl in several locations and so this is something that is not possible to change in configuration. The easiest solution would to add a ServletFilter to check the incoming request url for http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and then redirect the request to http://localhost:8080/Hello/HelloServices/Helloservices?wsdl.
There's a good SO post that shows how to write a ServletFilter to redirect here:
How to use a servlet filter in Java to change an incoming servlet request url?
The other option would be to have the client side update either their code or configuration to account for the change to the WSDL URL.

Why does my WebService client request the WSDL from the server when consuming the service?

I have a WS client deployed in Websphere container under linux that successfully calls a WebService published by a different application (I used CXF implementation). When I try the same client in a Tomcat container under Windows it behaves differently: wireshark captures reveal:
before invoking the webservice call my client requests the WSDL from the server at URL A
the server redirects the client to a different URL B
the client gets the WSDL from URL B.
Since the WSDL has a reference to an XSD file, the client requests the XSD from URL B assuming that the redirection also applies to the XSD file
The server responds with a not found error and the communication fails
My questions are:
A) How can it be that the client assumes that the XSD is at URL B, but it is actually at URL A?
B) Why is it that the same client does not ask for the WSDL when running on Websphere under Linux and it does ask for it when running on Tomcat under Windows? Is there any way to prevent it from requesting the WSDL an thus avoid the redirection issue?
Thanks a lot in advance!!!

How do I copy a file on a http server, from the client?

In the past I used an ftp server, connected via "ftp" from the client and "GET" to copy one file from the remote machine to the local machine.
Is it possible to do the same but with the server only running a http server?
Server: GoAhead Web Server.
Both client and http server on Windows.
The copy can be either initiated from the browser or if need a separate program can be written on the client. (i.e. - any windows api calls to copy a file from http server?)
(Also, the files may not be in the http root web directory but somewhere else on the server....can that happen?)
HTTP servers will only serve up files that are located within the site's document root. If you want to get at files that are outside the document root, you'll have to have a script serve up that file from the server (php, perl, cgi, etc...), or find some way of getting that file "inside" the document root.
To download files within the site's document root, you just hit a url pointing at that file - that's the core point of HTTP - you're just downloading content from the site.
HTTP servers will also not accept uploads without an intermediate script to handle it. If they did, you could upload any file you wanted to any server, anywhere.
What others mentioned about HTTP servers is true, but GoAhead Web Server is not a only a HTTP server. It provides many other features on top of that. And file upload seems possible, with help of a patch. More info:
https://embedthis.com/goahead/
Use WebDav for this purpose.

SOAP request logging Tomcat 7 Axis2

We are trying to log all http requests made to our Tomcat server, in particular SOAP requests.
Our server setup is as follows:
Tomcat 7.0.11
Axis 2
Gentoo Linux
So far we have used the RequestDumperFilter class however this only shows us the header information.
What we require is the ability to view the request body containing the SOAP request XML.
I guess you could make use of some request processing components but I'm not sure if there is an easy way to view the request body in Tomcat.
From what I know, the ExtendedAccessLogValve provides the most information about the request but even this is missing the body.
The most simple solution would be to move the logging away from Tomcat and use a proxy server. You place the proxy between the server and it's clients and do the logging in the proxy.
Proxy receives request, logs it, then forwards to Tomcat which generates response, sends it to the proxy which logs it and then sends it to client. The simplest proxy I used (and did its job pretty well) was the Apache TCP Monitor.
Additionally you could look at something like Fiddler and see if that helps.

How can I see incoming Requests in IIS7?

I have a created web service that takes 2 complex types as parameters. I can use the auto-generated WSDL to create a new application that calls my web service and it works perfectly.
However, a 3rd party consumer is having trouble calling my web service. I see their incoming request in the IIS7 log file and a 500 error is being returned to them.
I suspect that their request is malformed. I would like to be able to see the entire <soap:envelope> that IIS7 is receiving so that I can troubleshoot the issue. I am using Windows Server 2008 and IIS7.
How can I do this?
I would open up a copy of WireShark while they are putting their request through. You can then see each packet which comes to your server. Wireshark is cool because it can put all of the packets back together so you can see the full HTTP request they're sending.