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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:42:30+00:00 2026-05-25T02:42:30+00:00

I am using JAX-WS for web services. Whenever I use a char as a

  • 0

I am using JAX-WS for web services.

Whenever I use a char as a method parameter, I am getting it as an unsignedShort in the xsd (Focus on weatherLetter).

Here is the declaration:

@WebMethod
public boolean setWXtatus(
        @WebParam(name = "weatherLetter") char weatherLetter,
        @WebParam(name = "weatherDigit") int weatherDigit,
        @WebParam(name = "cloudCover") int cloudCover,
        @WebParam(name = "cloudBaseInHundredsOfFeet") int cloudBaseInHundredsOfFeet,
        @WebParam(name = "pressureInHg") int pressureInHg,
        @WebParam(name = "visibilityInKm") int visibilityInKm,
        @WebParam(name = "windSpeed") int windSpeed,
        @WebParam(name = "windDirection") int windDirection,
        @WebParam(name = "lastUpdateHour") int lastUpdateHour,
        @WebParam(name = "lastUpdateMin") int lastUpdateMin
) 

Here is the type mappings I get:

<xs:complexType name="setWXStatus">
<xs:sequence>
<xs:element name="weatherLetter" type="xs:unsignedShort" minOccurs="0"/>
<xs:element name="weatherDigit" type="xs:int"/>
<xs:element name="cloudCover" type="xs:int"/>
<xs:element name="cloudBaseInHundredsOfFeet" type="xs:int"/>
<xs:element name="pressureInHg" type="xs:int"/>
<xs:element name="visibilityInKm" type="xs:int"/>
<xs:element name="windSpeed" type="xs:int"/>
<xs:element name="windDirection" type="xs:int"/>
<xs:element name="lastUpdateHour" type="xs:int"/>
<xs:element name="lastUpdateMin" type="xs:int"/>
</xs:sequence>
</xs:complexType>

How can I get weatherLetter to generate as a Char or 1 Letter String or something?

  • 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-05-25T02:42:30+00:00Added an answer on May 25, 2026 at 2:42 am

    Update:

    One way to do this is the in XSD (if you do contract first) e.g. add an XSD Restriction to it directly, e.g.

    <xs:element name="singleChar">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:length value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
    

    But I think the question is on contract last (e.g. write code that generates the XSD, not vice versa)

    This is not yet supported in JAX-WS or JAXB, as far as I know (but a nice enhancement request)

    Sources:

    JAX-WS and JAXB don’t have support for code generation for restrictions from XSD (e.g. xsd:restriction)
    http://old.nabble.com/Does-jaxb-2.1-enforce-xs:restriction-td21348458.html

    The reason is that the other direction (generating restrictions by Annotation), is not supported too

    Workaround:

    Take a look at this: http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html

    And also at this question:

    JAX-WS and Joda-Time?

    Not doing exactly what you want, but getting you a little bit closer


    I don’t think you can have it limited to 1 char any other way, a char is indeed an unsigned short, and the closest thing you can to limiting to 1 “String” char.

    If you use a String, you will allow unlimited chars. and @WebParam doesn’t have an API to limit length

    Actually I didn’t see a way to do XSD restrictions at all using JAX-WS, but I may be wrong

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

Sidebar

Related Questions

I'm getting started in developing web services using JAX-WS. I'm trying to implement classes
I'm just getting acquainted with implementing REST web services in Java using JAX-RS and
Application configuration: Web application using java first method of creating JAX-WS 2.0 Web Services
I'm using JAX-WS web services (client and exposed services), is there any API to
I am using the RestEasy library to do JAX-RS web services. I am not
Has anyone built Java web services using Maven-2. I've read about the jax-ws plugin,
I'm trying to consume some .NET web services using JAX-WS. I have generated the
I'm using SOAPUI tool to access JAX-WS web services deployed in Weblogic 10.3.2 Request:
I'm using Java 6 for learning more about web Services (JAX-WS). I also read
I'm creating some web services using JAX-WS and the java SE build-in server. Every

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.