Tomcat – Changing soap:address location in generated wsdl to https on tomcat 6 axis2(1.6.2)

axis2soaptomcatweb serviceswsdl

To start, I am using eclipse, with Axis2 1.6.2 and I am deploying my created web service on tomcat 6. The web service is created from a top down approach in eclipse.

I've been requested to make the access to my web service SSL compatible.
No problems occured there, I followed the url "http://axis.apache.org/axis2/java/core/docs/servlet-transport.html" which led me to modifying the axis2.xml to include:

<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8080</parameter>
</transportReceiver>

<transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener">
    <parameter name="port">8443</parameter>
</transportReceiver>

And removing:

 <transportReceiver name="http"
                   class="org.apache.axis2.transport.http.SimpleHTTPServer">
    <parameter name="port">8080</parameter>

<!-- Here is the complete list of supported parameters (see example settings further below):
    port: the port to listen on (default 6060)
    hostname:  if non-null, url prefix used in reply-to endpoint references                                 (default null)
    originServer:  value of http Server header in outgoing messages                                         (default "Simple-Server/1.1")
    requestTimeout:  value in millis of time that requests can wait for data                                (default 20000)
    requestTcpNoDelay:  true to maximize performance and minimize latency                                   (default true)
                        false to minimize bandwidth consumption by combining segments
    requestCoreThreadPoolSize:  number of threads available for request processing (unless queue fills up)  (default 25)
    requestMaxThreadPoolSize:  number of threads available for request processing if queue fills up         (default 150)
                               note that default queue never fills up:  see HttpFactory
    threadKeepAliveTime:  time to keep threads in excess of core size alive while inactive                  (default 180)
                          note that no such threads can exist with default unbounded request queue
    threadKeepAliveTimeUnit:  TimeUnit of value in threadKeepAliveTime (default SECONDS)                    (default SECONDS)
-->
<!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
<!-- <parameter name="originServer">My-Server/1.1</parameter>           -->
<!-- <parameter name="requestTimeout">10000</parameter>                   -->
<!-- <parameter name="requestTcpNoDelay">false</parameter>                   -->
<!-- <parameter name="requestCoreThreadPoolSize">50</parameter>                      -->
<!-- <parameter name="requestMaxThreadPoolSize">100</parameter>                     -->
<!-- <parameter name="threadKeepAliveTime">240000</parameter>                  -->
<!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter>            -->
 </transportReceiver>

I also have to modify the web.xml in the web config to include:

  <security-constraint>
<web-resource-collection>
  <web-resource-name>HTTPSOnly</web-resource-name>
  <url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
  <transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>

It's going perfectly well, I can only access the application using https:
"https://myUrl:8443/IVRCoreWebService/services/CardManager?wsdl"

The problem here goes in the description file opened in the URL:

<service name="CardManager">
        <port name="CardManagerPort" binding="tns:CardManagerBinding">
                <soap:address location="http://`myUrl`:8080/IVRCoreWebService/services/CardManager/"/>
        </port>
</service>

How can I change the auto generated URL by Axis2 to the https location, I would like my url to be the following:

<service name="CardManager">
        <port name="CardManagerPort" binding="tns:CardManagerBinding">
                <soap:address location="https://`myUrl`:8443/IVRCoreWebService/services/CardManager/"/>
        </port>
</service>

If I modify the port in <transportReceiver name="http"> (See above) to for example 8050, the soap:address location will in turn change 8050, so my guess is that when the wsdl is being generated, it is referencing the <transportReceiver name="http" >, any idea how I can make it reference the <transportReceiver name="https" > ?


I checked this thread https://stackoverflow.com/a/10072185/861760 which is telling me to add a <transports><transport>https</transport></transports> in service.xml (I found services.xml instead), when I added this code segment, It gave me a new error:

org.apache.axis2.AxisFault: Server does not have an epr for the wsdl epr==>http://www.example.com
org.apache.axis2.description.AxisService.getLocationURI(AxisService.java:1615)
org.apache.axis2.description.AxisService.setPortAddress(AxisService.java:1498)
org.apache.axis2.description.AxisService.printDefinitionObject(AxisService.java:1078)
org.apache.axis2.description.AxisService.printUserWSDL(AxisService.java:1112)
org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1386)
org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327)
org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183)
org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Thank you for the help,

Regards.

Best Answer

I'm not sure you asked this, but I see that

address location = (domain + port) / (file name of .WAR) /services/ (name of wsdl:binding )

Related Topic