0

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>
John
</prename>
</Person>

Note thath the attribute schufaToken can occur several times!

The generated Soap-"template" looks like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:scor="http://www.ibm.com/rules/decisionservice/ScoringDemo/ScoringDemo" xmlns:par="http://www.ibm.com/rules/decisionservice/ScoringDemo/ScoringDemo/param" xmlns:demo="http://www.example.de/scoring/demo">
   <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!

cYnd
  • 15
  • 7

1 Answers1

0

Probably the easiest way is to use API in the javax.xml.soap package that allows you to manage SOAP request.

Take a look a this example https://stackoverflow.com/a/15949858/3989318

Community
  • 1
  • 1