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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:12:09+00:00 2026-06-14T00:12:09+00:00

I recently hit a problem with a SOAP web service where the WSDL specifies

  • 0

I recently hit a problem with a SOAP web service where the WSDL specifies an integer for a particular field, but the XML comes in with an empty element which causes the .NET deserialization logic to throw a FormatException.

The WSDL looks like this:

<xsd:element minOccurs="0" maxOccurs="1" name="TransID" type="xsd:int" />

And the SOAP looks like this:

<TransID></TransID>

This causes the exception when parsing the response. The server I’m talking to belongs to a vendor so I don’t have the option to change it. I’m hacking around this in the short term by redefining the field as a string.

My question is this: In trying to diagnose this problem, I pulled out the XML into a file and created my own XmlSerializer to test deserializing using the POCO’s generated by the WSDL import. The XmlSerializer I created parses this XML just fine and produces the parent type as expected. No exception. The field value is zero which would be expected. Why does the SOAP deserializer puke and the plain deserializer I created works fine?

  • 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-14T00:12:11+00:00Added an answer on June 14, 2026 at 12:12 am

    That is normal and expected; a blank string is not valid as an integer, and cannot be parsed. XmlSerializer behaves identically:

    using System.IO;
    using System.Xml.Serialization;
    
    static class Program {
        static void Main() {
            var obj = new XmlSerializer(typeof(Foo)).Deserialize(
                new StringReader("<Foo><TransID></TransID></Foo>"));
        }
    }
    public class Foo
    {
        public int TransID { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm overloading operator new , but I recently hit a problem with alignment. Basically,
I was recently hit with a puzzling problem with no explanation that I somehow
I've hit this problem recently, and I've been stuck at it for a few
This problem actually hit me recently. So I was tasked with putting people's bios
I just recently have started learning about the wonders of **kwargs but I've hit
Recently I've been creating a game but I'm having a problem. To calculate what
Ok, here is the issue: Recently I hit an problem that I was not
Saw a problem recently where all 200 web container threads became hung, meaning none
I've recently hit a wall with an issue with Java's native XML API (the
I've recently hit a strange problem with my iOS app and have no idea

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.