当前位置 : 主页 > 网页制作 > xml >

xml – SOAPUI不应用漂亮的打印格式来响应

来源:互联网 收集:自由互联 发布时间:2021-06-13
如何以漂亮的xml格式获得响应. 在编码没有问题并得到所有响应,但是响应是作为单行使用不漂亮的打印格式. 请求Xml soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="ht
如何以漂亮的xml格式获得响应.

在编码没有问题并得到所有响应,但是响应是作为单行使用不漂亮的打印格式.

请求Xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://ctsnis.att.com/ticket/v1" xmlns:v3="http://cio.att.com/commonheader/v3">
   <soapenv:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken>
            <wsse:Username>Test_User</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">!TestInterface!</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
      <wsh:WSHeader xmlns:wsh="http://cio.att.com/commonheader/v3">
         <wsh:WSContext>
            <wsh:FromAppId>Test_User</wsh:FromAppId>
            <wsh:SourceIPAddress>test</wsh:SourceIPAddress>
         </wsh:WSContext>
      </wsh:WSHeader>
   </soapenv:Header>
   <soapenv:Body>
      <v1:ListNotificationDetailsRequest>
         <v3:WSHeader>
            <!--Optional:-->
            <v3:WSEndUserToken>
               <!--Optional:-->
               <v3:Token>?</v3:Token>
               <!--Optional:-->
               <v3:TokenType>?</v3:TokenType>
               <!--Zero or more repetitions:-->
               <v3:WSNameValue>
                  <v3:Name>?</v3:Name>
                  <v3:Value>?</v3:Value>
               </v3:WSNameValue>
            </v3:WSEndUserToken>
            <!--Optional:-->
            <v3:WSContext>
               <!--Optional:-->
               <v3:FromAppId>?</v3:FromAppId>
               <!--Optional:-->
               <v3:ToAppId>?</v3:ToAppId>
               <!--Optional:-->
               <v3:Version>
                  <v3:major>?</v3:major>
                  <v3:minor>?</v3:minor>
               </v3:Version>
               <!--Optional:-->
               <v3:SourceIPAddress>?</v3:SourceIPAddress>
               <!--Zero or more repetitions:-->
               <v3:WSNameValue>
                  <v3:Name>?</v3:Name>
                  <v3:Value>?</v3:Value>
               </v3:WSNameValue>
            </v3:WSContext>
            <!--Optional:-->
            <v3:WSCallback>
               <!--Optional:-->
               <v3:URL>?</v3:URL>
               <!--Optional:-->
               <v3:WSCorrelationId>?</v3:WSCorrelationId>
               <!--Optional:-->
               <v3:FaultURL>?</v3:FaultURL>
            </v3:WSCallback>
            <!--Optional:-->
            <v3:WSConversationId>?</v3:WSConversationId>
            <!--Optional:-->
            <v3:WSMessageData>
               <!--Optional:-->
               <v3:MessageId>?</v3:MessageId>
               <!--Optional:-->
               <v3:RefToMessageId>?</v3:RefToMessageId>
               <!--Optional:-->
               <v3:Timestamp>?</v3:Timestamp>
            </v3:WSMessageData>
            <!--Optional:-->
            <v3:WSResponseMessageExpiration>?</v3:WSResponseMessageExpiration>
            <!--Optional:-->
            <v3:WSEnterpriseLogging>
               <!--Optional:-->
               <v3:ApplicationID>?</v3:ApplicationID>
               <!--Optional:-->
               <v3:LoggingKey>?</v3:LoggingKey>
            </v3:WSEnterpriseLogging>
         </v3:WSHeader>
         <v1:TicketNumber>5671671618722</v1:TicketNumber>
      </v1:ListNotificationDetailsRequest>
   </soapenv:Body>
</soapenv:Envelope>

响应XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:ListNotificationDetailsResponse xmlns="http://cio.att.com/commonheader/v3" xmlns:ns2="http://ctsnis.att.com/ticket/v1"><ns2:ListNotificationDetails><ns2:NotificationDetailsList><ns2:NotificationID>NTMW00127101576</ns2:NotificationID><ns2:SourceID>8888999999</ns2:SourceID><ns2:CUID>zz8000</ns2:CUID><ns2:When>1410053628</ns2:When><ns2:Message>Ticket found in corresponding table. we can use this ticket for further purpose</ns2:Message><ns2:SourceSchemaName>FMS-TroubleTicket</ns2:SourceSchemaName><ns2:Region>SOUTHEAST</ns2:Region><ns2:Market>JACKSONVILLE-PANHANDLE</ns2:Market><ns2:District>ALL</ns2:District><ns2:Zone>ALL</ns2:Zone><ns2:CreateDate>2014-09-07T01:34:05.000Z</ns2:CreateDate><ns2:LastModifiedBy>AR_ESCALATOR</ns2:LastModifiedBy><ns2:ModifiedDate>2014-09-07T01:34:05.000Z</ns2:ModifiedDate><ns2:MethodList/><ns2:Status>Fail</ns2:Status><ns2:NotificationType><ns2:Individual>INDIVIDUAL</ns2:Individual></ns2:NotificationType><ns2:Log>1410053645AR_ESCALATORNo notification sent. No notification method selected.</ns2:Log><ns2:SubmittedBy>AR_ESCALATOR</ns2:SubmittedBy></ns2:NotificationDetailsList></ns2:ListNotificationDetails></ns2:ListNotificationDetailsResponse></soapenv:Body></soapenv:Envelope>
你的问题不是很清楚,我想当你说你的xml是“未格式化”时,你的意思是你希望你的xml应用了漂亮的打印( http://en.wikipedia.org/wiki/Prettyprint).

要在SOAPUI中执行此操作,您可以使用以下两个选项:

>右键单击响应面板,然后选择Format XML:

>其他选项是设置TestRequest属性的Pretty print属性,该属性会自动为您的响应生成漂亮的打印格式:

请注意,漂亮打印仅在XML格式良好时才起作用,如果不是(某些缺少标记,不能很好地关闭等),则SOAPUI无法完全打印它.

希望这可以帮助,

网友评论