<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Bizarre Serialization Problem
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/spyhunter99">spyhunter99</a> in <i>JBoss Web Services</i> - <a href="https://community.jboss.org/message/728819#728819">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I'm looking at WS-Discovery, which is a UDP SOAP over multicast based protocol that is similar to UDDI, except way similier and it's adhoc. In the Java world, there's only one implementation that I've found which is here <a class="jive-link-external-small" href="http://code.google.com/p/java-ws-discovery/">http://code.google.com/p/java-ws-discovery/</a>. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I can get the samples to run correctly in outside of the Jboss world and it works as advertised. Basically, there is a service that listens for "Probe" messages on UDP and replies to the requestor based on the search criteria. Cool.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The problem I ran into boils down to a serialization issue. Escentially, when I run outside of Jboss, it's using the standard default JDK soap libraries, aka Sun's JAXB serializers, message factories and marshallers. In Jboss, it's actually creating JbossWS classes which fill these roles. For everything I've done up until now, this have been just fine with this arrangement. Enter WS-Discovery (at least this guys implementation). </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>First, some implementation details that are worth mentioning and are important to understanding the problem. It's not SOAP over HTTP, it's over UDP which means this guys library serializes the message, then writes it to transport. In order to facilitate this, the author created a custom class which has functions such as getSOAPmessage and getSOAPbody etc with a toString function that serializes the message. The problem is related to how the message is structured and as you can imagine, using the JDK's classes it correctly serializes but with the JbossWS classes it does not. Specifically, the part with the search results is null under JbossWS.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>It appears that the actually loading of the JAXB specific stuff happens with this line, which unfortunately doesn't leave me with any flexiblity as far as forcing it to the JDK's vs JbossWS.</p><p>&#160;&#160;&#160;&#160; MessageFactory&#160; factory = MessageFactory.newInstance(soapProtocol);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>At the point of serialization, the SOAP message itself is </p><p>com.sun.xml.internal.messaging.saaj.soap.ver1_2.Message1_2Impl</p><p>org.jboss.ws.core.soap.SOAPMessageImpl</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Long story short, there is a way to force the class loading from a specific instance to use Sun's JDK? Or perhaps would it be better if I found either an alternative implementation or write my own.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Esscentially what I would like to do is to write a JAX-WS handler which does a web service callout using WS-Discovery to find the correct url, thus eliminating the need for configuration files. It obviously would need to work in a variety of soap stacks, more than just JbossWS and Sun's default implementation. </p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/728819#728819">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>