小编Bal*_*amy的帖子

使用groovy的SOAP请求

我创建了以下groovy程序test.groovy来调用BI Publisher Web服务.我能够得到肥皂反应.谁能帮我把soapresponse(Envelope.Body.runReportResponse.runReportReturn.reportBytes)写成pdf文件.

----------------------- test.groovy ------------------------------------

String username = "Administrator"
String password = "Administrator"
String attributeFormat = "pdf" 
String attributeLocale = "en-US"
String reportAbsolutePath = "/WebserviceTest/eodnoticeofdormancy/eodnoticeofdormancy.xdo"
String attributeTemplate = "Notice"
String p_reportdate = "2011-04-08"

def soapRequest = """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
   <soapenv:Header/>
   <soapenv:Body>
      <pub:runReport>
         <pub:reportRequest>
            <pub:attributeFormat>${attributeFormat}</pub:attributeFormat>
            <pub:attributeLocale>${attributeLocale}</pub:attributeLocale>
            <pub:attributeTemplate>${attributeTemplate}</pub:attributeTemplate>
            <pub:flattenXML>true</pub:flattenXML>
            <pub:parameterNameValues>
               <!--Zero or more repetitions:-->
               <pub:item>
                  <pub:multiValuesAllowed>false</pub:multiValuesAllowed>
                  <pub:name>p_reportdate</pub:name>
                  <pub:values>
                     <pub:item>${p_reportdate}</pub:item>
                  </pub:values>
               </pub:item>
            </pub:parameterNameValues>
            <pub:reportAbsolutePath>${reportAbsolutePath}</pub:reportAbsolutePath>
        <pub:sizeOfDataChunkDownload>1024</pub:sizeOfDataChunkDownload>
         </pub:reportRequest>
         <pub:userID>Administrator</pub:userID>
         <pub:password>Administrator</pub:password>
      </pub:runReport>
   </soapenv:Body>
</soapenv:Envelope>"""

try {
   def soapUrl = new URL("http://localhost/xmlpserver/services/PublicReportService")
   def connection = soapUrl.openConnection() …
Run Code Online (Sandbox Code Playgroud)

java groovy soap webservices-client

6
推荐指数
1
解决办法
5368
查看次数

标签 统计

groovy ×1

java ×1

soap ×1

webservices-client ×1