WSO2 ESB 5.0上的运行时错误

时间:2017-01-30 17:33:33

标签: wso2 esb

我正在尝试使用WS02 ESB 5.0每15秒调用一次Web服务,所以我有这个任务:

<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz" name="UpdateName" xmlns="http://ws.apache.org/ns/synapse">
<trigger cron="0/15 * * * * ?" />
<property name="message"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<def:login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:def="http://DefaultNamespace" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xsi:type="xsd:string">usr</id>
<pw xsi:type="xsd:string">pwd</pw>
</def:login>
</property>
<property name="sequenceName" value="main"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks" />
<property name="injectTo" value="sequence"
xmlns:task="http://www.wso2.org/products/wso2commons/tasks" />
</task>

这个序列:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="main" xmlns="http://ws.apache.org/ns/synapse">
<in>
<send>
<endpoint>
<wsdl port="SakaiLogin" service="SakaiLoginService" trace="disable"
uri="http://myserver/sakai-axis/SakaiLogin.jws?wsdl" />
</endpoint>
</send>
</in>
<out>
<send />
</out>
<log level="full" />
</sequence>

两者都来自文档中显示的示例: https://docs.wso2.com/display/ESB500/Adding+and+Scheduling+Tasks(请参阅“将消息注入指定的序列或代理服务”)。 https://docs.wso2.com/display/ESB500/Sample+56:+Using+a+WSDL+Endpoint+as+the+Target+Endpoint(参见“构建示例”)。

但是,一旦启动Carbon WSO2 ESB服务器,我就会收到此错误:

[2017-01-27 17:03:45,005] ERROR - InMediator Runtime error occurred while mediating the message
java.lang.NullPointerException
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.isTransportSwitching(Axis2SynapseEnvironment.java:783)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:545)
        at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
        at org.apache.synapse.endpoints.WSDLEndpoint.send(WSDLEndpoint.java:75)
        at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:121)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
        at org.apache.synapse.mediators.filters.InMediator.mediate(InMediator.java:74)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
        at org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:80)
        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:744)
[2017-01-27 17:03:45,023]  INFO - LogMediator To: , 
MessageID: urn:uuid:097fb69e-6461-428e-ac85-93cfde65d02e, 
Direction: request, 
MESSAGE = Executing default 'fault' sequence, 
ERROR_CODE = 0, 
ERROR_MESSAGE = Runtime error occurred while mediating the message, Envelope:



<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<def:login xmlns:def="http://DefaultNamespace"         xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<id xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">usr</id>
<pw xmlns="http://ws.apache.org/ns/synapse" xsi:type="xsd:string">pwd</pw>
</def:login></soapenv:Body></soapenv:Envelope>

有人能告诉我发生了什么事吗? 非常感谢!

1 个答案:

答案 0 :(得分:2)

在wsdl端点中,uri值必须是WSDL地址,而不是服务端点:

<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="http://ws.apache.org/ns/synapse"
      name="UpdateName"
      class="org.apache.synapse.startup.tasks.MessageInjector"
      group="synapse.simple.quartz">
   <trigger cron="0/15 * * * * ?"/>
   <property name="proxyName" value="testTask"/>
   <property name="message">
      <moc:QRY_SELECT_SRH_EMPLEADO xmlns:moc="http://www.example.org/mockWS/">
         <INT_ID>gero et</INT_ID>
      </moc:QRY_SELECT_SRH_EMPLEADO>
   </property>
   <property name="soapAction"
             value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
   <property name="injectTo" value="proxy"/>
</task>

因此,send mediator中的WSDL端点使用服务和端口名称从WSDL文档中提取服务端点,以在wsdl文档中找到它。

更新1:

我的任务配置xml:

<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main1">
   <in>
      <header name="Action" scope="default" value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
      <send>
         <endpoint>
            <wsdl service="mockWS"
                  port="mockWSSOAP"
                  uri="http://localhost:8088/mockmockWSSOAP?wsdl"/>
         </endpoint>
      </send>
   </in>
   <out>
   <log level="full"/>
<drop/>
   </out>
</sequence>

我的序列名为main1:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testTask"
       transports="https http"
       startOnLoad="true">
   <target>
      <inSequence>
      <header name="Action" scope="default" value="http://www.example.org/mockWS/QRY_SELECT_SRH_EMPLEADO"/>
      <send>
         <endpoint>
            <wsdl service="mockWS"
                  port="mockWSSOAP"
                  uri="http://localhost:8088/mockmockWSSOAP?wsdl"/>
         </endpoint>
      </send>
      </inSequence>
      <outSequence>
         <log level="full"/>
         <drop/>
      </outSequence>
      <faultSequence/>
   </target>
</proxy>

最后我创建了一个具有相同逻辑的代理,因为序列中的drop mediator存在问题:

Private Sub CommandButton1_Click()
Dim firstnum, secondnum As Single
firstnum = Cells(1, 1).Value
secondnum = Cells(1, 2).Value
If firstnum > secondnum Then
MsgBox " The first number is greater than the second number"
If firstnum < secondnum Then
MsgBox " The first number is less than the second number"
Else
MsgBox " They are euqal "
End If

End Sub