Hi Ravindi,

AFAIU this error happens due to the client gets a HTTP 202 accept response,
generated by ESB before it sends the original response from the backend.
Therefore ESB can't send the original response to the client as it has
already sent a "HTTP 202 accept" response.


On Thu, Mar 17, 2016 at 8:30 PM, Ravindi De silva <ravi...@wso2.com> wrote:

> Hi  all,
>
>
> I tried writing a proxy service in the ESB to get the project details from
> jira using getProject method and then create that project in redmine using
> createProject if it is not already created in it. I have used the jira and
> redmine connectors in ESB. The proxy I have written is shown in [1].
>
> When I send the request to the proxy using SoapUI I get an error [2]. But
> the project of which the details were taken from jira if not present in
> redmine has been created in it. How can I fix the issue of getting an error
> ?
>
>
> [1]
> <proxy xmlns="http://ws.apache.org/ns/synapse";
>        name="newConnectJiraRedmine"
>        transports="http,https"
>        statistics="disable"
>        trace="disable"
>        startOnLoad="true">
>    <target>
>       <inSequence>
>          <property name="responseType"
> expression="json-eval($.responseType)"/>
>          <property name="login" expression="json-eval($.login)"/>
>          <property name="password" expression="json-eval($.password)"/>
>          <property name="firstname" expression="json-eval($.firstname)"/>
>          <property name="lastname" expression="json-eval($.lastname)"/>
>          <property name="mail" expression="json-eval($.mail)"/>
>          <property name="authSourceId"
> expression="json-eval($.authSourceId)"/>
>          <property name="id" expression="json-eval($.id)"/>
>          <property name="name" expression="json-eval($.name)"/>
>          <property name="identifier" expression="json-eval($.identifier)"/>
>          <property name="description"
> expression="json-eval($.description)"/>
>          <property name="include" expression="json-eval($.include)"/>
>          <property name="projectId" expression="json-eval($.projectId)"/>
>          <property name="trackerId" expression="json-eval($.trackerId)"/>
>          <property name="statusId" expression="json-eval($.statusId)"/>
>          <property name="priorityId" expression="json-eval($.priorityId)"/>
>          <property name="subject" expression="json-eval($.subject)"/>
>          <property name="categoryId" expression="json-eval($.categoryId)"/>
>          <property name="fixedVersionId"
> expression="json-eval($.fixedVersionId)"/>
>          <property name="assignedToId"
> expression="json-eval($.assignedToId)"/>
>          <property name="parentIssueId"
> expression="json-eval($.parentIssueId)"/>
>          <property name="customFields"
> expression="json-eval($.customFields)"/>
>          <property name="watcherUserIds"
> expression="json-eval($.watcherUserIds)"/>
>          <property name="uploads" expression="json-eval($.uploads)"/>
>          <property name="createdOn" expression="json-eval($.createdOn)"/>
>          <property name="updatedOn" expression="json-eval($.updatedOn)"/>
>          <property name="offset" expression="json-eval($.offset)"/>
>          <property name="limit" expression="json-eval($.limit)"/>
>          <property name="sort" expression="json-eval($.sort)"/>
>          <property name="notes" expression="json-eval($.notes)"/>
>          <property name="issueId" expression="json-eval($.issueId)"/>
>          <property name="spentOn" expression="json-eval($.spentOn)"/>
>          <property name="hours" expression="json-eval($.hours)"/>
>          <property name="activityId" expression="json-eval($.activityId)"/>
>          <property name="comments" expression="json-eval($.comments)"/>
>          <property name="attachmentId"
> expression="json-eval($.attachmentId)"/>
>          <property name="status" expression="json-eval($.status)"/>
>          <property name="name" expression="json-eval($.name)"/>
>          <property name="groupId" expression="json-eval($.groupId)"/>
>          <property name="userId" expression="json-eval($.userId)"/>
>          <property name="jiraProjectName"
>                    expression="json-eval($.jiraProjectName)"
>                    scope="operation"/>
>          <property name="username" value="ravindi" scope="default"
> type="STRING"/>
>          <property name="password"
>                    value="ravindi123"
>                    scope="default"
>                    type="STRING"/>
>          <property name="uri"
>                    value="http://192.168.57.131:8080";
>                    scope="default"
>                    type="STRING"/>
>          <property name="projectIdOrKey"
>                    value="TESPROJ"
>                    scope="default"
>                    type="STRING"/>
>          <property name="apiUrl"
>                    value="http://anthonyrava.m.redmine.org/";
>                    scope="default"
>                    type="STRING"/>
>          <property name="apiKey"
>                    value="7855e5ee84e3f97b02e23ea96f3d69f740399860"
>                    scope="default"
>                    type="STRING"/>
>          <property name="responseType" value="json" scope="default"
> type="STRING"/>
>          <jira.init>
>             <username>{$ctx:username}</username>
>             <password>{$ctx:password}</password>
>             <uri>{$ctx:uri}</uri>
>          </jira.init>
>          <jira.getProject>
>             <projectIdOrKey>{$ctx:projectIdOrKey}</projectIdOrKey>
>          </jira.getProject>
>          <property name="jPName" expression="json-eval($.name)"/>
>          <property name="jPDecscription"
> expression="json-eval($.description)"/>
>          <property name="jPId" expression="json-eval($.id)"/>
>          <log level="custom">
>             <property name="99999999999999"
> expression="get-property('jPName')"/>
>             <property name="99999999999999"
> expression="get-property('jPDecscription')"/>
>             <property name="99999999999999"
> expression="get-property('jPId')"/>
>          </log>
>          <redmine.init>
>             <apiUrl>{$ctx:apiUrl}</apiUrl>
>             <apiKey>{$ctx:apiKey}</apiKey>
>             <responseType>{$ctx:responseType}</responseType>
>          </redmine.init>
>          <redmine.listProjects/>
>          <iterate continueParent="true"
>                   id="activityTypes"
>                   expression="//projects"
>                   sequential="true">
>             <target>
>                <sequence>
>                   <property name="rPName" expression="//name"/>
>                   <log level="custom">
>                      <property name="1212111121121"
> expression="get-property('jPName')"/>
>                      <property name="1212111121121"
> expression="//identifier"/>
>                      <property name="1212111121121"
> expression="get-property('rPName')"/>
>                   </log>
>                   <filter
> xpath="get-property('jPName')=get-property('rPName')">
>                      <then>
>                         <log level="custom">
>                            <property name="1212111121121"
> expression="//name"/>
>                            <property name="1212111121121"
> expression="//identifier"/>
>                         </log>
>                      </then>
>                      <else>
>                         <log level="custom">
>                            <property name="00000000000000000000"
> expression="//identifier"/>
>                         </log>
>                         <redmine.init>
>                            <apiUrl>{$ctx:apiUrl}</apiUrl>
>                            <apiKey>{$ctx:apiKey}</apiKey>
>                            <responseType>{$ctx:responseType}</responseType>
>                         </redmine.init>
>                         <redmine.createProject>
>                            <description>{$ctx:jPDecscription}</description>
>                            <name>{$ctx:jPName}</name>
>                            <identifier>te1290123</identifier>
>                         </redmine.createProject>
>                      </else>
>                   </filter>
>                   <respond/>
>                </sequence>
>             </target>
>          </iterate>
>       </inSequence>
>       <outSequence>
>          <send/>
>       </outSequence>
>    </target>
>    <description/>
> </proxy>
>
>
> [2]
>
> [2016-03-17 17:03:33,688] ERROR - PassThroughHttpSender Failed to submit
> the response
> java.lang.NullPointerException
>     at
> org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
>     at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>     at
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
>     at
> org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:28)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>     at
> org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:241)
>     at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
>     at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
>     at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:529)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>     at
> org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:247)
>     at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>     at java.lang.Thread.run(Thread.java:745)
> [2016-03-17 17:03:33,694] ERROR - Axis2Sender
> Cache-Control:no-cache,Content-Type:application/json; charset=utf-8,<?xml
> version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><jsonObject><errors>Identifier
> has already been
> taken</errors></jsonObject></soapenv:Body></soapenv:Envelope> Unexpected
> error sending message back
> org.apache.axis2.AxisFault: Failed to submit the response
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:610)
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:269)
>     at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>     at
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
>     at
> org.apache.synapse.mediators.builtin.RespondMediator.mediate(RespondMediator.java:28)
>     at
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
>     at
> org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:241)
>     at
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:267)
>     at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:679)
>     at
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:244)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:529)
>     at
> org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:172)
>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>     at
> org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:247)
>     at
> org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>     at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.NullPointerException
>     at
> org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:64)
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:462)
>     at
> org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:267)
>     ... 16 more
>
>
>
>
> --
> Ravindi de Silva
> *Software Engineer- Intern*
> Mobile : +94 (0) 779689620
> ravi...@wso2.com
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Thusitha Dayaratne
Software Engineer
WSO2 Inc. - lean . enterprise . middleware |  wso2.com

Mobile  +94712756809
Blog      alokayasoya.blogspot.com
About    http://about.me/thusithathilina
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to