lundi 2 mars 2015

How to generate multiple ports with same wsdl in JAXWS

I have this WSDL:



<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://ift.tt/1B2MKN7"
xmlns:tns="http://ift.tt/1B2MKN7"
xmlns:xsd="http://ift.tt/tphNwY"
xmlns:soap="http://ift.tt/KIQHA2"
xmlns:wsdl="http://ift.tt/LcBaVt" >
<wsdl:types>
<xsd:schema targetNamespace="http://ift.tt/1B2MKN7">
<xsd:element name="startType">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="argument1" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="endResponseType">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="argument1" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="startRequest">
<wsdl:part name="parameters" element="tns:startType"/>
</wsdl:message>
<wsdl:message name="endResponse">
<wsdl:part name="parameters" element="tns:endResponseType"/>
</wsdl:message>
<wsdl:portType name="Process2PortType">
<wsdl:operation name="start">
<wsdl:input message="tns:startRequest" name="startRequest"/>
<!--<wsdl:output message="tns:endResponse"/>-->
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="Process2PortTypeCallBack">
<wsdl:operation name="end">
<wsdl:input message="tns:endResponse" name="endResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="process2Soap11" type="tns:Process2PortType">
<soap:binding style="document" transport="http://ift.tt/LcBaVu"/>
<wsdl:operation name="start">
<soap:operation soapAction="startAction"/>
<wsdl:input name="startRequest">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="process2CallBack" type="tns:Process2PortTypeCallBack">
<soap:binding style="document" transport="http://ift.tt/LcBaVu"/>
<wsdl:operation name="end">
<soap:operation soapAction="end"/>
<wsdl:input name="endResponse">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="process">
<wsdl:port name="processSoap" binding="tns:process2Soap11">
<soap:address location="http://localhost/sample"/>
</wsdl:port>
<wsdl:port name="processSoapCallback" binding="tns:process2CallBack">
<soap:address location="http://localhost/sampleCallback"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


I am trying to create a service implementation using Apache CXF with JAXWS endpoints and Spring, I know how to create an endpoint for each port, using something like this in the Spring context file:



<jaxws:endpoint id="personEndpoint1"
implementor="#process"
serviceName="hello1"
endpointName="a"
address="/process">

<jaxws:properties>
<entry key="schema-validation-enabled" value="true"/>
</jaxws:properties>
</jaxws:endpoint>
<jaxws:endpoint id="personEndpoint2"
implementor="#processCallback"
serviceName="hello1"
endpointName="a"
address="/process2">

<jaxws:properties>
<entry key="schema-validation-enabled" value="true"/>
</jaxws:properties>
</jaxws:endpoint>


However, this solution creates two endpoints with different WSDL urls:


. http://localhost:8080/process?wsdl



<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://ift.tt/tphNwY" xmlns:wsdl="http://ift.tt/LcBaVt" xmlns:tns="http://ift.tt/GArMu6" xmlns:soap="http://ift.tt/KIQHA2" xmlns:ns2="http://ift.tt/LcBaVu" xmlns:ns1="http://ift.tt/1B2MKN7" name="hello1" targetNamespace="http://ift.tt/GArMu6">
<wsdl:import location="http://localhost:8080/process?wsdl=Process2PortType.wsdl" namespace="http://ift.tt/1B2MKN7"/>
<wsdl:binding name="hello1SoapBinding" type="ns1:Process2PortType">
<soap:binding style="document" transport="http://ift.tt/LcBaVu"/>
<wsdl:operation name="start">
<soap:operation soapAction="startAction" style="document"/>
<wsdl:input name="start">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="hello1">
<wsdl:port binding="tns:hello1SoapBinding" name="a">
<soap:address location="http://localhost:8080/process"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


and


. http://localhost:8080/process2?wsdl



<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://ift.tt/tphNwY" xmlns:wsdl="http://ift.tt/LcBaVt" xmlns:tns="http://ift.tt/GArMu6" xmlns:soap="http://ift.tt/KIQHA2" xmlns:ns2="http://ift.tt/LcBaVu" xmlns:ns1="http://ift.tt/1B2MKN7" name="hello1" targetNamespace="http://ift.tt/GArMu6">
<wsdl:import location="http://localhost:8080/process2?wsdl=Process2PortTypeCallBack.wsdl" namespace="http://ift.tt/1B2MKN7"/>
<wsdl:binding name="hello1SoapBinding" type="ns1:Process2PortTypeCallBack">
<soap:binding style="document" transport="http://ift.tt/LcBaVu"/>
<wsdl:operation name="end">
<soap:operation soapAction="end" style="document"/>
<wsdl:input name="end">
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="hello1">
<wsdl:port binding="tns:hello1SoapBinding" name="a">
<soap:address location="http://localhost:8080/process2"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


This is not what I need, I need that the two ports are available using the same WSDL address, as in the original WSDL. How can I achieve this using JAXWS and Spring configuration?


Aucun commentaire:

Enregistrer un commentaire