[jboss-user] [JBoss Web Services] - how to set headers in JAX-WS

Neil McFarlane do-not-reply at jboss.com
Fri Mar 19 17:26:55 EDT 2010


Neil McFarlane [http://community.jboss.org/people/Oberiko] replied to the discussion

"how to set headers in JAX-WS"

To view the discussion, visit: http://community.jboss.org/message/533086#533086

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

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/533086#533086]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100319/687ff129/attachment.html 


More information about the jboss-user mailing list