Я создал следующую отличную программу test.groovy для вызова веб-службы BI Publisher. Я могу получить ответ на мыло. Кто-нибудь, пожалуйста, помогите мне записать мыльный ответ (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()
connection.setRequestMethod("POST")
connection.setRequestProperty("Content-Type" ,"text/html")
connection.setRequestProperty("SOAPAction", "")
connection.doOutput = true
Writer writer = new OutputStreamWriter(connection.outputStream)
writer.write(soapRequest)
writer.flush()
writer.close()
connection.connect()
def soapResponse = connection.content.text
def Envelope = new XmlSlurper().parseText(soapResponse)
println soapResponse
String reportBytes = Envelope.Body.runReportResponse.runReportReturn.reportBytes
String reportContentType = Envelope.Body.runReportResponse.runReportReturn.reportContentType
} catch (Exception e) {
println "Error occurred"
println "--------------"
println e
e.printStackTrace();
}
--------------------- мыльный ответ программы следующим образом --------------
Я создал следующую отличную программу test.groovy для вызова веб-службы BI Publisher. Я могу получить ответ мыла. Может ли кто-нибудь помочь мне записать мыльный ответ (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() connection.setRequestMethod("POST") connection.setRequestProperty("Content-Type" ,"text/html") connection.setRequestProperty("SOAPAction", "") connection.doOutput = true Writer writer = new OutputStreamWriter(connection.outputStream) writer.write(soapRequest) writer.flush() writer.close() connection.connect() def soapResponse = connection.content.text def Envelope = new XmlSlurper().parseText(soapResponse) println soapResponse String reportBytes = Envelope.Body.runReportResponse.runReportReturn.reportBytes String reportContentType = Envelope.Body.runReportResponse.runReportReturn.reportContentType } catch (Exception e) { println "Error occurred" println "--------------" println e e.printStackTrace(); }
--------------------- мыло ответ программы следующий --------------
Я создал следующую отличную программу test.groovy для вызова веб-службы BI Publisher. Я могу получить ответ на мыло. Может ли кто-нибудь помочь мне записать мыльный ответ (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() connection.setRequestMethod("POST") connection.setRequestProperty("Content-Type" ,"text/html") connection.setRequestProperty("SOAPAction", "") connection.doOutput = true Writer writer = new OutputStreamWriter(connection.outputStream) writer.write(soapRequest) writer.flush() writer.close() connection.connect() def soapResponse = connection.content.text def Envelope = new XmlSlurper().parseText(soapResponse) println soapResponse String reportBytes = Envelope.Body.runReportResponse.runReportReturn.reportBytes String reportContentType = Envelope.Body.runReportResponse.runReportReturn.reportContentType } catch (Exception e) { println "Error occurred" println "--------------" println e e.printStackTrace(); }
--------------------- мыло ответ программы следующий -------------- obHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3 + PN6 / 9oADAMBAAIRAxEAPwDkf + GgPHH / AD00 / wD8Bv8A69H / AA0B44 / 56af / AOA3 / wBevLaKAPUv + GgPHH / PTT // AAG / + VR / w0B44 / 56af8A + A3 / ANevLaKAPpP4PfFDxH428W3em6u1qbeKxedfJh2HcJI1HOemGNe2V8wfs4 / 8lD1D / SFSF + jYq + n6ACiiigArH1 / xRo / hm3EuqXixMw / dxL80kn + 6o5 / HpXNeKfHhgubjStCeJrm3Xde3z4aKyTcAxx / Gw3D5RnHvyK8sfULq5jur7T5NqbSl5rmoHc0jlGRo4 + PusDkIFLDrkAcb06Lesg == применение / pdfxmlp25327697.tmp