blob: dfab8552a856c285f0ccf9e4744e0b6e68abc3a6 [file] [log] [blame]
/*
* Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.xml.internal.ws.client.dispatch.impl.protocol;
import com.sun.xml.internal.ws.pept.ept.MessageInfo;
import com.sun.xml.internal.ws.pept.presentation.MessageStruct;
import com.sun.xml.internal.ws.pept.protocol.MessageDispatcher;
import com.sun.xml.internal.ws.binding.BindingImpl;
import com.sun.xml.internal.ws.client.BindingProviderProperties;
import com.sun.xml.internal.ws.client.ContextMap;
import com.sun.xml.internal.ws.handler.HandlerChainCaller;
import com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceException;
import java.util.logging.Logger;
/**
* @author WS Development Team
*/
public class MessageDispatcherHelper extends SOAPMessageDispatcher
implements BindingProviderProperties {
private static final Logger logger =
Logger.getLogger(new StringBuffer().append(com.sun.xml.internal.ws.util.Constants.LoggingDomain).append(".client.dispatch").toString());
public MessageDispatcherHelper() {
super();
}
@Override
protected void setResponseType(Throwable e, MessageInfo messageInfo) {
if (e instanceof RuntimeException) {
//leave for now- fix later
if (e instanceof WebServiceException)
messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
else
messageInfo.setResponseType(MessageStruct.UNCHECKED_EXCEPTION_RESPONSE);
} else {
messageInfo.setResponseType(MessageStruct.CHECKED_EXCEPTION_RESPONSE);
}
}
@Override
protected HandlerChainCaller getHandlerChainCaller(MessageInfo messageInfo) {
ContextMap context = (ContextMap)
messageInfo.getMetaData(BindingProviderProperties.JAXWS_CONTEXT_PROPERTY);
BindingProvider provider = (BindingProvider)
context.get(BindingProviderProperties.JAXWS_CLIENT_HANDLE_PROPERTY);
BindingImpl binding = (BindingImpl) provider.getBinding();
return binding.getHandlerChainCaller();
}
}