WSO2 ESB-请求后的错误响应-内容类型应用程序/ x-www-form-urlencoded

时间:2019-04-17 07:09:16

标签: wso2 wso2esb wso2ei

我正在使用WSO2 EI 6.3v。我想将application / x-www-form-urlencoded数据传递给rezlive酒店供应商。在听到我把我的代码和响应。

代码

<inSequence>
        <log category="WARN" level="full">
            <property name="API BEGIN" value="Test_Supplier API"/>
        </log>
        <payloadFactory media-type="xml">
            <format>
                <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                    <soapenv:Body>
                        <HotelFindRequest xmlns="">
                            $1
                        </HotelFindRequest>
                    </soapenv:Body>
                </soapenv:Envelope>
            </format>
            <args>
                <arg evaluator="xml" expression="$env/*[local-name()='Body']/*[local-name()='HotelFindRequest']/*"/>
            </args>
        </payloadFactory>
        <property expression="$env/*[local-name()='Body']/*" name="xmlbody" scope="default" type="STRING"/>
        <log>
            <property expression="$ctx:xmlbody" name="Body======="/>
        </log>
        <property name="messageType" scope="axis2" type="STRING" value="application/x-www-form-urlencoded"/>
        <property expression="$body" name="payload" scope="default" type="STRING"/>
        <property name="uri.var.url" scope="default" type="STRING" value="http://test.xmlhub.com/testpanel.php/action/findhotel"/>
        <call>
            <endpoint>
                <address format="pox" uri="http://test.xmlhub.com/testpanel.php/action/findhotel?XML={xmlbody}"/>
            </endpoint>
        </call>
        <respond/>
</inSequence>

身体日志

<HotelFindRequest>
<Authentication>
    <AgentCode>xxxxxxx</AgentCode>
    <UserName>xxxxx</UserName>
    <Password>xxxxxx</Password>
</Authentication>
<Booking>
    <ArrivalDate>22/05/2019</ArrivalDate>
    <DepartureDate>25/05/2019</DepartureDate>
    <CountryCode>AE</CountryCode>
    <City>968</City>
    <GuestNationality>LK</GuestNationality>
    <HotelRatings>
        <HotelRating>1</HotelRating><HotelRating>2</HotelRating>
        <HotelRating>3</HotelRating><HotelRating>4</HotelRating>
        <HotelRating>5</HotelRating>
    </HotelRatings>
    <Rooms>
        <Room>
            <Type>Room-1</Type>
            <NoOfAdults>2</NoOfAdults>
            <NoOfChilds>0</NoOfChilds>
        </Room>
        <Room>
            <Type>Room-2</Type>
            <NoOfAdults>1</NoOfAdults>
            <NoOfChilds>0</NoOfChilds>
        </Room>
        <Room>
            <Type>Room-3</Type>
            <NoOfAdults>2</NoOfAdults>
            <NoOfChilds>0</NoOfChilds>
        </Room>
        <Room>
            <Type>Room-4</Type>
            <NoOfAdults>3</NoOfAdults>
            <NoOfChilds>0</NoOfChilds>
        </Room>
    </Rooms>
</Booking>

回复

<HotelFindResponse>
<error>Please provide agentcode.</error>
<error>Please provide username.</error>
<error>Please provide password.</error></HotelFindResponse>

但是我在POSTMAN中通过了相同的配置,请给我正确的答案。

enter image description here

我在Postman中放置了相同的配置。我尝试了很多方法来获得回应,但都失败了。 该代码有什么问题? 请帮忙。

3 个答案:

答案 0 :(得分:1)

您可以使用post尝试使用HTTP端点(https://docs.wso2.com/display/EI640/HTTP+Endpoint)吗?

有效载荷工厂已经设置了主体,因此它应立即运行,因为它将尝试过帐。

答案 1 :(得分:0)

尝试使用“ uri.var.xmlBody”属性名称代替简单的“ xmlBody”:

<property expression="$env/*[local-name()='Body']/*" name="uri.var.xmlBody" scope="default" type="STRING"/>

<call>
        <endpoint>
            <address format="pox" uri="http://test.xmlhub.com/testpanel.php/action/findhotel?XML={uri.var.xmlBody}"/>
        </endpoint>
</call>

答案 2 :(得分:0)

您可以试试吗? from here

public class ViewModel : INotifyPropertyChanged
{
    private readonly AxisVM axis;

    public ViewModel()
    {
        axis = new AxisVM();
        axis.PropertyChanged += Axis_PropertyChanged;      
    }

    private void Axis_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        FireOnPropertyChanged(nameof(SomeDouble));
    }

    ...
}