jax-ws webmethod response - encode special charact

2019-09-09 04:38发布

问题:

one of my jax-ws webmethods returns hash - string with special characters.

I am getting incomplete response XML.

When I return normal string e.g. "TEST", webmethod works ok.

How to encode the response? I hope j2ee5.0, jdk6.0 libraries are sufficient.

Thank you for response.

回答1:

Important in java class is:

@XmlElementRef(name = "Hash", type = JAXBElement.class)
@XmlMixed
protected List<Serializable> content;

Important in xsd for generation is mixed="true":

<xsd:complexContent mixed="true">
        <xsd:extension base="common:Request">
            <xsd:sequence>

                <xsd:element name="Hash"
                             type="xsd:string"
                             minOccurs="1"
                             maxOccurs="1"
                             >