*/
public WOResponse handleRequest(WORequest woRequest)
{
if(isMetadataQuery(woRequest.queryString()))
{
SDDocument doc = wsdls.get(woRequest.queryString());
if(doc == null)
{
ERXResponse resp = new ERXResponse();
resp.setStatus(WOMessage.HTTP_STATUS_NOT_FOUND);
return resp;
}
ERXResponse resp = new ERXResponse();
resp.setStatus(HttpURLConnection.HTTP_OK);
resp.setHeader("text/xml;charset=utf-8", "Content-Type");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
WODynamicURL du = woRequest._uriDecomposed();
String baseUri = String.format("%s/%s.woa/%s/%s",
du.prefix(),
du.applicationName(),
du.requestHandlerKey(),
du.requestHandlerPath());
boolean isSecure;
if(woRequest instanceof ERXRequest)
{
isSecure = ((ERXRequest)woRequest).isSecure();
} else
{
isSecure = ERXRequest.isRequestSecure(woRequest);
}
String soapAddress = ERXResourceManager._completeURLForResource(
baseUri,
isSecure,
WOApplication.application().createContextForRequest(woRequest)
);
try
{
doc.writeTo(new ERPortAddressResolver(soapAddress),
new ERDocumentAddressResolver(soapAddress),
baos);
baos.flush();
}
catch(IOException e)