swapnil
swapnil

Reputation: 21

How to avoid using CONNECT http method while in CXF library (SOAP)

I am writing a SOAP client using CXF library and here my requirement is to divert the SOAP request to another web service which is acting as a proxy for me.I have used the following code to set up the proxy in my SOAP client

WebService ss = new WebService();

WebServiceSoap port=ss.WebServiceSoap();

Client client = ClientProxy.getClient(port);

HTTPConduit http = (HTTPConduit) client.getConduit();

HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setProxyServer(System.getProperty("http.proxyHost","proxyserver.com"));
httpClientPolicy.setProxyServerPort(Integer.valueOf(System.getProperty("http.proxyPort","8080")).intValue());

httpClientPolicy.setConnectionTimeout(36000);

http.setClient(httpClientPolicy);

byte[] fileContent={'b','b'};

String res=port.submiFile(fileContent");

But this code is throwing below error

"java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 405 Method Not Allowed".

As per my investigation this error is coming because CXF library uses "CONNECT"

http method to tunnel the SOAP request however this CONNECT method

implementation is not available at proxy server(proxyserver.com).Now proxy

server team is saying we can provide only "GET" and "POST" HTTP methods only.

It means that i have to create the SOAP request manually and send either using POST or GET method.But this is the way we want to avoid to create SOAP request manually.

So my question is that is there any way to get rid of this or can i override the

"CONNECT" method? Any answer link will be helpful.Also please see the attachment for more details.

Upvotes: 1

Views: 474

Answers (1)

Stickerbomby
Stickerbomby

Reputation: 45

You did not add a SOAPAction anywhere

Upvotes: 0

Related Questions