Fill Soap-Request from XML



i have the following problem:


I have a XML-file with data in it. I also have an valid Soap-request-"template" which i create via soapui in java with reference of a WSDL-file (i have access to it). That work fine.


Now i have to fill the data from the XML-file in the Soap request, so i can send it.


The XML-file looks like this:



<?xml version="1.0" encoding="UTF-8"?><Person>
<job>
Consultant
</job>
<birthDate>
1999-01-01
</birthDate>
<surname>
Doe
</surname>
<schufaToken>

</schufaToken>
<prename>
Jens
</prename>
</Person>


Note thath the attribute schufaToken can occur several times!


The generated Soap-"template" looks like this:



<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:scor="http://ift.tt/1lXttcb" xmlns:par="http://ift.tt/WMDMDV" xmlns:demo="http://ift.tt/WMDMUh">
<soapenv:Header/>
<soapenv:Body>
<scor:ScoringDemoRequest>
<!--Optional:-->
<scor:DecisionID>?</scor:DecisionID>
<!--Zero or more repetitions:-->
<scor:blacklist>?</scor:blacklist>
<par:person>
<person>
<demo:prename>?</demo:prename>
<demo:surname>?</demo:surname>
<demo:birthDate>?</demo:birthDate>
<demo:job>?</demo:job>
<!--Zero or more repetitions:-->
<demo:schufaToken>
<demo:code>?</demo:code>
<demo:status>?</demo:status>
<demo:score>?</demo:score>
</demo:schufaToken>
</person>
</par:person>
</scor:ScoringDemoRequest>
</soapenv:Body>
</soapenv:Envelope>


The problem that i got is that the XML-file isn't static and can look totally different and can have totally different atrributes.


How do i archieve, that i copy the data from the XML-file to the generatet "template" in java without knowing the node names or anything else?


Thank you very much!


No comments:

Post a Comment