Question

I'm creating an Axis2 Web Service with Eclipse and the WSO2 Development Tools. I export the Web Service as an ".aar" file, and that install it in WSO2 Application Server.

The WSDL is automatically generated and the name of the Porttype is always [ServiceName]PortType.

Is there a way to change the PortType while developing the WS to a custom name, or after I have deployed it? I know that I can set the PortType of a Jax-WS WebService with some parameters, but Jax-WS are not well suitable for my use case.

Thanks for your answers.

Was it helpful?

Solution

Yes.

It is possible to override the default port type naming convention by associating a WSDL file with your custom port names.

  1. Implement your Axis2 Service with Developer Studio.

  2. Once you are done with service implementation, right click on the Axis2 Service Project and select "Generate WSDL".

    Then it will generate the WSDL file in the src/main/resources folder.

  3. Then you need to move (cut and paste) that generated WSDL file to the src/main/resoures/META-INF folder where your services.xml file exists.

  4. Then you can modify and update the portType elements of the WSDL file.

  5. Once you are done with the modification to the WSDL file, you need to open the services.xml file in the src/main/resoures/META-INF location and update the services.xml file with following parameter.

<service ...>
    <parameter name="useOriginalwsdl">true</parameter>
    .
    .
    .
</service>

Now you can export the service as an Axis2 Archive (aar file) using Developer Studio and deploy the generated Axis2 Service in the WSO2 App Server or any other suitable/compatible Web Service container.

Hope this helps!!

Thanks and Regards,

Harshana

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top