wso2esb 4.9.0中的非法字符错误

时间:2015-10-12 12:54:18

标签: properties wso2 axis2 wso2esb wso2carbon

您正在使用wso2esb 4.9.0 am遇到错误时“。

ERROR - AnonymousListMediator javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1092]
Message: Illegal character: <T>
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1092]
Message: Illegal character: <T>
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:336)
    at org.apache.axiom.om.impl.traverse.OMChildElementIterator.next(OMChildElementIterator.java:104)
    at org.apache.synapse.mediators.transform.PayloadFactoryMediator.replace(PayloadFactoryMediator.java:305)
    at org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(PayloadFactoryMediator.java:144)
    at org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(PayloadFactoryMediator.java:93)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:30)
    at org.apache.synapse.mediators.filters.FilterMediator.mediate(FilterMediator.java:197)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:290)
    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:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1092]
Message: Illegal character: <T>
    at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.hasNext(AbstractXMLStreamReader.java:449)
    at org.apache.synapse.commons.staxon.core.base.AbstractXMLStreamReader.next(AbstractXMLStreamReader.java:456)
    at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)

如果从wso2dss传递的数据库列值如Potential“client”,则esb开始在esb控制台中抛出此错误。

如何避免此错误,以便有效负载可以读取包含“并给出成功响应的值。

消息格式化程序和构建器:

<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 xmlns="http://ws.apache.org/ns/synapse"
       name="GetUserPartybranchlist"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence onError="fault">
         <property name="messageType"
                   value="application/json"
                   scope="default"
                   type="STRING"/>
         <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
         <property name="userid" expression="get-property('transport', 'userid')"/>
         <property name="ModifiedOn" expression="get-property('transport', 'ModifiedOn')"/>
         <property name="username" expression="get-property('transport', 'username')"/>
         <property name="password" expression="get-property('transport', 'password')"/>
         <payloadFactory media-type="xml">
            <format>
               <send xmlns="">
                  <username>$1</username>
                  <password>$2</password>
               </send>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('username')"/>
               <arg evaluator="xml" expression="get-property('password')"/>
            </args>
         </payloadFactory>
         <send receive="UserPartybranchlist_seq">
            <endpoint>
               <address uri="http://redmine.youtility.in:8282/services/ServiceLogin2.0"
                        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>

序列1:

<sequence xmlns="http://ws.apache.org/ns/synapse"
          name="UserPartybranchlist_seq"
          onError="fault" statistics="enable">
   <property name="messageType" value="application/json" scope="axis2"/>
   <property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             name="Authentication"
             expression="//Authentication/text()"/>
  <filter xmlns:ns="http://org.apache.synapse/xsd"
           xpath="get-property('Authentication')=''">
      <then>
         <payloadFactory>
            <format>
               <ResponseJSON xmlns="">
                  <Body>
                     <Data>
                        <Exception>Service trying to connect inactive service</Exception>
                     </Data>
                  </Body>
                  <Status>101503</Status>
               </ResponseJSON>
            </format>
            <args/>
         </payloadFactory>
    <property name="messageType" value="application/json" scope="axis2"/>
         <property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
         <property name="RESPONSE" value="true" scope="default" type="STRING"/>
         <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
         <send/>
      </then>
      <else>
         <filter xpath="get-property('Authentication')='false'">
            <then>
               <payloadFactory>
                  <format>
                     <ResponseJSON xmlns="">
                        <Exception>Authentication Failed</Exception>
                        <Status>401</Status>
                     </ResponseJSON>
                  </format>
                  <args/>
               </payloadFactory>
        <property name="messageType" value="application/json" scope="axis2"/>
               <property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
               <property name="RESPONSE" value="true" scope="default" type="STRING"/>
               <send/>
            </then>
            <else>
               <payloadFactory>
                  <format>
                     <p:GetUserPartybranchlist_op xmlns:p="http://ws.wso2.org/dataservice">
                        <p:clientid>$1</p:clientid>
                        <p:userid>$2</p:userid>
                        <p:clientid1>$3</p:clientid1>
                        <p:userid1>$4</p:userid1>
                        <p:userid2>$5</p:userid2>
                        <p:clientid2>$6</p:clientid2>
                        <p:clientid3>$7</p:clientid3>
                     </p:GetUserPartybranchlist_op>
                  </format>
                  <args>
                     <arg evaluator="xml" expression="get-property('clientid')"/>
                     <arg evaluator="xml" expression="get-property('userid')"/>
                     <arg evaluator="xml" expression="get-property('clientid')"/>
                     <arg evaluator="xml" expression="get-property('userid')"/>
                     <arg evaluator="xml" expression="get-property('userid')"/>
                     <arg evaluator="xml" expression="get-property('clientid')"/>
                     <arg evaluator="xml" expression="get-property('clientid')"/>
                  </args>
               </payloadFactory>
               <send receive="UserPartybranchlist_seq2">
                  <endpoint>
                     <address uri="http://localhost:9764/services/UserPartybranchlist_Dataservice/"
                              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>
            </else>
         </filter>
      </else>
   </filter>
</sequence>

序列2:

<sequence xmlns="http://ws.apache.org/ns/synapse"
          name="UserPartybranchlist_seq2"
          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 xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:s="http://ws.wso2.org/dataservice"
             name="Datalist"
             expression="//s:Datalist"
             scope="default"
             type="STRING"/>
   <property xmlns:ns="http://org.apache.synapse/xsd"
             xmlns:s="http://ws.wso2.org/dataservice"
             name="Total"
             expression="count(//s:Datalist)"
             scope="default"
             type="STRING"/>
    <filter xmlns:ns="http://org.apache.synapse/xsd"
           xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"
           xmlns:ns3="http://org.apache.synapse/xsd"
           xpath="get-property('Total')='0.0'">
      <then>
         <property name="RESPONSE" value="true" scope="default" type="STRING"/>
         <payloadFactory>
            <format>
               <ResponseJSON xmlns="">
                  <Body>
                     <Datalist>Not Found</Datalist>
                  </Body>
                  <Status>404</Status>
               </ResponseJSON>
            </format>
            <args/>
         </payloadFactory>
    <property name="messageType" value="application/json" scope="axis2"/>
         <send/>
      </then>
      <else>
         <property name="RESPONSE" value="true" scope="default" type="STRING"/>
         <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
         <payloadFactory>
            <format>
               <ResponseJSON xmlns="">
                  <Body>$1</Body>
                  <Status>200</Status>
                  <Total>$2</Total>
               </ResponseJSON>
            </format>
            <args>
               <arg evaluator="json" expression="$.DataCollection"/>
               <arg evaluator="xml" expression="get-property('Total')"/>
            </args>
         </payloadFactory>
    <property name="messageType" value="application/json" scope="axis2"/>
         <send/>
      </else>
   </filter>
</sequence>

0 个答案:

没有答案