WSO2 APIM系统无法从/devtest/1.0/users/admin推断传输信息

时间:2014-12-02 08:24:41

标签: http wso2 wso2esb wso2-am

您好我有一个带有自定义序列(dblookup& switch sequence)的API,它将验证用户是否存在于数据库中,如果不是,它应该发送http状态401:Unauthorized,下面是案例代码但是我总是得到错误无法推断出运输信息。发回响应消息的正确方法是什么。

谢谢, 德鲁

<case regex="0">
            <log level="custom">
                <property name="ucount" expression="fn:concat('User login - ', get-property('employee_count'))"/>
            </log>
         <send>
                <property name="RESPONSE" value="true" scope="default"/>
                <property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
                <property name="HTTP_SC" value="401" scope="axis2"/>
                <header name="To" action="remove"/>      
                <payloadFactory media-type="xml"> 
                    <format> 
                        <response> 
                            <result>Unauthorized</result> 
                        </response> 
                    </format> 
                    <args/> 
                </payloadFactory> 
         <send/>
        </case>

ERROR:

TID: [0] [AM] [2014-12-02 08:16:30,852] ERROR {org.apache.synapse.core.axis2.Axis2Sender} -  Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
org.apache.axis2.AxisFault: The system cannot infer the transport information from the /devtest/1.0/users/admin URL.
        at org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:81)
        at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:115)
        at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
        at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
        at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)
        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.config.xml.AnonymousListMediator.mediate(AnonymousListMediator.java:30)
        at org.apache.synapse.config.xml.SwitchCase.mediate(SwitchCase.java:66)
        at org.apache.synapse.mediators.filters.SwitchMediator.mediate(SwitchMediator.java:123)
        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.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.mediate(APIManagerExtensionHandler.java:64)
        at org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler.handleRequest(APIManagerExtensionHandler.java:180)
        at org.apache.synapse.rest.API.process(API.java:285)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:83)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:64)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
        at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344)
        at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:168)
        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:744)
TID: [0] [AM] [2014-12-02 08:16:30,853]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  STATUS = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Unexpected error during sending message out {org.apache.synapse.mediators.builtin.LogMediator}

2 个答案:

答案 0 :(得分:3)

send mediator范围内,您无法定义其他调解员。

这样纠正;

    <property name="RESPONSE" value="true" scope="default"/>
                <property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
                <property name="HTTP_SC" value="401" scope="axis2"/>
                <header name="To" action="remove"/>      
                <payloadFactory media-type="xml"> 
                    <format> 
                        <response> 
                            <result>Unauthorized</result> 
                        </response> 
                    </format> 
                    <args/> 
                </payloadFactory> 


 <send>
           endpoint>
            <address uri="ADDRESS OF YOUR ENDPOINT"/>
        </endpoint> 
         </send>

答案 1 :(得分:0)

在我的情况下,前面有一些看不见的字符,这些字符会改正(生产/沙盒)URL。

WSO2似乎非常严格,无法解释这样的定义,从而导致模糊的错误:

The system cannot infer the transport information from the https://...

注意 the https 之间的两个空格。可能是制表符。