Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CXF autogenerates WSDL imports itself?

I develop a code first SOAP web service with CXF, and this a WSDL which I get. Why is there a import on WSDL

the second line is the one of the interest:

I am guessing that maybe it has something to do with namespaces ? I wonder if publishing the code of the web service impl will help ?

<wsdl:import location="http://localhost:8080/abc/RaceCalc?wsdl=RaceCalc.wsdl" namespace="http://service.wrapper.ie/">
</wsdl:import>

WSDL generated from Web Service:

    <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="RaceCalcImplService" targetNamespace="http://impl.service.wrapper.ie/" xmlns:ns1="http://service.wrapper.ie/" xmlns:ns2="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://impl.service.wrapper.ie/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsdl:import location="http://localhost:8080/abc/RaceCalc?wsdl=RaceCalc.wsdl" namespace="http://service.wrapper.ie/">
    </wsdl:import>
<wsdl:binding name="RaceCalcImplServiceSoapBinding" type="ns1:RaceCalc">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="setRaceCalcHelper">
  <soap:operation soapAction="" style="document" />
  <wsdl:input name="setRaceCalcHelper">
    <soap:body use="literal" />
  </wsdl:input>
  <wsdl:output name="setRaceCalcHelperResponse">
    <soap:body use="literal" />
  </wsdl:output>
</wsdl:operation>
<wsdl:operation name="calculate">
  <soap:operation soapAction="" style="document" />
  <wsdl:input name="calculate">
    <soap:body use="literal" />
  </wsdl:input>
  <wsdl:output name="calculateResponse">
    <soap:body use="literal" />
  </wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="RaceCalcImplService">
<wsdl:port binding="tns:RaceCalcImplServiceSoapBinding" name="RaceCalcImplPort">
  <soap:address location="http://localhost:8080/abc/RaceCalc" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
like image 597
Loner shushman Avatar asked Oct 04 '22 09:10

Loner shushman


1 Answers

Because you have two different namespaces on your implementation: {http://service.wrapper.ie/} and {http://impl.service.wrapper.ie/}. You surely have the interface in package ie.wrapper.service and the implementation in ie.wrapper.service.impl. CXF is therefore assuming the namespace {http://service.wrapper.ie/} for the logical stuff (interface/portType) and the namespace {http://impl.service.wrapper.ie/} for the physical stuff (impl/service/binding). Adding the @WebService(targetNamespace = "http://whatever.you.want") annotation to both, interface and implementation should remove the (need of an) import in the WSDL.

like image 145
Iñaki Avatar answered Oct 13 '22 12:10

Iñaki