Return-Path: Delivered-To: apmail-cxf-users-archive@www.apache.org Received: (qmail 594 invoked from network); 20 Jan 2010 09:42:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2010 09:42:59 -0000 Received: (qmail 67608 invoked by uid 500); 20 Jan 2010 09:42:58 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 67504 invoked by uid 500); 20 Jan 2010 09:42:58 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 67494 invoked by uid 99); 20 Jan 2010 09:42:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 09:42:58 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_PASS,STOX_REPLY_TYPE X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [131.239.30.132] (HELO ntmamx2.progress.com) (131.239.30.132) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 09:42:48 +0000 Received: from ntmamx2.progress.com (127.0.0.1) by ntmamx2.progress.com (MlfMTA v3.2r9) id har81o0171sa for ; Wed, 20 Jan 2010 04:42:32 -0500 (envelope-from ) Received: from progress.com ([172.16.3.168]) by ntmamx2.progress.com (SonicWALL 7.1.1.1995) with ESMTP; Wed, 20 Jan 2010 04:42:32 -0500 Received: from NTMAEXCAS02.bedford.progress.com (ntmaexcas02 [10.128.13.36]) by progress.com (8.13.8/8.13.8) with ESMTP id o0K9gR6A013698 for ; Wed, 20 Jan 2010 04:42:27 -0500 (EST) Received: from sberyoz (10.5.2.31) by NTMAEXCAS02.bedford.progress.com (10.128.13.37) with Microsoft SMTP Server (TLS) id 8.2.213.0; Wed, 20 Jan 2010 04:42:27 -0500 Message-ID: <00a001ca99b4$e07bc050$1f02050a@emea.progress.com> From: Sergey Beryozkin To: References: <2BC75D6D6FD0E342952A22AAA39C650606E24E19@RHV-EXM-04.corp.ebay.com> Subject: Re: SOAP interceptor being invoked for REST calls also Date: Wed, 20 Jan 2010 09:42:25 +0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3598 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Mlf-Version: 7.1.1.1995 X-Mlf-UniqueId: o201001200942320438284 X-Virus-Checked: Checked by ClamAV on apache.org Hi Have you registered this interceptor with the jaxws:endpoint only ? Can you post the example showing how you configured the jaxws and jaxrs endpoints cheers, Sergey ----- Original Message ----- From: "Pydipati, Karuna" To: Sent: Tuesday, January 19, 2010 9:58 PM Subject: SOAP interceptor being invoked for REST calls also Hi I have a strange issue. I intend to write a SOAP Interceptor and wrote something like this and it is working for SOAP calls. But, when REST call is coming, same SOAPInterceptor gets invoked and throwing exception. My questions is..why is this CredentialsCheckInterceptor which is extending AbstractSoapInterceptor being called for REST calls? As far as I know.., this interceptor should be invoked for SOAP calls only. Correct me, if I am wrong. If this SOAPinterceptor is being called for both SOAP and REST..then..how to write an interceptor which will be invoked only at SOAP time.., not at REST call time. Please advise me. Thanks ahead. Exception: ---------- java.lang.ClassCastException: org.apache.cxf.message.XMLMessage at com.xxx.webservices.common.CredentialsCheckInterceptor.handleMessage(Cre dentialsCheckInterceptor.java:30) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC hain.java:236) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati onObserver.java:104) at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestin ation.java:99) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser vletController.java:452) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl ler.java:159) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFSe rvlet.java:220) at org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFSer vlet.java:158) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) Interceptor intended for SOAP calls only ------------------------------------------------------- public class CredentialsCheckInterceptor extends AbstractSoapInterceptor { /** The Constant log. */ private static final Log log = LogFactory.getLog(CredentialsCheckInterceptor.class); // private StubnetUserSessionFacade stubnetSessionFacade; public static final String HTTP_REQUEST = "HTTP.REQUEST"; private static final List NON_AUTHENTICATED_SERVICE_LOCAL_NAMES = new LinkedList(); static { NON_AUTHENTICATED_SERVICE_LOCAL_NAMES.add("createStubnetSession"); } public CredentialsCheckInterceptor() { super(Phase.PRE_INVOKE); // addAfter(EndpointSelectionInterceptor.class.getName()); } public void handleMessage(SoapMessage message) { log.debug("CredentialsCheckInterceptor.handleMessage..." ); boolean valid = false; Object rawQname = message.getMessage().get("javax.xml.ws.wsdl.operation");; if (rawQname != null && rawQname instanceof QName) { QName qname = (QName)message.getMessage().get("javax.xml.ws.wsdl.operation"); String opName = qname.getLocalPart(); for (String nonAuthServiceName : NON_AUTHENTICATED_SERVICE_LOCAL_NAMES) { if (nonAuthServiceName.equals( opName )) { valid = true; break; } } } else { log.warn("Did not find an instance of QName in SoapMessage representing 'javax.xml.ws.wsdl.operation'; instead, found: " + rawQname); } if (!valid) { List contentList = message.getContent(java.util.List.class); for (Iterator iter = contentList.iterator(); iter.hasNext(); ) { Object o = iter.next(); if (o instanceof AuthHeader) { AuthHeader authHeader = (AuthHeader)o; valid = validateAuthHeader(authHeader); } } } if (!valid) { List
headers = message.getHeaders(); for (Header header : headers) { QName qname = header.getName(); log.info("Found a SOAP header : " + qname); if (qname.getLocalPart().equalsIgnoreCase("authHeader")) { Element element = (Element)header.getObject(); valid = validateAuthHeaderElement(element); } } } if (!valid) { throw new UnauthenticatedRequestException(); } } Regards Karuna Pydipati StubHub/eBay - Platform & Services Phone: (415)222-8752 Email: kpydipati@ebay.com