Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAX-WS, How do I pass an authentication data in the header?

843833Aug 28 2006 — edited Apr 1 2009
I'm trying to develop a webservice client using Netbeans 5.5 and JAX-WS 2.0

I can't seem to figure out how to pass authentication parameters in the message header. Is there a simple way to do this? I basically just need to send two string values (userName and password)

Thanks!

WSDL included:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:AutoREG" 
xmlns:s0="urn:AutoREG" xmlns:xsd="">
 <wsdl:types>
  <xsd:schema elementFormDefault="qualified" targetNamespace="urn:AutoREG">
   <xsd:element name="OpGet" type="s0:GetInputMap"/>
   <xsd:complexType name="GetInputMap">
    <xsd:sequence>
     <xsd:element name="Request_ID" type="xsd:string"/>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:element name="OpGetResponse" type="s0:GetOutputMap"/>
   <xsd:complexType name="GetOutputMap">
    <xsd:sequence>
     <xsd:element name="Assigned_To" type="xsd:string"/>
     <xsd:element name="Character" type="xsd:string"/>
     <xsd:element name="Decimal" type="xsd:decimal"/>
     <xsd:element name="Integer" type="xsd:int"/>
     <xsd:element name="Short_Description" type="xsd:string"/>
     <xsd:element name="Status" type="s0:StatusType"/>
     <xsd:element name="Submitter" type="xsd:string"/>
    </xsd:sequence>
   </xsd:complexType>
   <xsd:simpleType name="StatusType">
    <xsd:restriction base="xsd:string">
     <xsd:enumeration value="New"/>
     <xsd:enumeration value="Assigned"/>
     <xsd:enumeration value="Fixed"/>
     <xsd:enumeration value="Rejected"/>
     <xsd:enumeration value="Closed"/>
    </xsd:restriction>
   </xsd:simpleType>
   <xsd:element name="AuthenticationInfo" type="s0:AuthenticationInfo"/>
   <xsd:complexType name="AuthenticationInfo">
    <xsd:sequence>
     <xsd:element name="userName" type="xsd:string"/>
     <xsd:element name="password" type="xsd:string"/>
     <xsd:element minOccurs="0" name="authentication" type="xsd:string"/>
     <xsd:element minOccurs="0" name="locale" type="xsd:string"/>
     <xsd:element minOccurs="0" name="timeZone" type="xsd:string"/>
    </xsd:sequence>
   </xsd:complexType>
  </xsd:schema>
 </wsdl:types>

   <wsdl:message name="OpGetSoapIn">

      <wsdl:part element="s0:OpGet" name="parameters"/>

   </wsdl:message>

   <wsdl:message name="ARAuthenticate">

      <wsdl:part element="s0:AuthenticationInfo" name="parameters"/>

   </wsdl:message>

   <wsdl:message name="OpGetSoapOut">

      <wsdl:part element="s0:OpGetResponse" name="parameters"/>

   </wsdl:message>

   <wsdl:portType name="AutoREGPortType">

      <wsdl:operation name="OpGet">

         <wsdl:input message="s0:OpGetSoapIn"/>

         <wsdl:output message="s0:OpGetSoapOut"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="AutoREGSoapBinding" type="s0:AutoREGPortType">

      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="OpGet">

         <soap:operation soapAction="urn:AutoREG/OpGet" style="document"/>

         <wsdl:input>

            <soap:header message="s0:ARAuthenticate" part="parameters" use="literal">

            </soap:header>

            <soap:body use="literal"/>

         </wsdl:input>

         <wsdl:output>

            <soap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="AutoREGService">

      <wsdl:port binding="s0:AutoREGSoapBinding" name="AutoREGSoap">

         <soap:address location="http://xxxx/&webService=AutoREG"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2009
Added on Aug 28 2006
4 comments
1,086 views