ant elder wrote:


On Sun, Jul 20, 2008 at 10:47 PM, Simon Nash <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Simon Nash wrote:

        Raymond Feng wrote:

            Hi,

            I did some investigation and it turned out it is not a
            trivial issue.

            Recently we now move the Java2WSDL generation to the "build"
            phase. When Tuscany is deployed as a web application, we
            don't know the HTTP port number configured when the Tuscany
            runtime is bootstrapped by the ServletFilter. The
            information is only available when the HTTP request comes.
            Simon Nash can probably provide more information about the
            changes.

        There is code in the Axis2 Web Service binding provider that is
        intended
        to resolve this information at runtime (i.e., before the Axis2
        service
        is started).  See the call to servletHost.getURLMapping(uri) in
        Axis2ServiceProvider.computeEndpointURI().  The provider should
        call this
        and us ethe result to fix up the port URI in the WSDL document
        that's used
        by Axis2 to return the ?wsdl information.  I'll investigate
        further to see
        why this is not happening.

    I added debug printouts around this call.  Here's the input and output:
     input uri configured by the builder == "/AddServiceComponent"
     output uri returned by getURLMapping(uri) ==
    "http://SouthRim:8080/sample-calculator-ws-webapp/AddServiceComponent";

    My Tomcat server.xml file is configured to use port 8090.  Why is
    ServletHost.getURLMapping() returning 8080?  If this could be fixed,
    no other changes would be needed for ?wsdl to work correctly.

     Simon


The problem is that with the way the current code is the port is not known until the ?wsdl request comes in. The way it worked in previous releases is that the Axis2 code extracted the port from the ?wsdl request and set it in the wsdl endpoint. This isn't happening now because at line 495 of the Tuscany Axis2ServiceProvider is sets the parameter "modifyUserWSDLPortAddress" to "false" so Axis2 does not try to set the port. There is a comment above line 495 saying that is to work around a bug, anyone know what that bug is?

   ...ant

I have a fix for this now.  I am doing final testing and I expect to
apply it soon.

The Axis2 bug is that with multiple ports in a service, Axis2 writes the
same URL to all of these (based on the ?wsdl request received), even though
the WSDL ports specify different URLs.  For example, if the WSDL contains

<wsdl:service name="HelloWorldService">
  <wsdl:port name="HelloWorldSoapPort" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://foo.bar.com:8080/HelloWorldService"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort2" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://foo.bar.com:8080/HelloWorldService2"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort3" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://foo.bar.com:8080/HelloWorldService3"/>
  </wsdl:port>
</wsdl:service>

and the ?wsdl request is

 http://foo.bar.com:8765/HelloWorldService?wsdl

and the IP address of the foo.bar.com server is
 13.14.15.16

then Axis2 will update the WSDL to say

<wsdl:service name="HelloWorldService">
  <wsdl:port name="HelloWorldSoapPort" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort2" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort3" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService"/>
  </wsdl:port>
</wsdl:service>

Note that the ...Service2 and ...Service3 suffixes have been lost.

By doing the address/port substitution in Tuscany, we can avoid this problem
and return

<wsdl:service name="HelloWorldService">
  <wsdl:port name="HelloWorldSoapPort" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort2" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService2"/>
  </wsdl:port>
  <wsdl:port name="HelloWorldSoapPort3" binding="ns0:HelloWorldSoapBinding">
    <soap11:address location="http://13.14.15.16:8765/HelloWorldService3"/>
  </wsdl:port>
</wsdl:service>

  Simon

Reply via email to