7 Replies Latest reply on Jan 4, 2008 4:45 AM by Alessio Soldano

    UsernameToken authentication using JBossWS

    Leandro Sales Newbie

      Hi folks,

      I need to consume a certain webservice that use a UsernameToken
      authentication method. Using SOAPui it generate the following SOAP
      envelop:

      <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:sec="http://www.xxx.com/security"
      xmlns:vais="http://www.xxx.com/">
      <soapenv:Header>
      <sec:UsernameToken>
      <sec:username>?</sec:username>
      <sec:password>?</sec:password>
      </sec:UsernameToken>
      </soapenv:Header>
      <soapenv:Body>
      <vais:GetStations/>
      </soapenv:Body>
      </soapenv:Envelope>

      I use the wsconsumer.sh and jboss generated all the java classes
      necessary to have the objects, and I have the following code:

      (... some imports ...)

      @Stateless
      @WebService(endpointInterface="bean.WeatherInfoIF")
      @WebServiceClient(name = "Vaisala", targetNamespace = "http://www.xxx.com/",
      wsdlLocation = "http://xxx/WebS/xxx.asmx?WSDL")
      public class MyInfoBean implements InfoIF {

      public MyInfoBean() {

      }

      public String makeRequest(int arg0) {
      Service service = null;

      try {
      URL wsdlLocation = new URL("http://xxx/WebS/xxx.asmx?WSDL");
      QName serviceName = new QName("http://www.xxx.com/", "TheService");
      service = Service.create(wsdlLocation, serviceName);
      }
      catch(Exception e)
      {
      e.printStackTrace();
      }

      ServiceSOAP serviceSoap = service.getPort(ServiceSOAP.class);

      URL url = null;
      try {
      url = new File("/home/leandro/jboss-wsse-client.xml").toURL();
      ((StubExt)serviceSoap).setSecurityConfig(url.toExternalForm());
      } catch (MalformedURLException e) {
      e.printStackTrace();
      }

      ((StubExt)serviceSoap).setConfigName("Standard WSSecurity Client");

      UsernameToken usernameToken = new UsernameToken();
      usernameToken.setUsername("user");
      usernameToken.setPassword("pass");

      // I NEED TO PASS THE UsernameToken information to be inserted
      into the SOAP-Header of the SOAP envelop, how to do this?

      String stations = serviceSoap.getName();


      return "";
      }

      }

      My jboss-wsse-client.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">



      </jboss-ws-security>

      By the way, I'm getting HTTP 404 Error when I try to access http://www.jboss.com/ws-security/config.

      I can't call serviceSoap.getName() because I don't know how to pass
      the UsernameToken object. Anyone to help me?

      Thank you,
      Leandro.

        • 1. Re: UsernameToken authentication using JBossWS
          Leandro Sales Newbie

          Just to send the correct client.xml file:

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">



          </jboss-ws-security>

          • 2. Re: UsernameToken authentication using JBossWS
            Alessio Soldano Master

            Did you try with the username element in your jboss-wsse-client descriptor? Here is some documentation about the UsernameToken Authentication in JBossWS: http://jbws.dyndns.org/mediawiki/index.php?title=WS-Security_options#Username_Token_Authentication

            Moreover, you'll have to set the username/password in your BindindProvider before performing the invocation. You don't have to manually deal with the soap-handler and its tokens, since the jbossws ws-security extension will do it for you.

            • 3. Re: UsernameToken authentication using JBossWS
              Leandro Sales Newbie

              Do you say something like this:

              Map<String, Object> requestContext = ((BindingProvider)serviceSoap).getRequestContext();
              requestContext.put(BindingProvider.USERNAME_PROPERTY, "OULU");
              requestContext.put(BindingProvider.PASSWORD_PROPERTY, "810420_A");

              If yes, I did and it doesn't work.

              When I run wsconsumer against the wsdl, it generated the UsernameToken java class and I can instantiate it:

              UsernameToken usernameToken = new UsernameToken();
              usernameToken.setUsername("xxx");
              usernameToken.setPassword("yyyy");

              But how to add this object into the SOAP Header?

              Thanks,
              Leandro.

              • 4. Re: UsernameToken authentication using JBossWS
                Alessio Soldano Master

                 

                "leandroal" wrote:
                Do you say something like this:

                Map<String, Object> requestContext = ((BindingProvider)serviceSoap).getRequestContext();
                requestContext.put(BindingProvider.USERNAME_PROPERTY, "OULU");
                requestContext.put(BindingProvider.PASSWORD_PROPERTY, "810420_A");

                If yes, I did and it doesn't work.

                When I run wsconsumer against the wsdl, it generated the UsernameToken java class and I can instantiate it:

                UsernameToken usernameToken = new UsernameToken();
                usernameToken.setUsername("xxx");
                usernameToken.setPassword("yyyy");

                But how to add this object into the SOAP Header?

                Thanks,
                Leandro.


                OK, please post here the wsdl of the service you would like to call. It seems that the endpoint you're hitting is not using the standard ws-security + username token. It's using a custom soap header named the same way (but with different namespace, yesterday I didn't noticed it, sorry).
                If you can't change the service contract (using the standard security would of course be better), you issue becomes "how do I set up a custom soap header?". Setting a soap header should be quite straightforward, however it seems you have an issue with the tools, since wsconsume is not correctly creating the parameter corresponding to the header. Please post here the wsdl so that we can try to understand why.


                • 5. Re: UsernameToken authentication using JBossWS
                  Leandro Sales Newbie

                  Hi Alessio, here it is:

                  <?xml version="1.0" encoding="UTF-8"?>
                  <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
                  xmlns:tns="http://www.xxx.com/" xmlns:s1="http://www.xxx.com/security"
                  xmlns:s="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
                  targetNamespace="http://www.xxx.com/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This web service
                  provides real-time data data.</wsdl:documentation>
                   <wsdl:types>
                   <s:schema elementFormDefault="qualified"
                  targetNamespace="http://www.xxx.com/">
                   <s:element name="GetStations">
                   <s:complexType/>
                   </s:element>
                   <s:element name="GetStationsResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetStationsResult" type="tns:ArrayOfStation"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:complexType name="ArrayOfStation">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="unbounded"
                  name="Station" nillable="true" type="tns:Station"/>
                   </s:sequence>
                   </s:complexType>
                   <s:complexType name="Station">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="StationName"
                  type="s:string"/>
                   <s:element minOccurs="1" maxOccurs="1" name="StationNumber"
                  type="s:int"/>
                   <s:element minOccurs="1" maxOccurs="1" name="Altitude"
                  type="s:double"/>
                   <s:element minOccurs="1" maxOccurs="1" name="Latitude"
                  type="s:double"/>
                   <s:element minOccurs="1" maxOccurs="1" name="Longitude"
                  type="s:double"/>
                   <s:element minOccurs="1" maxOccurs="1" name="SensorHeight"
                  type="s:double"/>
                   </s:sequence>
                   </s:complexType>
                   <s:element name="GetObservationVariablesByStation">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="stationName"
                  type="s:string"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetObservationVariablesByStationResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetObservationVariablesByStationResult"
                  type="tns:ArrayOfString"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:complexType name="ArrayOfString">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="unbounded" name="string"
                  nillable="true" type="s:string"/>
                   </s:sequence>
                   </s:complexType>
                   <s:element name="GetLatestObservationByStationAndVariable">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="stationName"
                  type="s:string"/>
                   <s:element minOccurs="0" maxOccurs="1" name="obsVariable"
                  type="s:string"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetLatestObservationByStationAndVariableResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetLatestObservationByStationAndVariableResult"
                  type="tns:Observation"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:complexType name="Observation">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="ObsVariable"
                  type="s:string"/>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="ObsVariableUnit" type="s:string"/>
                   <s:element minOccurs="1" maxOccurs="1" name="ObsValue"
                  type="s:double"/>
                   <s:element minOccurs="1" maxOccurs="1" name="ObsTime"
                  type="s:dateTime"/>
                   <s:element minOccurs="1" maxOccurs="1" name="ObsStatus" type="s:int"/>
                   </s:sequence>
                   </s:complexType>
                   <s:element name="GetLatestObservationsByStation">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="stationName"
                  type="s:string"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetLatestObservationsByStationResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetLatestObservationsByStationResult"
                  type="tns:ArrayOfObservation"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:complexType name="ArrayOfObservation">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="unbounded"
                  name="Observation" nillable="true" type="tns:Observation"/>
                   </s:sequence>
                   </s:complexType>
                   <s:element name="GetObservationsByStationAndVariable">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="stationName"
                  type="s:string"/>
                   <s:element minOccurs="0" maxOccurs="1" name="obsVariable"
                  type="s:string"/>
                   <s:element minOccurs="1" maxOccurs="1" name="start"
                  type="s:dateTime"/>
                   <s:element minOccurs="1" maxOccurs="1" name="stop"
                  type="s:dateTime"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetObservationsByStationAndVariableResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetObservationsByStationAndVariableResult"
                  type="tns:ArrayOfObservation"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetObservationsByStation">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="stationName"
                  type="s:string"/>
                   <s:element minOccurs="1" maxOccurs="1" name="start"
                  type="s:dateTime"/>
                   <s:element minOccurs="1" maxOccurs="1" name="stop"
                  type="s:dateTime"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   <s:element name="GetObservationsByStationResponse">
                   <s:complexType>
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1"
                  name="GetObservationsByStationResult" type="tns:ArrayOfObservation"/>
                   </s:sequence>
                   </s:complexType>
                   </s:element>
                   </s:schema>
                   <s:schema elementFormDefault="qualified"
                  targetNamespace="http://www.xxx.com/security">
                   <s:element name="UsernameToken" type="s1:UsernameToken"/>
                   <s:complexType name="UsernameToken">
                   <s:sequence>
                   <s:element minOccurs="0" maxOccurs="1" name="username"
                  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="GetStationsSoapIn">
                   <wsdl:part name="parameters" element="tns:GetStations"/>
                   </wsdl:message>
                   <wsdl:message name="GetStationsSoapOut">
                   <wsdl:part name="parameters" element="tns:GetStationsResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetStationsUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationVariablesByStationSoapIn">
                   <wsdl:part name="parameters"
                  element="tns:GetObservationVariablesByStation"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationVariablesByStationSoapOut">
                   <wsdl:part name="parameters"
                  element="tns:GetObservationVariablesByStationResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationVariablesByStationUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationByStationAndVariableSoapIn">
                   <wsdl:part name="parameters"
                  element="tns:GetLatestObservationByStationAndVariable"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationByStationAndVariableSoapOut">
                   <wsdl:part name="parameters"
                  element="tns:GetLatestObservationByStationAndVariableResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationByStationAndVariableUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationsByStationSoapIn">
                   <wsdl:part name="parameters" element="tns:GetLatestObservationsByStation"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationsByStationSoapOut">
                   <wsdl:part name="parameters"
                  element="tns:GetLatestObservationsByStationResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetLatestObservationsByStationUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationAndVariableSoapIn">
                   <wsdl:part name="parameters"
                  element="tns:GetObservationsByStationAndVariable"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationAndVariableSoapOut">
                   <wsdl:part name="parameters"
                  element="tns:GetObservationsByStationAndVariableResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationAndVariableUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationSoapIn">
                   <wsdl:part name="parameters" element="tns:GetObservationsByStation"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationSoapOut">
                   <wsdl:part name="parameters"
                  element="tns:GetObservationsByStationResponse"/>
                   </wsdl:message>
                   <wsdl:message name="GetObservationsByStationUsernameToken">
                   <wsdl:part name="UsernameToken" element="s1:UsernameToken"/>
                   </wsdl:message>
                   <wsdl:portType name="xxx_x0020_Web_x0020_ServiceSoap">
                   <wsdl:operation name="GetStations">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">...</wsdl:documentation>
                   <wsdl:input message="tns:GetStationsSoapIn"/>
                   <wsdl:output message="tns:GetStationsSoapOut"/>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationVariablesByStation">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">...</wsdl:documentation>
                   <wsdl:input message="tns:GetObservationVariablesByStationSoapIn"/>
                   <wsdl:output message="tns:GetObservationVariablesByStationSoapOut"/>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationByStationAndVariable">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">...</wsdl:documentation>
                   <wsdl:input message="tns:GetLatestObservationByStationAndVariableSoapIn"/>
                   <wsdl:output
                  message="tns:GetLatestObservationByStationAndVariableSoapOut"/>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationsByStation">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">...</wsdl:documentation>
                   <wsdl:input message="tns:GetLatestObservationsByStationSoapIn"/>
                   <wsdl:output message="tns:GetLatestObservationsByStationSoapOut"/>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStationAndVariable">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">...</wsdl:documentation>
                   <wsdl:input message="tns:GetObservationsByStationAndVariableSoapIn"/>
                   <wsdl:output message="tns:GetObservationsByStationAndVariableSoapOut"/>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStation">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">....</wsdl:documentation>
                   <wsdl:input message="tns:GetObservationsByStationSoapIn"/>
                   <wsdl:output message="tns:GetObservationsByStationSoapOut"/>
                   </wsdl:operation>
                   </wsdl:portType>
                   <wsdl:binding name="xxx_x0020_Web_x0020_ServiceSoap"
                  type="tns:xxx_x0020_Web_x0020_ServiceSoap">
                   <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
                   <wsdl:operation name="GetStations">
                   <soap:operation soapAction="http://www.xxx.com/GetStations"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header message="tns:GetStationsUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationVariablesByStation">
                   <soap:operation
                  soapAction="http://www.xxx.com/GetObservationVariablesByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header
                  message="tns:GetObservationVariablesByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationByStationAndVariable">
                   <soap:operation
                  soapAction="http://www.xxx.com/GetLatestObservationByStationAndVariable"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header
                  message="tns:GetLatestObservationByStationAndVariableUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationsByStation">
                   <soap:operation
                  soapAction="http://www.xxx.com/GetLatestObservationsByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header
                  message="tns:GetLatestObservationsByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStationAndVariable">
                   <soap:operation
                  soapAction="http://www.xxx.com/GetObservationsByStationAndVariable"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header
                  message="tns:GetObservationsByStationAndVariableUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStation">
                   <soap:operation
                  soapAction="http://www.xxx.com/GetObservationsByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap:body use="literal"/>
                   <soap:header
                  message="tns:GetObservationsByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   </wsdl:binding>
                   <wsdl:binding name="xxx_x0020_Web_x0020_ServiceSoap12"
                  type="tns:xxx_x0020_Web_x0020_ServiceSoap">
                   <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
                   <wsdl:operation name="GetStations">
                   <soap12:operation soapAction="http://www.xxx.com/GetStations"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header message="tns:GetStationsUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationVariablesByStation">
                   <soap12:operation
                  soapAction="http://www.xxx.com/GetObservationVariablesByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header
                  message="tns:GetObservationVariablesByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationByStationAndVariable">
                   <soap12:operation
                  soapAction="http://www.xxx.com/GetLatestObservationByStationAndVariable"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header
                  message="tns:GetLatestObservationByStationAndVariableUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetLatestObservationsByStation">
                   <soap12:operation
                  soapAction="http://www.xxx.com/GetLatestObservationsByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header
                  message="tns:GetLatestObservationsByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStationAndVariable">
                   <soap12:operation
                  soapAction="http://www.xxx.com/GetObservationsByStationAndVariable"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header
                  message="tns:GetObservationsByStationAndVariableUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   <wsdl:operation name="GetObservationsByStation">
                   <soap12:operation
                  soapAction="http://www.xxx.com/GetObservationsByStation"
                  style="document"/>
                   <wsdl:input>
                   <soap12:body use="literal"/>
                   <soap12:header
                  message="tns:GetObservationsByStationUsernameToken"
                  part="UsernameToken" use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                   <soap12:body use="literal"/>
                   </wsdl:output>
                   </wsdl:operation>
                   </wsdl:binding>
                   <wsdl:service name="xxx_x0020_Web_x0020_Service">
                   <wsdl:documentation
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This web service
                  provides real-time data data.</wsdl:documentation>
                   <wsdl:port name="xxx_x0020_Web_x0020_ServiceSoap"
                  binding="tns:xxx_x0020_Web_x0020_ServiceSoap">
                   <soap:address location="http://yyy.xxx.net/WebSite/dataData.asmx"/>
                   </wsdl:port>
                   <wsdl:port name="xxx_x0020_Web_x0020_ServiceSoap12"
                  binding="tns:xxx_x0020_Web_x0020_ServiceSoap12">
                   <soap12:address location="http://yyy.xxx.net/WebSite/dataData.asmx"/>
                   </wsdl:port>
                   </wsdl:service>
                  </wsdl:definitions>
                  


                  • 6. Re: UsernameToken authentication using JBossWS
                    Alessio Soldano Master

                    This seems to me a problem with the wsdl you're trying to consume, in particular the same problem pointed out here http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109715. Perhaps it might be an interoperability issue with .NET wsdl containing soap headers. I'll investigate further tomorrow and open a jira issue if required. In the mean time you might try feeding wsconsume with a manually fixed wsdl with a binding/operation/input definition specifying the right parts, like in PingService.wsdl of the webparam samples in the binary distribution.