Return-Path: Delivered-To: apmail-xml-axis-dev-archive@xml.apache.org Received: (qmail 4324 invoked by uid 500); 4 Oct 2002 15:26:10 -0000 Mailing-List: contact axis-dev-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-dev@xml.apache.org Received: (qmail 94384 invoked from network); 4 Oct 2002 00:42:36 -0000 Subject: SOAP Routing and URLMapper To: axis-dev@xml.apache.org X-Mailer: Lotus Notes Release 5.0.8 June 18, 2001 Message-ID: From: Aaron.Knauf@vodafone.co.nz Date: Fri, 4 Oct 2002 12:42:50 +1200 X-MIMETrack: Serialize by Router on NT03AKLN/Server/Vodafone/NZ(Release 5.0.8 |June 18, 2001) at 04/10/2002 12:42:50 PM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I am writing a simple SOAP router that, essentially, does the same as the ProxyService from the axis samples. The main difference is that the URL that the message is to be delivered to is determined from request elements. Moving forward, the destination will be determined base on info in the SOAP header (possibly implementing WS routing). For now I want to simply use the extra path info in the HTTP request. I have modified URL mapper to use only the first element of the extra path info (i.e. the bit between the first and second slashes) to find the service being requested. This means I can request '/services/router/mydestination' to have the request hit my 'router' service and and be routed to 'mydestination'. (This is a logical name that is mapped to another destination in a routing table.) This imposes the restriction that services identified by HTTP URL cannot have slashes in their name, but I think that this is acceptable. It would probably be useful to have this as part of the standard Axis URLMapper. Here is the code that I used to do it: (Note that bit that sets the extra path info in the message context to what is left after the service name. Not sure whether to leave this in or not.) -------------------------------------------- if ( msgContext.getService() == null ) { // Determine the service to map to based on the extra path info in the // HTTP request. String path = (String)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO); if ((path != null) && (path.length() > 1)) { int secondSlash = path.indexOf('/', 1); String serviceName = path.substring(1, (secondSlash > 1) ? secondSlash : path.length()); msgContext.setTargetService( serviceName ); // If there is additional extra path info, set the extra path info // to the remainder String remainingPath = ""; if (secondSlash > 1) { remainingPath = path.substring(secondSlash); } msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO, remainingPath); } } -------------------------------------------- There is no magic. ----------------------------------------------------------------------------------------------- Have you seen our website?.... http://www.vodafone.co.nz CAUTION: This correspondence is confidential and intended for the named recipient(s) only. If you are not the named recipient and receive this correspondence in error, you must not copy, distribute or take any action in reliance on it and you should delete it from your system and notify the sender immediately. Thank you. Unless otherwise stated, any views or opinions expressed are solely those of the author and do not represent those of Vodafone New Zealand Limited. Vodafone New Zealand Limited 21 Pitt Street, Private Bag 92161, Auckland, 1020, New Zealand Telephone + 64 9 357 5100 Facsimile + 64 9 377 0962