我是网络服务的新手,不知怎的,我使用wso2 esb 4.0.6在http / https上创建了一个简单的网络服务。现在我的要求是从响应中删除标记,即我需要明文作为回应,下面的代码片段将简要介绍我的要求。
<case regex="POST">
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
<enrich>
<source type="inline" clone="true">
<success xmlns="">Your request for subscription is being processed.</success>
</source>
<target type="body"/>
</enrich>
<header name="To" action="remove"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="ContentType" value="text/plain" scope="axis2"/>
</case>
我能够得到以下回复<success>Your request for subscription is being processed.</success>
我只是想从响应中删除<success> </success>
标记。
提前致谢
答案 0 :(得分:2)
可能有点迟了,但最近我也遇到过这个问题,以及如何让它发挥作用。
在您的代理服务集'messageType'属性中,如下所示
添加有效内容文本元素。请参阅下面给出的样本代理服务的输出顺序
<outSequence> <payloadFactory> <format> <ms11:text xmlns:ms11="http://ws.apache.org/commons/ns/payload">$1</ms11:text> </format> <args> <arg xmlns:ns="http://www.wso2.org/types" expression="$body/ns:greetResponse/return/text()"/> </args> </payloadFactory> <property name="messageType" value="text/plain" scope="axis2"/> <log level="full"/> <send/> </outSequence>
在这种情况下,我对后端服务(HelloService)的响应如下。
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:greetResponse xmlns:ns="http://www.wso2.org/types">
<return>Hello World, Test !!!</return>
</ns:greetResponse>
</soapenv:Body>
</soapenv:Envelope>
请参阅下面使用curl命令的GET请求的请求和响应
curl -X GET "http://localhost:8280/services/TestProxy/greet?name=Test" -v
* About to connect() to localhost port 8280 (#0)
* Trying 127.0.0.1... connected
> GET /services/TestProxy/greet?name=Test HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost:8280
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=UTF-8
< Server: WSO2 Carbon Server
< Vary: Accept-Encoding
< Date: Wed, 25 Sep 2013 06:08:21 GMT
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0
Hello World, Test !!!
由于 Sajith
答案 1 :(得分:0)
只需将完整信封定义为内联源。 例如:
<inSequence>
<enrich>
<source type="inline" clone="true">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body> Your request for subscription is being processed. </soapenv:Body>
</soapenv:Envelope>
</source>
<target type="envelope"/>
</enrich>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="Content-Type" value="text/plain" scope="transport" type="STRING"/>
<send/>
</inSequence>