I agree we need to clean this up a little (partially my fault).
Jarek: Are the constants on BindingID our internal constants for the binding/transports? If so, it might be better to add the constants to SoapBindingFactory & SoapTransportFactory so they're usable outside the jax-ws module and then just have the BindingID utility class reference those. - Dan On 4/23/07, James Mao <[EMAIL PROTECTED]> wrote:
This is what i'm going to do, thanks gawor, there's still bunch of hard code namespace, bindingid, transport id, we need to clean all of this. James > Author: gawor > Date: Mon Apr 23 19:06:09 2007 > New Revision: 531676 > > URL: http://svn.apache.org/viewvc?view=rev&rev=531676 > Log: > use proper binding id > > Added: > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java (with props) > Modified: > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java > > Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=531676&r1=531675&r2=531676 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original) > +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Mon Apr 23 19:06:09 2007 > @@ -54,6 +54,7 @@ > import org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingConfiguration; > import org.apache.cxf.jaxws.handler.HandlerResolverImpl; > import org.apache.cxf.jaxws.handler.PortInfoImpl; > +import org.apache.cxf.jaxws.support.BindingID; > import org.apache.cxf.jaxws.support.DummyImpl; > import org.apache.cxf.jaxws.support.JaxWsClientEndpointImpl; > import org.apache.cxf.jaxws.support.JaxWsEndpointImpl; > @@ -109,7 +110,8 @@ > for (ServiceInfo si : service.getServiceInfos()) { > for (EndpointInfo ei : si.getEndpoints()) { > this.ports.add(ei.getName()); > - addPort(ei.getName(), ei.getTransportId(), ei.getAddress()); > + String bindingID = BindingID.getJaxwsBindingID( ei.getTransportId()); > + addPort(ei.getName(), bindingID, ei.getAddress()); > } > } > } > @@ -336,16 +338,15 @@ > private EndpointInfo createEndpointInfo(AbstractServiceFactoryBean serviceFactory, > QName portName, > PortInfoImpl portInfo) throws BusException { > - EndpointInfo ei = null; > + EndpointInfo ei = null; > String address = portInfo.getAddress(); > - > + > DestinationFactoryManager dfm = bus.getExtension( DestinationFactoryManager.class); > DestinationFactory df = dfm.getDestinationFactoryForUri( portInfo.getAddress()); > > String transportId = df.getTransportIds().get(0); > - String bindingID = portInfo.getBindingID(); > - > - > + String bindingID = BindingID.getBindingID(portInfo.getBindingID ()); > + > Object config = null; > if (serviceFactory instanceof JaxWsServiceFactoryBean) { > config = new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)serviceFactory); > @@ -357,7 +358,6 @@ > Service service = serviceFactory.getService(); > service.getServiceInfos().get(0).addBinding(bindingInfo); > > - // TODO we may need to get the transportURI from Address > ei = new EndpointInfo(service.getServiceInfos().get(0), transportId); > ei.setName(portName); > ei.setAddress(address); > > Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java > URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java?view=auto&rev=531676 > ============================================================================== > --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java (added) > +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java Mon Apr 23 19:06:09 2007 > @@ -0,0 +1,56 @@ > +/** > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > +package org.apache.cxf.jaxws.support; > + > +import javax.xml.ws.soap.SOAPBinding; > + > +public final class BindingID { > + > + private static final String SOAP_11 = " http://schemas.xmlsoap.org/wsdl/soap/"; > + private static final String SOAP_12 = " http://schemas.xmlsoap.org/wsdl/soap12/"; > + > + private static final String SOAP_11_HTTP_BINDING = " http://schemas.xmlsoap.org/soap/http"; > + private static final String SOAP_12_HTTP_BINDING = " http://www.w3.org/2003/05/soap/bindings/HTTP/"; > + > + private BindingID() { > + } > + > + public static String getJaxwsBindingID(String transportID) { > + if (SOAP_11_HTTP_BINDING.equals(transportID)) { > + return SOAPBinding.SOAP11HTTP_BINDING; > + } else if (SOAP_12_HTTP_BINDING.equals(transportID)) { > + return SOAPBinding.SOAP12HTTP_BINDING; > + } else { > + return transportID; > + } > + } > + > + public static String getBindingID(String jaxwsBindingID) { > + if (SOAPBinding.SOAP11HTTP_BINDING.equals(jaxwsBindingID) > + || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(jaxwsBindingID)) { > + return SOAP_11; > + } else if (SOAPBinding.SOAP12HTTP_BINDING.equals (jaxwsBindingID) > + || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(jaxwsBindingID)) { > + return SOAP_12; > + } else { > + return jaxwsBindingID; > + } > + } > + > +} > > Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/BindingID.java > ------------------------------------------------------------------------------ > svn:eol-style = native > > > >
-- Dan Diephouse Envoi Solutions http://envoisolutions.com | http://netzooid.com/blog
