HI i have upgraded wso2esb 4.7.0 to wso2esb 4.8.0
I have a login service which will do authentication of username and password and returns me true or false,It works fine in 4.7.0 version but in 4.8.0 version its not working.
when this service is called internally from any other proxy its returning true for a valid user for that proxy,But when am calling it directly its returning me null and throwing error in esb as shown below.
ERROR {org.apache.axis2.transport.base.threads.NativeWorkerPool} - Uncaught exception {org.apache.axis2.transport.base.threads.NativeWorkerPool}
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.apache.axiom.soap.SOAPFault
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.getFault(SOAPBodyImpl.java:120)
at org.apache.synapse.util.POXUtils.convertSOAPFaultToPOX(POXUtils.java:46)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:93)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:321)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:94)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:160)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:261)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:486)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Am using curl for direct execution
curl -v -H "Accept: application/json" -H "Content-Type:application/json" -d '{"username":"vikash|214057357158656","password":"gbadmin"}' http://redmine.youtility.in:8282/services/ServiceLogin2.0
axix2.xml message Formatters and builder
<messageFormatter contentType="application/json"
class="org.apache.axis2.json.JSONMessageFormatter"/>
<messageFormatter contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
<messageBuilder contentType="application/json"
class="org.apache.axis2.json.JSONBuilder"/>
<messageBuilder contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ServiceLogin2.0"
transports="https http"
statistics="enable"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence onError="fault">
<property name="messageType" value="application/json" scope="axis2"/>
<property name="client_ip_address"
expression="get-property('axis2','REMOTE_ADDR')"
scope="default"
type="STRING"/>
<property name="username"
expression="//username/text()"
scope="default"
type="STRING"/>
<property name="password"
expression="//password/text()"
scope="default"
type="STRING"/>
<property name="usercode"
expression="fn:substring-before(get-property('username'),'|')"
scope="default"
type="STRING"/>
<property name="clientid"
expression="fn:substring-after(get-property('username'),'|')"
scope="default"
type="STRING"/>
<property name="requestMsgId"
expression="get-property('MessageID')"
scope="default"
type="STRING"/>
<log level="custom">
<property name="LogLocation" value="ServiceLogin2.0"/>
<property name="Usercode" expression="get-property('usercode')"/>
<property name="Clientid" expression="get-property('clientid')"/>
<property name="requestMsgId" expression="get-property('requestMsgId')"/>
</log>
<payloadFactory>
<format>
<p:login xmlns:p="http://authentication.services.core.carbon.wso2.org">
<p:username>$1</p:username>
<p:password>$2</p:password>
<p:remoteAddress>$3</p:remoteAddress>
</p:login>
</format>
<args>
<arg evaluator="xml" expression="//username/text()"/>
<arg evaluator="xml" expression="//password/text()"/>
<arg evaluator="xml" expression="get-property('client_ip_address')"/>
</args>
</payloadFactory>
<header name="Action" value="urn:login"/>
<send receive="ServiceLogin_Seq2.0">
<endpoint>
<address uri="https://localhost:9443/services/AuthenticationAdmin"
format="soap11">
<suspendOnFailure>
<errorCodes>101500,101501,101506,101507,101508,101503,50000</errorCodes>
<initialDuration>30</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>300</maximumDuration>
</suspendOnFailure>
</address>
</endpoint>
</send>
</inSequence>
<outSequence onError="fault">
<send/>
</outSequence>
</target>
</proxy>
Sequence:
<sequence xmlns="http://ws.apache.org/ns/synapse"
name="ServiceLogin_Seq2.0"
onError="fault" statistics="enable">
<property name="messageType" value="application/json" scope="axis2"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<property name="HTTP_METHOD" value="POST" scope="axis2"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property xmlns:ns="http://org.apache.synapse/xsd"
xmlns:p="http://authentication.services.core.carbon.wso2.org"
name="Return"
expression="//p:return/text()"
scope="default"
type="STRING"/>
<filter xmlns:ns="http://org.apache.synapse/xsd" xpath="get-property('Return')=''">
<then>
<payloadFactory>
<format>
<ResponseJSON xmlns="">
<Authentication>$1</Authentication>
<Exception>Service trying to connect inactive service</Exception>
<Status>101503</Status>
</ResponseJSON>
</format>
<args>
<arg evaluator="xml" expression="get-property('Return')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<filter xpath="get-property('Return')='false'">
<then>
<payloadFactory>
<format>
<ResponseJSON xmlns="">
<Authentication>$1</Authentication>
<Exception>Authentication Failed</Exception>
<Status>401</Status>
</ResponseJSON>
</format>
<args>
<arg evaluator="xml" expression="get-property('Return')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<payloadFactory>
<format>
<ResponseJSON xmlns="">
<Body>
<Datalist>
<Authentication>$1</Authentication>
</Datalist>
</Body>
</ResponseJSON>
</format>
<args>
<arg evaluator="xml" expression="get-property('Return')"/>
</args>
</payloadFactory>
<send/>
</else>
</filter>
</else>
</filter>
<log level="custom">
<property name="LogLocation" value="ServiceLogin_Seq2.0"/>
<property name="Usercode" expression="get-property('usercode')"/>
<property name="Clientid" expression="get-property('clientid')"/>
<property name="requestMsgId" expression="get-property('requestMsgId')"/>
<property name="responseMsgId" expression="get-property('MessageID')"/>
</log>
</sequence>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…