Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8113629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:53:23+00:00 2026-06-06T02:53:23+00:00

My task is to write a webservice for an update operation where a list

  • 0

My task is to write a webservice for an update operation where a list of objects are passed to the method.

@WebMethod(operationName = "updateObjects", action = "urn:preferences")
public boolean updateObjects(List<MyObject> objects){

}

The class MyObject is simple enough.

 @XmlRootElement(name="Object")
 public class MyObject{
    private String item1;
    private String item2;
 }

Now the problem statement. When I look at the SOAP request for this method (that SOAP UI generated for me), the request looks like below :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
   <soapenv:Header/>
   <soapenv:Body>
      <pref:updateObjects>
         <!--Zero or more repetitions:-->
         <arg0>
            <!--Optional:-->
            <item1>?</item1>
            <!--Optional:-->
            <item2>?</item2>
         </arg0>
      </pref:updateObjects>
   </soapenv:Body>
</soapenv:Envelope>

but I want it to look like below.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
   <soapenv:Header/>
   <soapenv:Body>
      <pref:updateObjects>
         <!--Zero or more repetitions:-->
         <Objects>
             <Object>
                <!--Optional:-->
                <item1>?</item1>
                <!--Optional:-->
                <item2>?</item2>
             </Object>
             <Object>
                <!--Optional:-->
                <item1>?</item1>
                <!--Optional:-->
                <item2>?</item2>
             </Object>
         </Objects>  
      </pref:updateObjects>
   </soapenv:Body>
</soapenv:Envelope>  

Can somebody please advice. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T02:53:25+00:00Added an answer on June 6, 2026 at 2:53 am

    You only need to add a ‘wrapper’ to your List of objects like this:

     @XmlRootElement(name="objects")
     public class MyObjects{
    
        @XmlElement(name="object")
        List<MyObject> myObjects;
     }
    
    public class MyObject{
        private String item1;
        private String item2;
     }
    

    NOTE: changing root element from arg0 to objects with the tag @XmlRootElement(name="objects") will not work because your <objects> is not a root element in the web service definition. Actually it is part of your <wsdl:message> (so JAXB will discart it).

    What you need to change is the web service message adding a @WebParam(name = "objects") to your @WebMethod like:

    @WebMethod(operationName = "updateObjects", action = "urn:preferences")
    public boolean updateObjects(@WebParam(name = "objects") MyObjects objects){
    
    }
    

    If you do not want use a ‘wrapper’, you can keep your WebMethod but like this:

    @WebMethod(operationName = "updateObjects", action = "urn:preferences")
    public boolean updateObjects(@WebParam(name = "object") List<MyObject> objects){
    
    }
    

    but you will loose the <objects> wrapper. The request should be something like this:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pref="preferences">
       <soapenv:Header/>
       <soapenv:Body>
          <pref:updateObjects>
             <!--Zero or more repetitions:-->
             <object>
                <!--Optional:-->
                <item1>?</item1>
                <!--Optional:-->
                <item2>?</item2>
             </object>
          </pref:updateObjects>
       </soapenv:Body>
    </soapenv:Envelope>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My task is to write the main function which defines an array of objects
I had a task to write simple game simulating two players picking up 1-3
I had a task to write simple game simulating two players picking up 1-3
There is a task to write a crawler to crawl the webpage by python.
I have been assigned wit the task to write a program that takes a
My task is to write an app(unfortunatly on C) which reads expression in infix
My task is to write a class RFind which recursively searches the current directory
The task is to write a program which prompts for a filename and then
I have question about XSLT1.0. The task is to write out in HTML all
I have very little knowledge about unix. My task is to write a shell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.