Linora
Linora

Reputation: 10988

Webservice-request with array

I've got a webservice which takes a RequestDTO with 6 strings in it. When testing the webservice I simply send an XML like this and it works just fine:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"   
xmlns:java="java:dk.thg.fll" 
xmlns:java1="java:dk.thg.common">
<soapenv:Header/>
<soapenv:Body>
  <web:service>
     <web:request>
        <java:request>
           <java1:Id>1</java1:Id>
           <java1:User>anton</java1:User>
        </java:request>
        <java:ms>4453</java:ms>
        <java:element>GG</java:element>
        <java:service>L</java:service>
        <java:data><![CDATA[ <data><task><type>T</type><action>A</action> </task></data> ]]></java:data>
     </web:request>
  </web:service>
</soapenv:Body>
</soapenv:Envelope>

My problem now is that I have to create a webservice which can process a set of requests. My idea is to simply have an array of RequestDTO. This means that the new webservice takes a MultiRequestDTO which contains an array of RequestDTO's.

But how should the XML look like? - When I test with SoapUI it autogenerates the request xml and this is what it says my new webservice XML looks like:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:java="java:dk.thg.fll" 
xmlns:java1="java:dk.thg.common">
<soapenv:Header/>
<soapenv:Body>
  <web:service>
     <web:multiRequest>
        <java:request>
           <java1:Id>?</java1:Id>
           <java1:User>?</java1:User>
        </java:request>
        <java:requests/>
     </web:multiRequest>
  </web:service>
</soapenv:Body>
</soapenv:Envelope>

How should the (which is my array) look like when sending the request?

I've tried to simply copy the contents from the first XML (copied the tag ), but no luck..

Anyone able to help out?

* EDIT * - Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:java="java:dk.thg.fll" xmlns:java1="java:dk.thg.common">
<soapenv:Header/>
<soapenv:Body>
  <web:service>
     <web:multiRequest>
        <java:requestInfo>
           <java1:Id>10</java1:Id>
           <java1:User>1234</java1:User>
        </java:requestInfo>
        <java:requests>
        singleRequest
                <java:request>
                    <java1:Id>10</java1:Id>
                    <java1:User>789</java1:User>
                </java:request>
                <java:msisdn>4561814453</java:msisdn>
                <java:element>4453</java:element>
                <java:service>GG</java:service>
                <java:details><![CDATA[ <details><task><type>T</type><action>A</action> </task></details>]]></java:details>
    </java1:singleRequest>
    </java:requests>
     </web:multiRequest>
  </web:service>

This is what I send out now.. but all the values inside arent recieved and the object in the array just contains null values.

Upvotes: 1

Views: 2350

Answers (1)

BOSS
BOSS

Reputation: 2951

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:java="java:dk.thg.fll"  xmlns:java1="java:dk.thg.common"> 
<soapenv:Header/>
 <soapenv:Body> 
  <web:service>  
    <web:multiRequest>  
       <java:request>   
         <java1:Id>?</java1:Id>   
         <java1:User>?</java1:User>  
       </java:request>   
   <java:request>   
         <java1:Id>?</java1:Id>   
         <java1:User>?</java1:User>  
       </java:request>     
  <java:requests/>  
  <java:request>   
         <java1:Id>?</java1:Id>   
         <java1:User>?</java1:User>  
       </java:request>   
  </web:multiRequest> 
  </web:service> </soapenv:Body> 
</soapenv:Envelope>

Your XML request suppose to look like this if you want to trigger more than one java:request

Upvotes: 1

Related Questions