Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

serialization - How to make java class Serializable which is generated by wsdl

In my project, classes are generated by wsdl. One of these classes is User class. This class must be Serializable. How can I change my pom.xml file for making User Serializable? I can find example but can't apply it to my project https://pragmaticintegrator.wordpress.com/2009/03/14/make-serializable-jax-ws-clients-with-maven2/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Finally I could find answer for my question. In our project we use org.apache.cxf plugin to generate classes. I created binding.xml file in resources folder.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           elementFormDefault="qualified" attributeFormDefault="unqualified"
           jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
    <xs:annotation>
        <xs:appinfo>
            <jaxb:globalBindings>
                <xjc:serializable uid="1337" />
            </jaxb:globalBindings>
        </xs:appinfo>
    </xs:annotation>
</xs:schema>

Then I referenced to this xml file from my pom.xml, for this I added

<bindingFiles>
    <bindingFile>${basedir}/src/main/resources/binding.xml</bindingFile>
</bindingFiles>

under wsdlOptions/wsdlOption tag. That's all


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...