Search code examples
wsdlwso2wso2-esb

WSO2 - set PublishWSDL URI from registry


I have the following pass-through proxy in WSO2:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MyServiceName_V2" transports="https http" startOnLoad="true" trace="disable">
<target>
    <inSequence>
        <log level="full">
            <property name="state" value="before"/>
        </log>
        <send>
            <endpoint key="gov:path.to.the.endpoint.in.the.registry"/>
        </send>
    </inSequence>
    <outSequence>
        <send/>
    </outSequence>
    <faultSequence/>
</target>
<publishWSDL uri="http://localhost:myservice.svc?singleWsdl"></publishWSDL>
<parameter name="useOriginalwsdl">true</parameter>

The endpoint for the service is in the registry, so I can deploy this proxy to any number of WSO2 servers (development, test, qa, ...), and the endpoint url will point to the correct server/url for each environment.

But the publishWSDL uri is currently hardcoded: it points directly to a fixed uri (currently on my development machine). I want to replace this by something that points to some value in the registry, just like the uri for the actual endpoint.

I've tried adding a wsdl endpoint, but that didn't work, because I think the wsdl endpoint isn't just the wsdl but a complete endpoint based on the wsdl.

I'm thinking that I should just replace the publishWsdl uri with some text content from the registry, but I have no idea how to first get the text content in the registry (in a WSO2 dev studio project in Eclipse), and then how to get that value from the registry into that uri property for the publishWsdl element.

Any ideas?


Solution

  • What I eventually did was remove the 'useOriginalwsdl' setting.

    That setting was needed because each ESB server we had replaced the endpoints by its own name, while we wanted that endpoint to be the address of the load balancer. So we set the endpoints to that address in the WSDL, and set 'useOriginalwsdl' to true.

    But it's much better to set the 'WSDLEPRPrefix' parameter in axis2.xml instead so when I found that setting, that's what we did.