cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fox_lubiky <fox_lub...@trashmail.net>
Subject Re: override binding name
Date Fri, 11 Jan 2008 16:35:56 GMT

Hi,

I'm evaluating CXF as a possible replacement for Axis, and I have the same
problem (the client requires a particular SOAP binding name in the WSDL).
The "SoapBinding" name seems to be hard-coded in SoapBindingFactory:

        SoapBindingInfo info = new SoapBindingInfo(si,
                                                   bindingid,
                                                   config.getVersion());

        info.setName(new QName(si.getName().getNamespaceURI(),
                               si.getName().getLocalPart() +
"SoapBinding"));

The documentation
(http://cwiki.apache.org/CXF20DOC/jax-ws-configuration.html) says you can
provide your own binding factory:

  "You can specify the BindingFactory for this endpoint to use. This can be
supplied using the Spring <bean 
  class="MyBindingFactory"/> syntax."

Like this:

		<jaxws:binding>
			<bean class='...MySoapBindingFactory'/>
		</jaxws:binding>

However, that gives the error:

  Cannot convert value of type [demo.spring.NamedSoapBindingFactory] to
required type 
  [org.apache.cxf.binding.BindingConfiguration] for property 'bindingConfig'

Another possibility I'm considering is an interceptor that rewrites the WSDL
returned to the client. Any suggestions on the correct way to handle this?

Thanks,



mnereson wrote:
> 
> Is there a way to override the binding name property?
> 
> For example
> 
>     <service xmlns="http://xfire.codehaus.org/config/1.0">
>         <name>MyFulfillmentService</name>
>         <serviceClass>
>             com.myco.myapp.MyFulfillmentServiceImpl
>         </serviceClass>
>         <serviceFactory>#jsr181ServiceFactory</serviceFactory>
>     </service>
> 
> Results in a binding named MyFulfillmentServiceHttpBinding
> 
> The wsdl shows
> 
> <wsdl:binding name="MyFulfillmentServiceHttpBinding"
> type="tns:MyFulfillmentServicePortType">
>    ... 
> </wsdl:binding>
> 
> However, Our lightweight enterprise service bus requires the binding name
> to be SomethingSoapBinding so I need MyFulfillmentServiceSoapBinding. 
> 
> My current configuration uses annotations and resembles the following:
> 
> === services.xml ===
> 
> <beans>
> 
>     <bean name="jsr181ServiceFactory"
>           class="org.codehaus.xfire.annotations.AnnotationServiceFactory">
> 
>         <constructor-arg ref="xfire.transportManager"
>                         
> type="org.codehaus.xfire.transport.TransportManager"
>                          index="0"/>
> 
>         <constructor-arg ref="config" index="1"
>                         
> type="org.codehaus.xfire.aegis.type.Configuration"/>
>     </bean>
> 
>     <bean id="config" class="org.codehaus.xfire.aegis.type.Configuration">
>         <property name="defaultNillable" value="true"/>
>         <property name="defaultMinOccurs" value="1"/>
>     </bean>
> 
>     <service xmlns="http://xfire.codehaus.org/config/1.0">
>         <name>MyFulfillmentService</name>
>         <serviceClass>
>             com.myco.myapp.MtFulfillmentServiceImpl
>         </serviceClass>
>         <serviceFactory>#jsr181ServiceFactory</serviceFactory>
>     </service>
> 
> 
> </beans>
> 
> 
> == web.xml ==
> 
> <web-app>
> 
>     <servlet>
>         <servlet-name>XFireServlet</servlet-name>
>         <display-name>XFire Servlet</display-name>
>         <servlet-class>
>             org.codehaus.xfire.transport.http.XFireConfigurableServlet
>         </servlet-class>
>     </servlet>
> 
>     <servlet-mapping>
>         <servlet-name>XFireServlet</servlet-name>
>         <url-pattern>/services/*</url-pattern>
>     </servlet-mapping>
> 
> </web-app>
> 
> 
> == excerpts RemoteFulfillmentServiceImpl.java ==
> 
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> 
> @WebService
> public class MyFulfillmentServiceImpl implements MyFulfillmentService {
> 
>    // various private methods
>   
>    @WebMethod
>     public String soemPublicMethod(final int someId) {
>        // maybe a couple lines of code
>     }
>   
> }
> 
> 
> Thanks for the help.
> 
> ~ mnereson
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/override-binding-name-tp13218105p14760134.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message