我有一个SAP MII网络服务,当我尝试使用soap ui时,我会回复:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<XacuteResponse xmlns="http://www.sap.com/xMII">
<Rowset>
<Row>
<outxml><![CDATA[<BAPI_PROCORD_GET_LIST>
<INPUT><COLLECTIVE_ORDER/></INPUT>
<OUTPUT><RETURN><TYPE/><ID/><NUMBER>000</NUMBER><MESSAGE/><LOG_NO/><LOG_MSG_NO>000000</LOG_MSG_NO><MESSAGE_V1/><MESSAGE_V2/><MESSAGE_V3/><MESSAGE_V4/><PARAMETER/><ROW>0</ROW><FIELD/><SYSTEM/></RETURN></OUTPUT>
<TABLES><MATERIAL_RANGE><item><SIGN>I</SIGN><OPTION>EQ</OPTION><LOW>RUBBER_COMPOUND</LOW><HIGH/></item></MATERIAL_RANGE><MRP_CNTRL_RANGE/><ORDER_HEADER><item><ORDER_NUMBER>000070001202</ORDER_NUMBER><PRODUCTION_PLANT>3100</PRODUCTION_PLANT><MRP_CONTROLLER/><PRODUCTION_SCHEDULER/><MATERIAL>RUBBER_COMPOUND</MATERIAL><EXPL_DATE>2014-02-03</EXPL_DATE><ROUTING_NO>0000013579</ROUTING_NO><RESERVATION_NUMBER>0000069876</RESERVATION_NUMBER><SCHED_RELEASE_DATE>2014-02-03</SCHED_RELEASE_DATE><ACTUAL_RELEASE_DATE>2014-02-03</ACTUAL_RELEASE_DATE><FINISH_DATE>2014-02-03</FINISH_DATE><START_DATE>2014-02-03</START_DATE><PRODUCTION_FINISH_DATE>2014-02-03</PRODUCTION_FINISH_DATE><PRODUCTION_START_DATE>2014-02-03</PRODUCTION_START_DATE><ACTUAL_START_DATE>2014-02-04</ACTUAL_START_DATE><ACTUAL_FINISH_DATE>0000-00-00</ACTUAL_FINISH_DATE><SCRAP>0</SCRAP><TARGET_QUANTITY>100.000</TARGET_QUANTITY><UNIT>ST</UNIT><UNIT_ISO>PCE</UNIT_ISO><PRIORITY/><ORDER_TYPE>PI01</ORDER_TYPE><ENTERED_BY>277458</ENTERED_BY><ENTER_DATE>2014-02-03</ENTER_DATE><DELETION_FLAG/><WBS_ELEMENT>00000000</WBS_ELEMENT><CONF_NO>0000108111</CONF_NO><CONF_CNT>00000001</CONF_CNT><INT_OBJ_NO>000000000000000000</INT_OBJ_NO><SCHED_FIN_TIME>06:07:49</SCHED_FIN_TIME><SCHED_START_TIME>06:07:49</SCHED_START_TIME><COLLECTIVE_ORDER/><ORDER_SEQ_NO>00000000000000</ORDER_SEQ_NO><FINISH_TIME>06:07:49</FINISH_TIME><START_TIME>06:07:49</START_TIME><ACTUAL_START_TIME>15:43:47</ACTUAL_START_TIME><LEADING_ORDER/><SALES_ORDER/><SALES_ORDER_ITEM>000000</SALES_ORDER_ITEM><PROD_SCHED_PROFILE/><MATERIAL_TEXT>RubberCompound</MATERIAL_TEXT><SYSTEM_STATUS>TECO PCNF MACM SETC
</TABLES>
</BAPI_PROCORD_GET_LIST>]]></outxml>
</Row>
</Rowset>
</XacuteResponse>
</soap:Body>
</soap:Envelope>
问题是,当我通过webservice的代理创建传递然后在soap ui中运行服务时,我从esb获得垃圾值。我想将此响应转换为格式良好的响应xml结构。 我尝试使用xslt,但它在esb中出错,因为无法创建响应结构。在eclipse上运行时相同的xslt工作正常。请帮我。提前致谢并期待您的解决方案。
答案 0 :(得分:0)
CDATA中的XML片段格式不正确(缺少结束标记)。
但是假设您找到了一种方法来纠正这种情况,并且如果帖子中的给定语法正是您所接收的,那么您可以尝试:
1-获取CDATA内容:
<property name="CDATA_CONTENT" expression="$body//outxml"/>
2-使用以下内容创建新的XML属性:
<script language="js">mc.setProperty("XML_CONTENT",new XML(new XML(mc.getProperty('CDATA_CONTENT'))));</script>
3-从此XML片段中提取值:
<log level="custom">
<property name="result" expression="get-property('XML_CONTENT')"/>
<property name="orderNumber" expression="get-property('XML_CONTENT')//ORDER_NUMBER/text()"/>
</log>
4-使用此XML片段更改当前消息有效内容:
<script language="js">mc.setPayloadXML(new XML(new XML(mc.getProperty('CDATA_CONTENT'))));</script>