不使用 wso2 ESB REST API 发送 SOAP 消息 [英] SOAP messages are not sent using wso2 ESB REST API

查看:52
本文介绍了不使用 wso2 ESB REST API 发送 SOAP 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 wso2 ESB 将 SOAP 后端公开为 REST API.我正在使用有效载荷工厂发送肥皂正文消息,但它不起作用.

I'm trying to expose SOAP backend as REST API using wso2 ESB. I'm using payload factory to send the soap body message, but it doesn't work.

这是我在 wso2 esb 代码中的 API 资源:

This is my API resource in wso2 esb code :

<?xml version="1.0" encoding="UTF-8"?>
<api context="/akademik" name="SampleAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/students?symbol={symbol}">
    <inSequence>
        <log level="custom">
            <property expression="$url:symbol" name="symbol"/>
        </log>
        <payloadFactory media-type="xml">
            <format>
                <soapenv:Envelope xmlns:sem="http://semogabisa.te.net/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                    <soapenv:Header/>
                    <soapenv:Body>
                        <sem:sayHi>
                            <arg0>$1</arg0>
                        </sem:sayHi>
                    </soapenv:Body>
                </soapenv:Envelope>
            </format>
            <args>
                <arg evaluator="xml" expression="$url:symbol"/>
            </args>
        </payloadFactory>
        <header scope="default">
            <m:complexHeader xmlns:m="http://org.synapse.example">
                <m:property key="Content-Type" value="application/xml"/>
            </m:complexHeader>
        </header>
        <send>
            <endpoint>
                <address format="soap11" uri="http://localhost:8084/HelloWorld"/>
            </endpoint>
        </send>
    </inSequence>
    <outSequence>
        <send/>
    </outSequence>
    <faultSequence/>
</resource>

Soap 消息不会发送到后端 Web 服务,它显示为 null.

Soap messages are not sent to the backend web service, it says null.

我已经使用 SOAPUI 以相同的肥皂信封格式测试了后端服务,并且它正在运行

I've test the backend service with SOAPUI with same soap envelope format and it's working

推荐答案

我认为您在标题调解器上犯了一些错误.HelloWorld"后端服务不需要基于您的 SOAP UI 请求的 SOAP 标头.所以删除标题中介.

I think you make some mistake on the header mediator. "HelloWorld" back end service didn't need the SOAP header based on your SOAP UI request. so remove the header mediator.

如果您想操作 SOAP 标头,请选择 Synapse.如果您想操作 HTTP 标头,请选择传输.

Select Synapse if you want to manipulate SOAP headers. Select Transport if you want to manipulate HTTP headers.

看起来后端是 SOAP11,SOAP11 类型是text/xml".您可能需要设置此属性.

And it's seems back end is SOAP11, SOAP11 type is "text/xml". Your may need set this property.

<property name="messageType" value="text/xml" scope="axis2"/>

当您从 ESB 发送消息时,您需要设置属性messageType",然后 ESB 将格式化匹配后端所需的消息.

When you send message out from ESB, you need set property "messageType", then ESB will formatter the message that match back end required.

如果您发现 ESB 在向后端发送消息时将一些上下文附加到后端 URI,您可能需要此属性.

You may probably need this property, if you found ESB append some context to your back end URI when send message to back end.

<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/> 

好的提示:
请打开您的synapse.transport.http.wire"作为调试,这将输出从 ESB 进出的每条消息.此日志将包括 HTTP 标头和正文.拿到连线日志后,可以将连线日志与您的SOAPUI请求进行比较,然后找出哪一部分是错误的.
https://docs.wso2.com/display/ESB481/Setting+Up+记录

这篇关于不使用 wso2 ESB REST API 发送 SOAP 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆