<!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="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">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;">
    how to set headers in JAX-WS
</h3>
<span style="margin-bottom: 10px;">
    reply from <a href="http://community.jboss.org/people/Oberiko">Neil McFarlane</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/533086#533086">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Sorry to drag up an old message like this, but I don't see a newer one on the same topic.</p><p>Are the three solutions presented still the only way of handling&#160; authenication via headers within the operation.&#160; For example, a WSDL I'm trying to build a client for has the following:</p><p>{code:xml}&lt;?xml version="1.0" encoding="utf-8"?&gt;<br/>&lt;wsdl:definitions xmlns:soap="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/soap/">http://schemas.xmlsoap.org/wsdl/soap/</a>" xmlns:tm="<a class="jive-link-external-small" href="http://microsoft.com/wsdl/mime/textMatching/">http://microsoft.com/wsdl/mime/textMatching/</a>" xmlns:soapenc="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>" xmlns:mime="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/mime/">http://schemas.xmlsoap.org/wsdl/mime/</a>" xmlns:tns="<a class="jive-link-external-small" href="http://ws.myWebService.net">http://ws.myWebService.net</a>" xmlns:s="<a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>" xmlns:soap12="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/soap12/">http://schemas.xmlsoap.org/wsdl/soap12/</a>" xmlns:http="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/http/">http://schemas.xmlsoap.org/wsdl/http/</a>" targetNamespace="<a class="jive-link-external-small" href="http://ws.myWebService.net">http://ws.myWebService.net</a>" xmlns:wsdl="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/">http://schemas.xmlsoap.org/wsdl/</a>"&gt;<br/>&#160; &lt;wsdl:types&gt;<br/>&#160;&#160;&#160; &lt;s:schema elementFormDefault="qualified" targetNamespace="<a class="jive-link-external-small" href="http://ws.myWebService.net">http://ws.myWebService.net</a>"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;s:element name="myOperation"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:complexType&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:element minOccurs="1" maxOccurs="1" name="isSecureMode" type="s:boolean" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/s:complexType&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/s:element&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;s:element name="myOperationResponse"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:complexType&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:element minOccurs="0" maxOccurs="1" name="myOperationResult" type="s:string" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/s:complexType&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/s:element&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;s:element name="AuthenticationXML" type="tns:AuthenticationXML" /&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;s:complexType name="AuthenticationXML"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:element minOccurs="0" maxOccurs="1" name="User" type="s:string" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/s:sequence&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;s:anyAttribute /&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/s:complexType&gt;<br/>&#160;&#160;&#160; &lt;/s:schema&gt;<br/>&#160; &lt;/wsdl:types&gt;<br/>&#160; &lt;wsdl:message name="myOperationSoapIn"&gt;<br/>&#160;&#160;&#160; &lt;wsdl:part name="parameters" element="tns:myOperation" /&gt;<br/>&#160; &lt;/wsdl:message&gt;<br/>&#160; &lt;wsdl:message name="myOperationSoapOut"&gt;<br/>&#160;&#160;&#160; &lt;wsdl:part name="parameters" element="tns:myOperationResponse" /&gt;<br/>&#160; &lt;/wsdl:message&gt;<br/>&#160; &lt;wsdl:message name="myOperationAuthenticationXML"&gt;<br/>&#160;&#160;&#160; &lt;wsdl:part name="AuthenticationXML" element="tns:AuthenticationXML" /&gt;<br/>&#160; &lt;/wsdl:message&gt;<br/>&#160; &lt;wsdl:message name="SendDataAuthenticationXML"&gt;<br/>&#160;&#160;&#160; &lt;wsdl:part name="AuthenticationXML" element="tns:AuthenticationXML" /&gt;<br/>&#160; &lt;/wsdl:message&gt;<br/> &lt;wsdl:portType name="myPort"&gt;<br/>&#160; &lt;wsdl:operation name="myOperation"&gt;<br/>&#160;&#160; &lt;wsdl:input message="tns:myOperationSoapIn" /&gt;<br/>&#160;&#160; &lt;wsdl:output message="tns:myOperationSoapOut" /&gt;<br/>&#160; &lt;/wsdl:operation&gt;<br/>&#160; &lt;/wsdl:portType&gt;<br/>&#160; &lt;wsdl:binding name="myPort12" type="tns:myPort"&gt;<br/>&#160;&#160;&#160; &lt;soap12:binding transport="<a class="jive-link-external-small" href="http://schemas.xmlsoap.org/soap/http">http://schemas.xmlsoap.org/soap/http</a>" /&gt;<br/>&#160;&#160;&#160; &lt;wsdl:operation name="myOperation"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;soap12:operation soapAction="myWebService:myOperation" style="document" /&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;wsdl:input&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;soap12:body use="literal" /&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;soap12:header message="tns:myOperationAuthenticationXML" part="AuthenticationXML" use="literal" /&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/wsdl:input&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;wsdl:output&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;soap12:body use="literal" /&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/wsdl:output&gt;<br/>&#160;&#160;&#160; &lt;/wsdl:operation&gt;<br/>&#160; &lt;/wsdl:binding&gt;<br/>&#160; &lt;wsdl:service name="myWebServiceWS"&gt;<br/>&#160;&#160;&#160; &lt;wsdl:port name="myPort11" binding="tns:myPort11"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;soap:address location="<a class="jive-link-external-small" href="https://devws.myWebService.myDomain.net/myWebServicews/myWebServicews.asmx">https://devws.myWebService.myDomain.net/myWebServicews/myWebServicews.asmx</a>" /&gt;<br/>&#160;&#160;&#160; &lt;/wsdl:port&gt;<br/>&#160;&#160;&#160; &lt;wsdl:port name="myPort12" binding="tns:myPort12"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;soap12:address location="<a class="jive-link-external-small" href="https://devws.myWebService.myDomain.net/myWebServicews/myWebServicews.asmx">https://devws.myWebService.myDomain.net/myWebServicews/myWebServicews.asmx</a>" /&gt;<br/>&#160;&#160;&#160; &lt;/wsdl:port&gt;<br/>&#160; &lt;/wsdl:service&gt;<br/>&lt;/wsdl:definitions&gt;{code}</p><p>With WsConsume, I don't get the option to add Authentication elements to my methods and setting the binding properties does nothing.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/533086#533086">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://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>