First I added a .htaccess file to rewrite all requests for .xsd files which do not exist to my php script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{THE_REQUEST} .*\.xsd | |
RewriteRule ^(.*)$ myproxy.php?url=$1 |
After that all I had to do is create a simple script to proxy. I used PHP cURL library to do the requests and voila, simple enough:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$requestUrl = $_GET['url']; | |
switch($requestUrl){ | |
case "schema/mule/tools/3.2/mule-tools.xsd":{ | |
$targetUrl = "https://raw.github.com/stephenfenech/integrationcocktail-blog/master/mule/mule-tools/src/main/resources/META-INF/mule-tools.xsd"; | |
break; | |
} | |
default : $targetUrl = "https://raw.github.com/stephenfenech/integrationcocktail-blog/master/mule/mule-tools/src/main/resources/META-INF/mule-tools.xsd"; | |
} | |
$ch= curl_init($targetUrl); | |
curl_setopt($ch, CURLOPT_HEADER, false); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$xsd = curl_exec($ch); | |
header("Content-Type: text/xml"); | |
echo $xsd; | |
curl_close($ch); | |
?> |
Anybody out there who is creating custom mule modules and as they should, to encourage use, creates a custom namespace, please, do make the XSD available for your fellow developers so that you do not have to stay adding it to the IDE.
No comments:
Post a Comment