We have a Tuscany 1.5 installation under Tomcat on one server (the
application server), which is accessed using Apache httpd and the
Apache/Tomcat connector on a separate web server.

 We are exposing SOAP web services in Tuscany, but the WSDL for these is
incorrect because the SOAP address location has the application server
address instead of the web server name:

 This is what we get:

<wsdl:service name="Service">

<wsdl:port name="Port" binding="tns:Binding">

<SOAP11:address location="http://*[ip address of app server]*/serviceurl"/>

</wsdl:port>

</wsdl:service>

 This is what we need:

<wsdl:service name="Service">

<wsdl:port name="Port" binding="tns:Binding">

<SOAP11:address location="http://*webserver*/serviceurl"/>

</wsdl:port>

</wsdl:service>

 Without this change, clients using Java 6 JAXB cannot connect to the web
service.

 I have corrected this with an updated tuscany-binding-ws-axis2-1.5.jar
which has fix in org.apache.tuscany.sca.binding.ws.axis2.TuscanyListingAgent
to the setIPAddress method. The fix is:

 private static String setIPAddress(String wsdlURI, String requestURI) {

try {

URI wsdlURIObj = new URI(wsdlURI);

String wsdlHost = wsdlURIObj.getHost();

int wsdlPort = wsdlURIObj.getPort();

String wsdlAddr = wsdlHost + (wsdlPort != -1 ? ":" +

Integer.toString(wsdlPort) : "");

URI requestURIObj = new URI(requestURI);

-              String ipAddr = HttpUtils.getIpAddress();

+              String ipAddr = requestURIObj.getHost();

int requestPort = requestURIObj.getPort();

String newAddr = ipAddr + (requestPort != -1 ? ":" +

Integer.toString(requestPort) : "");

return wsdlURI.replace(wsdlAddr, newAddr);

} catch (Exception e) {

// URI string not in expected format, so return the WSDL URI unmodified

return wsdlURI;

}

}

 I'm happy to create a JIRA and submit a patch to this effect. However, I
suspect that this undermines the purpose of this method. So my questions
are: what is the correct way to remedy this? Would this patch work for you?
Is there another way of fixing this?

 Many thanks

Martin

Reply via email to