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 8474325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:35:45+00:00 2026-06-10T17:35:45+00:00

I have a WCF service that expects an object which I’ll call StuffContainer. Our

  • 0

I have a WCF service that expects an object which I’ll call StuffContainer. Our client is trying to generate an XML-serialized StuffContainer using JAXB, but it’s coming out wrong. They’re ending up with type names where they should have property names, so we’re not able to deserialize it.

I know nothing about JAXB, but I gather it creates some auto-generated classes based on our XSD, which can be used to build the XML-serialized object.

Here’s the relevant snippet of our auto-generated XSD:

<xs:complexType name="StuffContainer">
    <xs:sequence>
        <xs:element minOccurs="0" name="myStuff" nillable="true" type="tns:ArrayOfStuff"/>
    </xs:sequence>
</xs:complexType>
...
<xs:complexType name="ArrayOfStuff">
    <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="Stuff" nillable="true" type="tns:Stuff"/>
    </xs:sequence>
</xs:complexType>

Our client’s code looks something like this:

ObjectFactory objectFactory = new ObjectFactory();

ArrayOfStuff arrayOfStuff = objectFactory.createArrayOfStuff();
JAXBElement<ArrayOfStuff> arrayOfStuffJAXBElement = objectFactory.createArrayOfStuff(arrayOfStuff);

StuffContainer stuffContainer = objectFactory.createStuffContainer();
stuffContainer.setStuff(arrayOfStuffJAXBElement);

Here’s the XML they’re getting:

<StuffContainer xmlns="..."><ArrayOfStuff>...</ArrayOfStuff></StuffContainer>

But I need it to be:

<StuffContainer xmlns="..."><myStuff>...</myStuff></StuffContainer>

I think this is because the JAXBElement<ArrayOfStuff> that they’re getting from the objectFactory has its QName set to "ArrayOfStuff", and this ends up getting used instead of the property name myStuff. But like I said I know nothing about JAXB so I’m not sure what they should be doing differently.

Is there something either that I can change in the XSD, or that I can ask our client to change in their code, so that it generates the correct XML?

  • 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-10T17:35:46+00:00Added an answer on June 10, 2026 at 5:35 pm

    There may be multiple methods on the generated ObjectFactory class. The ones corresponding to nested elements have an entire path built into the method name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service method that expects an object and then retrieves its
I have a WCF service that I need to call in a ASP.NET web
We have a WCF 4.0 service over https that allows the client to sign
I have a RESTful WCF service that can return XML, JSON, or JSONP, depending
I have a WCF service that I am connecting in client application. I am
I have a WCF service that returns some JSON from a serialized object: public
I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that I can debug. I put a breakpoint in
I have a WCF service that can return large amount of data depending on
I have a WCF service that needs to hosted using basicHttpBinding using SSL. So

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.