在WSO2中读取纯文本响应
我是WSO2的新手。我正在使用wso2esb-4.7.0。我想做的是 (a) 叫一个休息服务员。rest服务的输入是XML。我已经创建了一个代理,并且正在使用tryIT UI传递输入XML (2) rest服务的一个示例响应是[1234],我需要从中提取字符串1234并分配给变量以进行进一步处理。 我的TCP监视器显示正确的响应来自后端rest服务。我尝试了各种方法来读取响应和提取字符串,但运气不好 此外,tryIt UI将响应显示为SomeJunkValue 现在是定义在WSO2中读取纯文本响应,wso2,Wso2,我是WSO2的新手。我正在使用wso2esb-4.7.0。我想做的是 (a) 叫一个休息服务员。rest服务的输入是XML。我已经创建了一个代理,并且正在使用tryIT UI传递输入XML (2) rest服务的一个示例响应是[1234],我需要从中提取字符串1234并分配给变量以进行进一步处理。 我的TCP监视器显示正确的响应来自后端rest服务。我尝试了各种方法来读取响应和提取字符串,但运气不好 此外,tryIt UI将响应显示为SomeJunkValue 现在是定义 <proxy x
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="testUpdateSubstanceProxy"
transports="http"
statistics="enable"
trace="enable"
startOnLoad="true">
<target inSequence="callUpdateSubstanceURISequnec">
<outSequence>
<property name="messageType" value="text/plain" scope="axis2"/>
<send/>
</outSequence>
</target>
<description/>
</proxy>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="callUpdateSubstanceURISequnec" onError="fault" trace="enable">
<property name="messageType" value="text/plain" scope="axis2"/>
<send receive="gov:/receiveSubstanceIdSequnce">
<endpoint key="gov:/CallUpdateURISubstanceAddressPoint"/>
</send>
</sequence>
<sequence name="receiveSubstanceIdSequnce" xmlns="http://ws.apache.org/ns/synapse">
<send/>
<!-- A sample response is [1234]. How do I extract 1234 from the response and assign it to a variable-->
</sequence>
<endpoint xmlns="http://ws.apache.org/ns/synapse">
<address uri="http://localhost:7014/ourURL" format="pox">
<suspendOnFailure>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
<retryDelay>0</retryDelay>
</markForSuspension>
</address>
</endpoint>
1
0
0
尝试使用
<property xmlns:m0="http://ws.apache.org/commons/ns/payload"
name="payload"
expression="$body/m0:text"/>
这将把文本内容读取到一个名为
有效负载的属性中。我最后编写了类中介来处理这个问题。想知道是否有更好的方法后端服务是否以json方式发送响应?是的。答案就像[x,y]我最终写了类中介来处理这个问题。想知道有没有更好的