Hi Kasun, At present the Axis2FlexibleMEPClient detects a REST request by checking the HTTP method used and if the content type belongs to any of the following: application/xml application/x-www-form-urlencoded multipart/form-data application/json
If the HTTP method is anything other than POST - then the request is assumed to be REST. If it is a POST, it checks to see if the messageType is one of the above. IMO these criteria aren't enough to decide if a request is REST. I'll look into see if we can find a better way to do this. Thanks On Tue, May 13, 2014 at 7:18 PM, Kasun Indrasiri <[email protected]> wrote: > -1 > HTTP EP is designed for outbound REST calls. So putting format=rest, is > meaningless and hinders its whole purpose. We need to find a better > alternative. May be we have to filter-out SOAP vs POX at the > Axis2FlexibleMEPClient level ? > > > On Wed, May 14, 2014 at 1:25 AM, Ravi Undupitiya <[email protected]> wrote: > >> Hi guys, >> >> Looks like format support is already there for HTTP Endpoint - just not >> in the UI. We can add the attribute format="rest" to solve this issue. :) >> >> >> Thanks >> >> >> On Tue, May 13, 2014 at 6:51 PM, Ravi Undupitiya <[email protected]> wrote: >> >>> Hello all, >>> >>> Isuru and I had a look at this, and we found the reason for this >>> behaviour is to do with the isRest property not being set to true - by >>> default when we send text/xml we assume that the invocation is not rest and >>> therefor is a SOAP service invocation. >>> >>> The problem with this is that a valid REST invocation can also look like >>> a SOAP invocation when the deciding factor is only the content type. >>> >>> To work around this the address endpoints have the format attribute >>> where we can set format=rest. HTTP Endpoints don't have a mechanism to set >>> the format at present. >>> >>> Shall we include the ability to set the format in HTTP Endpoint? Is this >>> a correct fix? >>> >>> >>> Thanks >>> >>> >>> On Wed, May 7, 2014 at 6:59 PM, Sanjeewa Malalgoda >>> <[email protected]>wrote: >>> >>>> Hi, >>>> We observed following behavior in API Manager 1.7.0 which built on top >>>> of synapse 2.1.2.wso2v5. We sent same request to API created by fronting >>>> basic jaxrs service. Only difference is setting 2 content types. Backend >>>> service support both content types and we can invoke it without any issue. >>>> >>>> 01. Content-Type: text/xml >>>> [2014-05-07 18:36:31,114] DEBUG - headers http-outgoing-6 >> POST >>>> http://10.100.1.65:9764/jaxrs_basic/services/customers HTTP/1.1 >>>> >>>> 02. Content-Type: application/xml >>>> [2014-05-07 18:36:11,805] DEBUG - headers http-outgoing-6 >> POST >>>> http://10.100.1.65:9764/jaxrs_basic/services/customers/ >>>> *customerservice/customers* HTTP/1.1 >>>> >>>> When content type is text/xml we can see part of the request is >>>> dropping. It send request directly to the endpoint defined in API without >>>> appending other things in client request url. Any idea what went wrong? >>>> >>>> Here is my API >>>> <api name="admin--jaxrs" context="/jaxrs" version="1.0.0" >>>> version-type="url"> >>>> <resource methods="POST GET DELETE OPTIONS PUT" >>>> uri-template="/*"> >>>> <inSequence> >>>> <property name="POST_TO_URI" value="true" >>>> scope="axis2"/> >>>> <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION"> >>>> <then> >>>> <send> >>>> <endpoint >>>> name="admin--jaxrs_APIproductionEndpoint_0"> >>>> <http uri-template=" >>>> http://10.100.1.65:9764/jaxrs_basic/services/customers"> >>>> <timeout> >>>> <duration>30000</duration> >>>> >>>> <responseAction>fault</responseAction> >>>> </timeout> >>>> <suspendOnFailure> >>>> <errorCodes>-1</errorCodes> >>>> >>>> <initialDuration>0</initialDuration> >>>> >>>> <progressionFactor>1.0</progressionFactor> >>>> >>>> <maximumDuration>0</maximumDuration> >>>> </suspendOnFailure> >>>> <markForSuspension> >>>> <errorCodes>-1</errorCodes> >>>> </markForSuspension> >>>> </http> >>>> </endpoint> >>>> </send> >>>> </then> >>>> <else> >>>> <sequence key="_sandbox_key_error_"/> >>>> </else> >>>> </filter> >>>> </inSequence> >>>> <outSequence> >>>> <send/> >>>> </outSequence> >>>> </resource> >>>> <handlers> >>>> <handler >>>> class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/> >>>> <handler >>>> class="org.wso2.carbon.apimgt.gateway.handlers.throttling.APIThrottleHandler"> >>>> <property name="id" value="A"/> >>>> <property name="policyKey" >>>> value="gov:/apimgt/applicationdata/tiers.xml"/> >>>> </handler> >>>> <handler >>>> class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/> >>>> <handler >>>> class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler"> >>>> <property name="configKey" >>>> value="gov:/apimgt/statistics/ga-config.xml"/> >>>> </handler> >>>> <handler >>>> class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/> >>>> </handlers> >>>> </api> >>>> >>>> Thanks, >>>> sanjeewa. >>>> -- >>>> >>>> *Sanjeewa Malalgoda* >>>> WSO2 Inc. >>>> Mobile : +94713068779 >>>> >>>> <http://sanjeewamalalgoda.blogspot.com/>blog >>>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/> >>>> >>>> >>>> >>> >>> >>> -- >>> *Ravi Undupitiya* >>> Software Engineer; WSO2 Inc.; http://wso2.com >>> >>> >>> *E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712 >>> <%2B94%C2%A0772%20930%20712>* >>> >>> Lean . Enterprise . Middleware >>> >> >> >> >> -- >> *Ravi Undupitiya* >> Software Engineer; WSO2 Inc.; http://wso2.com >> >> >> *E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712 >> <%2B94%C2%A0772%20930%20712>* >> >> Lean . Enterprise . Middleware >> > > > > -- > Kasun Indrasiri > Software Architect > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > cell: +94 77 556 5206 > Blog : http://kasunpanorama.blogspot.com/ > -- *Ravi Undupitiya* Software Engineer; WSO2 Inc.; http://wso2.com *E-mail: [email protected] <http://wso2.com>**M: **+94 772 930 712* Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
