Author: keith Date: Wed Jun 25 22:08:57 2008 New Revision: 18643 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18643
Log: Fixing hostObject impl to handle the case when the first argument is httpMethod. It was not picking this option correctly. Modified: trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java Modified: trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java URL: http://wso2.org/svn/browse/wso2/trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java?rev=18643&r1=18642&r2=18643&view=diff ============================================================================== --- trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java (original) +++ trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/wsrequest/WSRequestHostImpl.java Wed Jun 25 22:08:57 2008 @@ -30,7 +30,6 @@ import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; import org.apache.axis2.description.WSDL2Constants; import org.apache.axis2.transport.http.HTTPConstants; import org.apache.axis2.transport.http.HttpTransportProperties; @@ -61,7 +60,6 @@ import org.wso2.javascript.xmlimpl.XML; import org.wso2.mashup.MashupConstants; import org.wso2.mashup.MashupFault; -import org.wso2.mashup.utils.CustomProtocolSocketFactory; import org.wso2.mashup.utils.MashupUtils; import org.wso2.wsas.ServerManager; import org.wso2.wsas.ServerConstants; @@ -173,7 +171,7 @@ Function funObj) throws AxisFault { // Defaults to post String httpMethod = "post"; - String url = null; + String url; String username = null; String passwd = null; // set true by default to use SOAP 1.2 @@ -188,9 +186,6 @@ String httpContentEncoding = null; NativeArray optionsArray = null; - QName service = null; - String endpointName = null; - WSRequestHostImpl wsRequest = checkInstance(thisObj); if (wsRequest.readyState > 0 && wsRequest.readyState < 4) { throw new Error("INVALID_STATE_EXCEPTION"); @@ -240,6 +235,12 @@ throw Context.reportRuntimeError("INVALID_SYNTAX_EXCEPTION"); } + if (arguments[1] instanceof String) { + url = (String) arguments[1]; + } else { + throw Context.reportRuntimeError("INVALID_SYNTAX_EXCEPTION"); + } + if (arguments[0] instanceof String) { httpMethod = (String) arguments[0]; } else if (arguments[0] instanceof NativeArray) { @@ -323,24 +324,18 @@ && !(HTTPContentEncodingObject instanceof UniqueTag)) { httpLocation = HTTPContentEncodingObject.toString(); } - - if (arguments[1] instanceof String) { - url = (String) arguments[1]; - } else { - throw Context.reportRuntimeError("INVALID_SYNTAX_EXCEPTION"); - } - ServerManager serverManager = ServerManager.getInstance(); - wsRequest.sender = - new ServiceClient(serverManager.configContext, null); - - Options options = getOptionsObject(httpMethod, httpLocation, httpLocationIgnoreUncited, - httpQueryParameterSeparator, httpInputSerialization, - httpContentEncoding, url, username, passwd, useSOAP, - useWSA, useWSS, action, optionsArray, wsRequest); - // Setting the cookie policy here - options.setProperty(HTTPConstants.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES); - wsRequest.sender.setOptions(options); } + ServerManager serverManager = ServerManager.getInstance(); + wsRequest.sender = + new ServiceClient(serverManager.configContext, null); + + Options options = getOptionsObject(httpMethod, httpLocation, httpLocationIgnoreUncited, + httpQueryParameterSeparator, httpInputSerialization, + httpContentEncoding, url, username, passwd, useSOAP, + useWSA, useWSS, action, optionsArray, wsRequest); + // Setting the cookie policy here + options.setProperty(HTTPConstants.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES); + wsRequest.sender.setOptions(options); setCommonProperties(cx, wsRequest); } @@ -991,20 +986,22 @@ .reportRuntimeError( "INVALID_SYNTAX_EXCEPTION. Action is NULL when useWSA is true."); } - Object fromObject = optionsArray.get("from", optionsArray); - if (fromObject != null && !(fromObject instanceof Undefined) - && !(fromObject instanceof UniqueTag)) { - options.setFrom(new EndpointReference(fromObject.toString())); - } - Object replyToObject = optionsArray.get("replyTo", optionsArray); - if (replyToObject != null && !(replyToObject instanceof Undefined) - && !(replyToObject instanceof UniqueTag)) { - options.setReplyTo(new EndpointReference(replyToObject.toString())); - } - Object faultToObject = optionsArray.get("faultTo", optionsArray); - if (faultToObject != null && !(faultToObject instanceof Undefined) - && !(faultToObject instanceof UniqueTag)) { - options.setFaultTo(new EndpointReference(faultToObject.toString())); + if (optionsArray != null) { + Object fromObject = optionsArray.get("from", optionsArray); + if (fromObject != null && !(fromObject instanceof Undefined) + && !(fromObject instanceof UniqueTag)) { + options.setFrom(new EndpointReference(fromObject.toString())); + } + Object replyToObject = optionsArray.get("replyTo", optionsArray); + if (replyToObject != null && !(replyToObject instanceof Undefined) + && !(replyToObject instanceof UniqueTag)) { + options.setReplyTo(new EndpointReference(replyToObject.toString())); + } + Object faultToObject = optionsArray.get("faultTo", optionsArray); + if (faultToObject != null && !(faultToObject instanceof Undefined) + && !(faultToObject instanceof UniqueTag)) { + options.setFaultTo(new EndpointReference(faultToObject.toString())); + } } } else { @@ -1036,7 +1033,7 @@ private static void setSSLProperties(WSRequestHostImpl wsRequest) throws AxisFault { Options options = wsRequest.sender.getOptions(); String toAddress = options.getTo().getAddress(); - URL url = null; + URL url; try { url = new URL(toAddress); } catch (MalformedURLException e) { _______________________________________________ Mashup-dev mailing list [email protected] http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
