Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

use xsl to enclose serialized object  RSS feed

 
Jeff Kish
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small SAAJ app I've managed to cobble together which takes a java object that has been serialized into XML and successfully invoke a web service. Unfortunately this object includes this at the beginning:


and this at the end:



As I read in thousands of these objects I will be getting them without these opening and closing tags, and I need them in order to make my SAAJ code invoke the web service successfully.

Can someone show me (and explain) how to do this. The XSL tutorials I've seen are not getting me there. So the serialized object might look like this:


<SomeOBJECTPO xmlns="http://MYNAMEAPACE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDateTime="2014-04-28T08:37:33-05:00" transLanguage="EN" baseLanguage="EN" messageID="1398692254567871959" Version="7 5 20130829-1209 V7510--1">
<SomeSet>
<PO>

</PO>
</SomeSet>
</SomeObjectPO>


and I want it to look like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SomeOBJECTPO xmlns="http://MYNAMEAPACE" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" creationDateTime="2014-04-28T08:37:33-05:00" transLanguage="EN" baseLanguage="EN" messageID="1398692254567871959" Version="7 5 20130829-1209 V7510--1">
<SomeSet>
<PO>

</PO>
</SomeSet>
</SomeObjectPO>
</soapenv:Body>
</soapenv:Envelope>




Any suggestions are appreciated. When I tried to just use msg.getSoapBody() and insert the content, it set this:

<SomeOBJECTPO xmlns="http://MYNAMEAPACE"

to this:

><SomeOBJECTPO xmlns=""


(i.e. null) in the SomeObjectPO and that made the web service call fail.
thanks

>
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand your question. If you just want to convert the smaller XML to the larger XML using XSLT, then all you have to do is to have a template which matches the root element and copies it to the output, wrapping it in the two outer elements which you need. But then you started to talk about msg.getSoapBody() and some problems with some previous attempt which you didn't provide any description of. I have no idea what that's all about... perhaps you don't actually have the ability to pass the smaller XML into an XSL transformation, and that's your question?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!