#StackBounty: #java #xml #soap #cxf #wsdl2java CXF, wsdl2java. Custom port name

Bounty: 50

Short question:
Can I somehow bind wsdl:port name to generate custom java field name in service?

Long question:
I have a wsdl with such part:

<wsdl:service name="123xxx">
   <wsdl:port name="123xxxHttpSoap11Endpoint" binding="tns:123xxxSoap11Binding">
     <soap:address location="..."/>
   </wsdl:port>
</wsdl:service>

And a maven wsdl2java goal which generates the service with name 123xxx (which I’ve already fixed with binding by calling it MyService) and inside this service it generates a field:

public class MyService extends Service {
    ...
    public final static QName 123xxxHttpSoap11Endpoint = 
                 new QName("http://new.webservice.namespace", "123xxxHttpSoap11Endpoint");
    ...
}

This causing a compile errors because variables can’t start with numbers in Java. And I can’t find a way to somehow customize this generated code without changing the original wsdl.

So, is there a way to bind it through the cxf bindings, like it is done with service itself:

<bindings...>
    <bindings node="wsdl:definitions/wsdl:service">
    <class name="MyService"/>
    </bindings>
</bindings>

or may be there are some other ways to achive this?


Get this bounty!!!

Leave a Reply