Hi
It appears the comparison is based on the base URI and so the redirect
loop is reported.
I can imagine why it can be a problem...
I guess we can introduce a contextual property to allow for auto
redirects even if base URIs are the same (but assuming the complete URIs
are still different)
Sergey
On 30/08/12 10:17, Bart Van Den Steen wrote:
Hello,
It is my first time using cxf and I am attempting to communicate with an
outside web service that requires 2 way ssl authentication via certificates.
I can successfully connect with the web service in the Test environment but
when using the same code to contact the web service in their Production
environment I receive a 302 error (see below).
I tried to modify my code so that it would automatically follow redirects
but then I receive a different error, namely a redirect loop(see below).
I have added my code below with the modifcations that give me the loop error
between '// modified start'& '// end'.
I am using cxf version 2.2.12
Thanks,
Bart
-----------------------
CODE
try {
JaxWsProxyFactoryBean factory = new
JaxWsProxyFactoryBean();
factory.setServiceClass(clazz);
factory.setAddress(address);
Object port = factory.create();
Client client = ClientProxy.getClient(port);
// modified start
((BindingProvider)client).getRequestContext().put("org.apache.cxf.message.Message.MAINTAIN_SESSION",
Boolean.FALSE);
// end
client.getInInterceptors().add(new
LoggingInInterceptor());
client.getOutInterceptors().add(new
LoggingOutInterceptor());
if (client != null) {
HTTPConduit conduit = (HTTPConduit)
client.getConduit();
HTTPClientPolicy policy = new
HTTPClientPolicy();
// modified start
policy.setAllowChunking(false);
policy.setAutoRedirect(true);
policy.setConnection(ConnectionType.KEEP_ALIVE);
// end
conduit.setClient(policy);
}
return port;
} catch (Throwable e) {
throw new WSClientException(
"Error while creating WS Client for
service", e);
}
-------------------------
FIRST ERROR: 302 ERROR
Jul 30, 2012 2:18:51 PM
org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
ID: 3
Address: https://bcdabnx.nbb.be/soap/nbb
Encoding: UTF-8
Content-Type: text/xml
Headers: {SOAPAction=[SOAPActionMinFin], Accept=[*/*]}
Payload:<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:ws_abnxOperations
xmlns:ns2="http://www.nbb.be/BCD_ABNX/"><AbnxOperations><AbnxOpe
rations><ListAvailableFiles><RequestList>D</RequestList></ListAvailableFiles></AbnxOperations></AbnxOperations></ns2:ws_abnxOperations></soap:Body></soap:Envelope>
--------------------------------------
Jul 30, 2012 2:18:51 PM org.apache.cxf.interceptor.LoggingInInterceptor
logging
INFO: Inbound Message
----------------------------
ID: 3
Response-Code: 302
Encoding: ISO-8859-1
Content-Type: text/html; charset=iso-8859-1
Headers: {content-type=[text/html; charset=iso-8859-1],
connection=[Keep-Alive], Date=[Thu, 30 Jul 2012 12:18:51 GMT],
Content-Length=[513], Location=[https://bcdabnx.nbb.be/nbb
loginproxy/authenticationbackend?TYPE=33554433&REALMOID=06-0d35dbdf-73cf-4753-8c46-9e719ac30dab&GUID=&SMAUTHREASON=0&METHOD=POST&SMAGENTNAME=-SM-74fXnAhrTV4d%2bSzRuWiYDsD8PuJbwO
7utDDh3zF6oS%2bcCtLdKRQE8uDp1N0dv4Yc&TARGET=-SM-http%3a%2f%2fbcdabnx%2enbb%2ebe%2fbcdabnx%2fsoap%2fnbb],
Keep-Alive=[timeout=5, max=100], Cache-Control=[no-store]}
Payload:<!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
Found
<p>The document has moved
https://bcdabnx.nbb.be/nbbloginproxy/authenticationbackend?TYPE=33554433&REALMOID=06-0d35dbdf-73cf-4753-8c46-9e719ac30dab&GUID=&SM
AUTHREASON=0&METHOD=POST&SMAGENTNAME=-SM-74fXnAhrTV4d%2bSzRuWiYDsD8PuJbwO7utDDh3zF6oS%2bcCtLdKRQE8uDp1N0dv4Yc&TARGET=-SM-http%3a%2f%2fbcdabnx%2enbb%2ebe%2fbcdabnx%2f
soap%2fnbb here .</p>
</body></html>
-------------------------
-------------------------
SECOND ERROR: LOOP ERROR
Aug 30, 2012 11:12:40 AM org.apache.cxf.transport.http.HTTPConduit
redirectRetransmit
INFO: Redirect loop detected on Conduit
"{http://www.nbb.be/BCDABNX/}BCD_ABNX_Server_InPortTypePort.http-conduit" on
'https://bcdabnx.nbb.be/nbbloginproxy/authentication
backend?TYPE=33554433&REALMOID=06-0d35dbdf-73cf-4753-8c46-9e719ac30dab&GUID=&SMAUTHREASON=0&METHOD=POST&SMAGENTNAME=-SM-74fXnAhrTV4d%2bSzRuWiYDsD8PuJbwO7utDDh3zF6oS%2bcC
tLdKRQE8uDp1N0dv4Yc&TARGET=-SM-http%3a%2f%2fbcdabnx%2enbb%2ebe%2fbcdabnx%2fsoap%2fnbb'
Aug 30, 2012 11:12:40 AM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
WARNING: Interceptor for
{http://www.nbb.be/BCDABNX/}BCDABNXServerInPortTypeService#{http://www.nbb.be/BCDABNX/}ws_abnxOperations
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy1257.wsAbnxOperations(Unknown Source)
at
be.fgov.minfin.wsclientcxf.WSClient.listAvailableFilesWS(WSClient.java:58)
at
be.fgov.minfin.ccff.fwk.batch.batchtest.basic.business.Business.BusinessLogic(Business.java:59)
at
be.fgov.minfin.ccff.fwk.batch.batchtest.basic.BNBWSClientBatchExecutor.execute(BNBWSClientBatchExecutor.java:34)
at
be.fgov.minfin.ccff.fwk.batch.BatchExecutorMDB._execute(BatchExecutorMDB.java:162)
at
be.fgov.minfin.ccff.fwk.batch.BatchExecutorMDB.onMessage(BatchExecutorMDB.java:79)
at
weblogic.ejb.container.internal.MDListener.execute(MDListener.java:574)
at
weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
at
weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:379)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
at
weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3821)
at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
at
weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
at
weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.io.IOException: IOException invoking
https://bcdabnx.nbb.be/bcdabnx/soap/nbb: Redirect loop detected on Conduit
"{http://www.nbb.be/BCDABNX/}BCD_ABNX_Ser
ver_InPortTypePort.http-conduit" on
'https://bcdabnx.nbb.be/nbbloginproxy/authenticationbackend?TYPE=33554433&REALMOID=06-0d35dbdf-73cf-4753-8c46-9e719ac30dab&GUID=&SMAU
THREASON=0&METHOD=POST&SMAGENTNAME=-SM-74fXnAhrTV4d%2bSzRuWiYDsD8PuJbwO7utDDh3zF6oS%2bcCtLdKRQE8uDp1N0dv4Yc&TARGET=-SM-http%3a%2f%2fbcdabnx%2enbb%2ebe%2fbcdabnx%2fsoap%2
fnbb'
----------------------
--
View this message in context:
http://cxf.547215.n5.nabble.com/302-error-and-redirect-loop-on-Conduit-tp5713358.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com