在Apigee中从XML中提取变量

在Apigee中从XML中提取变量,xml,apigee,Xml,Apigee,在使用Apigee时,我对此URL“”进行了服务调用,并将内容保存在“callout响应”中。 因此,现在的响应应该包含以下内容: > wb:countries xmlns:wb="http://www.worldbank.org" page="1" pages="1" per_page="50" total="1"> <wb:country id="BRA"> <wb:iso2Code>BR</wb:iso2Code> <wb:name&g

在使用Apigee时,我对此URL“”进行了服务调用,并将内容保存在“callout响应”中。 因此,现在的响应应该包含以下内容:

> wb:countries xmlns:wb="http://www.worldbank.org" page="1" pages="1" per_page="50" total="1">
<wb:country id="BRA">
<wb:iso2Code>BR</wb:iso2Code>
<wb:name>Brazil</wb:name>
<wb:region id="LCN">Latin America & Caribbean (all income levels)</wb:region>
<wb:adminregion id="LAC">Latin America & Caribbean (developing only)</wb:adminregion>
<wb:incomeLevel id="UMC">Upper middle income</wb:incomeLevel>
<wb:lendingType id="IBD">IBRD</wb:lendingType>
<wb:capitalCity>Brasilia</wb:capitalCity>
<wb:longitude>-47.9292</wb:longitude>
<wb:latitude>-15.7801</wb:latitude>
</wb:country>
</wb:countries

>

有人能帮我解决这个问题吗?

尝试只指定callout响应-我认为您不需要变量名的“.content”部分。

是的,您是对的。这是因为我使用javascript将XML对象存储到变量中,结果弄糊涂了。我把它拿走了:)
<ExtractVariables name="ExtractVariables4">
   <Source>calloutResponse.content</Source>
   <XMLPayload>
      <Namespaces>
        <Namespace prefix="dir">http://www.worldbank.org" page="1" pages="1" per_page="50" total="1</Namespace>
      </Namespaces>
      <Variable name="extraction" >
         <XPath>/dir:countries/dir:country/dir:name</XPath>
      </Variable>  
   </XMLPayload>
   <VariablePrefix>directionsresponse</VariablePrefix>
</ExtractVariables>
"{"fault":"{\"detail\":{\"errorcode\":\"steps.extractvariables.ExecutionFailed\"},\"faultstring\":\"Failed to execute the ExtractVariables: ExtractVariables4\"}"}"