0

A SOAP webservice is been exposed by a system. I have got a wsdl file of the webservice. Im able to send request and get response from soap ui. I want to duplicate this wsdl SOAP webservice in my camel routes deployed in servicemix, thereby making my ESB expose a similar webservice as the system's webservice. THis way many systems access this webservice to contact the system. How do i duplicate a webservice using wsdl file of the system??

4
  • So basically you want to consume this webervice in your ESB and try to exposing all of its operations,connected to other clients of ESB. Please attach your code or explain your tried approaches so far on this to figure it out.
    – kingAm
    Jul 8, 2015 at 7:25
  • My Trials (For just making the ESB contact exposed SOAP webservice) - I created a maven project with pom.xml containing the cxf-codegen-plugin with path to wsdl of the system mentioned. On building my bundle it generates the code from wsdl in my project. I created a cxf bean in blueprint xml for the wsdl and tried to send a input working soal xml file from folder to cxf endpoint in PAYLOAD format. This simply logs the request in servicemix.log. I tried printing the response, but there is no response from the endpoint. Jul 8, 2015 at 9:02
  • Did you implement a response? A WSDL Is a contract there is no implementation.
    – Namphibian
    Jul 9, 2015 at 3:47
  • Right now My ESB - Producer to external system Webservice is working fine. Now to make it a 2 way, i want to expose same webservice in my ESB as that of the existing system's webservice. Jul 9, 2015 at 6:29

2 Answers 2

0

To duplicate webservice, exposed by a system, you can use http proxy route, based on jetty:

    <route id="ServiceProxy">
        <from uri="jetty:http://0.0.0.0:8186/service/?disableStreamCache=true&amp;matchOnUriPrefix=true&amp;continuationTimeout=900000&amp;httpClient.timeout=120000"/>
        <to uri="jetty:http://{{app-server.host}}:{{app-server.http.port}}/service/?bridgeEndpoint=true&amp;throwExceptionOnFailure=false&amp;continuationTimeout=120000&amp;httpClient.timeout=900000"/>
    </route>

You can write the same route on JavaDSL.

0

Found solution - Concept is cxf-proxying

Having a wsdl of the system, create a similar wsdl with the Endpoints defined according to the localhost and port number.

Save the wsdl in your local project, provide the path to wsdl in pom, for converting wsdl to java by mentioning in the cxf-codegen-plugin.

create cxf consumer bean with details of local wsdl file

<cxf:cxfEndpoint id="consumerProxy" address="http://remote:port/service/"
    serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
    serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
    <cxf:properties>
        <entry key="dataFormat" value="MESSAGE" />
    </cxf:properties>
</cxf:cxfEndpoint>

create cxf producer bean with details of remote wsdl file

<cxf:cxfEndpoint id="producerRemote" address="http://localhost:9001/service/"
    serviceClass="com.remote.service.RemoteService" endpointName="c:RemoteService"
    serviceName="c:RemoteService" xmlns:c="http://remote/namespace/">
    <cxf:properties>
        <entry key="dataFormat" value="MESSAGE" />
    </cxf:properties>
</cxf:cxfEndpoint>

The proxy routes can be like below

from(cxfEndpoint("consumerProxy")) .to(cxfEndpoint("producerRemote"));

Sending a request to localhost will be consumed by cxf endpoint - consumerProxy and sent to the cxf endpoint - producerRemote. The response is sent back the reverse way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.