title: i have problems in consume WCF service using JAX-WS in java
body: <p>I have to consume this service exposed in WCF with authentication and ssl.
  i generated the client using JAX-WS wsimport tool.
  But when i run the application this returns this error:</p>
  
  <pre><code>Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: An error occurred when verifying security for the message.
      at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
      at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
      at $Proxy30.solicitarRecarga(Unknown Source)
      at postilion.realtime.efecty.ws.test.Test.main(Test.java:113)
  </code></pre>
  
  <p><strong>This is my wsdl:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;wsdl:definitions name="ServicioRecargas" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"&gt;
      &lt;wsp:Policy wsu:Id="ServicioRecargas_policy"&gt;
          &lt;wsp:ExactlyOne&gt;
              &lt;wsp:All&gt;
                  &lt;sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                      &lt;wsp:Policy&gt;
                          &lt;sp:TransportToken&gt;
                              &lt;wsp:Policy&gt;
                                  &lt;sp:HttpsToken RequireClientCertificate="false"/&gt;
                              &lt;/wsp:Policy&gt;
                          &lt;/sp:TransportToken&gt;
                          &lt;sp:AlgorithmSuite&gt;
                              &lt;wsp:Policy&gt;
                                  &lt;sp:TripleDesSha256Rsa15/&gt;
                              &lt;/wsp:Policy&gt;
                          &lt;/sp:AlgorithmSuite&gt;
                          &lt;sp:Layout&gt;
                              &lt;wsp:Policy&gt;
                                  &lt;sp:Lax/&gt;
                              &lt;/wsp:Policy&gt;
                          &lt;/sp:Layout&gt;
                          &lt;sp:IncludeTimestamp/&gt;
                      &lt;/wsp:Policy&gt;
                  &lt;/sp:TransportBinding&gt;
                  &lt;sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                      &lt;wsp:Policy&gt;
                          &lt;sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt;
                              &lt;wsp:Policy&gt;
                                  &lt;sp:WssUsernameToken10/&gt;
                              &lt;/wsp:Policy&gt;
                          &lt;/sp:UsernameToken&gt;
                      &lt;/wsp:Policy&gt;
                  &lt;/sp:SignedSupportingTokens&gt;
                  &lt;sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt;
                      &lt;wsp:Policy&gt;
                          &lt;sp:MustSupportRefKeyIdentifier/&gt;
                          &lt;sp:MustSupportRefIssuerSerial/&gt;
                      &lt;/wsp:Policy&gt;
                  &lt;/sp:Wss10&gt;
              &lt;/wsp:All&gt;
          &lt;/wsp:ExactlyOne&gt;
      &lt;/wsp:Policy&gt;
      &lt;wsdl:types&gt;
          &lt;xsd:schema targetNamespace="http://tempuri.org/Imports"&gt;
              &lt;xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd0.xsd" namespace="http://tempuri.org/"/&gt;
              &lt;xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd1.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/&gt;
              &lt;xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd" namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"/&gt;
          &lt;/xsd:schema&gt;
      &lt;/wsdl:types&gt;
      &lt;wsdl:message name="IServicioRecargas_ConsultarRecarga_InputMessage"&gt;
          &lt;wsdl:part name="parameters" element="tns:ConsultarRecarga"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="IServicioRecargas_ConsultarRecarga_OutputMessage"&gt;
          &lt;wsdl:part name="parameters" element="tns:ConsultarRecargaResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="IServicioRecargas_solicitarRecarga_InputMessage"&gt;
          &lt;wsdl:part name="parameters" element="tns:solicitarRecarga"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="IServicioRecargas_solicitarRecarga_OutputMessage"&gt;
          &lt;wsdl:part name="parameters" element="tns:solicitarRecargaResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:portType name="IServicioRecargas"&gt;
          &lt;wsdl:operation name="ConsultarRecarga"&gt;
              &lt;wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecarga" message="tns:IServicioRecargas_ConsultarRecarga_InputMessage"/&gt;
              &lt;wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecargaResponse" message="tns:IServicioRecargas_ConsultarRecarga_OutputMessage"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="solicitarRecarga"&gt;
              &lt;wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecarga" message="tns:IServicioRecargas_solicitarRecarga_InputMessage"/&gt;
              &lt;wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecargaResponse" message="tns:IServicioRecargas_solicitarRecarga_OutputMessage"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
      &lt;wsdl:binding name="ServicioRecargas" type="tns:IServicioRecargas"&gt;
          &lt;wsp:PolicyReference URI="#ServicioRecargas_policy"/&gt;
          &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;wsdl:operation name="ConsultarRecarga"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/IServicioRecargas/ConsultarRecarga" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="solicitarRecarga"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/IServicioRecargas/solicitarRecarga" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="ServicioRecargas"&gt;
          &lt;wsdl:port name="ServicioRecargas" binding="tns:ServicioRecargas"&gt;
              &lt;soap:address location="https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p><strong>This is my ServicioRecargas.svc.xsd_xsd0.xsd:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"
      xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/"&gt;
      &lt;xs:import
          schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd"
          namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" /&gt;
      &lt;xs:element name="ConsultarRecarga"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element minOccurs="0" name="request" nillable="true"
                      type="q1:RequestConfirmarRecarga"
                      xmlns:q1="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" /&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="ConsultarRecargaResponse"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element minOccurs="0" name="ConsultarRecargaResult"
                      nillable="true" type="q2:ResponseConfirmarRecarga"
                      xmlns:q2="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" /&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="solicitarRecarga"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element minOccurs="0" name="request" nillable="true"
                      type="q3:RequestRecargarCelular"
                      xmlns:q3="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" /&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="solicitarRecargaResponse"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element minOccurs="0" name="solicitarRecargaResult"
                      nillable="true" type="q4:ResponseRecargarCelular"
                      xmlns:q4="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" /&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p><strong>this is my ServicioRecargas.svc.xsd_xsd1.xsd:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;xs:schema attributeFormDefault="qualified"
      elementFormDefault="qualified"
      targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
      xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/"&gt;
      &lt;xs:element name="anyType" nillable="true" type="xs:anyType" /&gt;
      &lt;xs:element name="anyURI" nillable="true" type="xs:anyURI" /&gt;
      &lt;xs:element name="base64Binary" nillable="true" type="xs:base64Binary" /&gt;
      &lt;xs:element name="boolean" nillable="true" type="xs:boolean" /&gt;
      &lt;xs:element name="byte" nillable="true" type="xs:byte" /&gt;
      &lt;xs:element name="dateTime" nillable="true" type="xs:dateTime" /&gt;
      &lt;xs:element name="decimal" nillable="true" type="xs:decimal" /&gt;
      &lt;xs:element name="double" nillable="true" type="xs:double" /&gt;
      &lt;xs:element name="float" nillable="true" type="xs:float" /&gt;
      &lt;xs:element name="int" nillable="true" type="xs:int" /&gt;
      &lt;xs:element name="long" nillable="true" type="xs:long" /&gt;
      &lt;xs:element name="QName" nillable="true" type="xs:QName" /&gt;
      &lt;xs:element name="short" nillable="true" type="xs:short" /&gt;
      &lt;xs:element name="string" nillable="true" type="xs:string" /&gt;
      &lt;xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" /&gt;
      &lt;xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" /&gt;
      &lt;xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" /&gt;
      &lt;xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" /&gt;
      &lt;xs:element name="char" nillable="true" type="tns:char" /&gt;
      &lt;xs:simpleType name="char"&gt;
          &lt;xs:restriction base="xs:int" /&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:element name="duration" nillable="true" type="tns:duration" /&gt;
      &lt;xs:simpleType name="duration"&gt;
          &lt;xs:restriction base="xs:duration"&gt;
              &lt;xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" /&gt;
              &lt;xs:minInclusive value="-P10675199DT2H48M5.4775808S" /&gt;
              &lt;xs:maxInclusive value="P10675199DT2H48M5.4775807S" /&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:element name="guid" nillable="true" type="tns:guid" /&gt;
      &lt;xs:simpleType name="guid"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern
                  value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" /&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:attribute name="FactoryType" type="xs:QName" /&gt;
      &lt;xs:attribute name="Id" type="xs:ID" /&gt;
      &lt;xs:attribute name="Ref" type="xs:IDREF" /&gt;
  &lt;/xs:schema&gt;
  
  **and last this is my ServicioRecargas.svc.xsd_xsd2.xsd:**
  
      &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;xs:schema elementFormDefault="qualified"
      targetNamespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:tns="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"&gt;
      &lt;xs:complexType name="RequestConfirmarRecarga"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element minOccurs="0" name="CodigoPS" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="NombreCajero" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="idTx" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="llaveSesion" nillable="true"
                  type="xs:string" /&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:element name="RequestConfirmarRecarga" nillable="true"
          type="tns:RequestConfirmarRecarga" /&gt;
      &lt;xs:complexType name="ResponseConfirmarRecarga"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element minOccurs="0" name="codigoMensaje" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="idTx" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="mensaje" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="observaciones" nillable="true"
                  type="xs:string" /&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:element name="ResponseConfirmarRecarga" nillable="true"
          type="tns:ResponseConfirmarRecarga" /&gt;
      &lt;xs:complexType name="RequestRecargarCelular"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element minOccurs="0" name="Caja" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="CodigoPS" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="CodigoProyectoRecarga"
                  type="xs:long" /&gt;
              &lt;xs:element minOccurs="0" name="DescripcionPS" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="NombreCajero" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="NumeroCelular" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="Regional" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="ValorRecarga" type="xs:decimal" /&gt;
              &lt;xs:element minOccurs="0" name="llaveSesion" nillable="true"
                  type="xs:string" /&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:element name="RequestRecargarCelular" nillable="true"
          type="tns:RequestRecargarCelular" /&gt;
      &lt;xs:complexType name="ResponseRecargarCelular"&gt;
          &lt;xs:sequence&gt;
              &lt;xs:element minOccurs="0" name="IdentificadorTransaccion"
                  nillable="true" type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="codigoMensaje" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="mensaje" nillable="true"
                  type="xs:string" /&gt;
              &lt;xs:element minOccurs="0" name="observaciones" nillable="true"
                  type="xs:string" /&gt;
          &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
      &lt;xs:element name="ResponseRecargarCelular" nillable="true"
          type="tns:ResponseRecargarCelular" /&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>with these files I could generate my classes wsimport tool using JAX-WS</p>
  
  <pre><code> public class Test {
  
  
      static {
          HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
              {
                  @Override
                  public boolean verify(String hostname, SSLSession session)
                  {
                      if (hostname.equals("SOME_IP"))
                          return true;
                      return false;
                  }   
              });
      }
  
      /**
       * @param args
       * @throws MalformedURLException 
       */
      public static void main(String[] args) throws MalformedURLException {
  
          String trustStore = System.getProperty("javax.net.ssl.trustStore");
          System.setProperty("javax.net.ssl.trustStore", "C:\\Users\\ggomezb\\Desktop\\WS_Efecty_ADB\\config\\jks\\efecty.jks");
          trustStore = System.getProperty("javax.net.ssl.trustStorePassword");
          System.setProperty("javax.net.ssl.trustStorePassword", "123456");
  
          IServicioRecargas service;
          URL wsUrl = new URL("https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc");
  
          QName wsQName = new QName("http://tempuri.org/", "ServicioRecargas");
          ServicioRecargas impl = new ServicioRecargas(wsUrl, wsQName);
          service = impl.getServicioRecargas();
  
  
          //BindingProvider bindingProvider = (BindingProvider) service;
          //bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsUrl.toString());
          //bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "usuarioCajeros");
          //bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q==");
  
          Map&lt;String, Object&gt; req_ctx = ((BindingProvider)service).getRequestContext();
          req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsUrl.toString());
  
          Map&lt;String, List&lt;String&gt;&gt; headers = new HashMap&lt;String, List&lt;String&gt;&gt;();
          headers.put("Username", Collections.singletonList("usuarioCajeros"));
          headers.put("Password", Collections.singletonList("5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q=="));
          req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
  
  
  
          SolicitarRecarga solicitarRecarga = new SolicitarRecarga();
          RequestRecargarCelular requestRecargarCelular = new RequestRecargarCelular();        
  
          ObjectFactory factory = new ObjectFactory();
          JAXBElement&lt;String&gt; createLlaveSesion = factory.createRequestRecargarCelularLlaveSesion("c8ffe140-8dc3-413f-a469-a359f45ef0a1");
          JAXBElement&lt;String&gt; createCodigoPS = factory.createRequestRecargarCelularCodigoPS("010010");
          JAXBElement&lt;String&gt; createDescripcionPS = factory.createRequestRecargarCelularDescripcionPS("prueba");
          JAXBElement&lt;String&gt; createNombreCajero = factory.createRequestRecargarCelularNombreCajero("epardo");
          JAXBElement&lt;String&gt; createCaja = factory.createRequestRecargarCelularCaja("1");
          long codigoProyectoRegional = 110145;
          JAXBElement&lt;String&gt; createRegional = factory.createRequestRecargarCelularRegional("1");
          JAXBElement&lt;String&gt; createNumeroCelular = factory.createRequestRecargarCelularNumeroCelular("3118027200");
          BigDecimal valorRecarga = new BigDecimal(10000);
  
          requestRecargarCelular.setLlaveSesion(createLlaveSesion);
          requestRecargarCelular.setCodigoPS(createCodigoPS);
          requestRecargarCelular.setDescripcionPS(createDescripcionPS);
          requestRecargarCelular.setNombreCajero(createNombreCajero);
          requestRecargarCelular.setCaja(createCaja);
          requestRecargarCelular.setCodigoProyectoRecarga(codigoProyectoRegional);
          requestRecargarCelular.setRegional(createRegional);
          requestRecargarCelular.setNumeroCelular(createNumeroCelular);
          requestRecargarCelular.setValorRecarga(valorRecarga);
  
          JAXBElement&lt;RequestRecargarCelular&gt; requestConfirmarRecargaJAXB = factory.createRequestRecargarCelular(requestRecargarCelular);
  
          solicitarRecarga.setRequest(requestConfirmarRecargaJAXB);
  
          JAXBElement&lt;RequestRecargarCelular&gt; requestRecargarCelularJAXB = solicitarRecarga.getRequest();
          requestRecargarCelular = requestRecargarCelularJAXB.getValue();
  
          SolicitarRecargaResponse rta = new SolicitarRecargaResponse();
  
          ResponseRecargarCelular responseRecargarCelular = service.solicitarRecarga(requestRecargarCelular);
  
          System.out.println(responseRecargarCelular.getCodigoMensaje());
  
  
      }
  
  }
  </code></pre>
  
  <p>I have tried many ways to I login and use the web service to my client but I could not use it...</p>
  
  <p>the last form was created using a handler to add headers to soap message follows and I throw the following error:</p>
  
  <p>This is my Handler Class:</p>
  
  <pre><code>public class WebServiceLogger implements SOAPHandler&lt;SOAPMessageContext&gt; {
  
          @Override
          public Set&lt;QName&gt; getHeaders() {
              return null;
          }
  
          @Override
          public void close(MessageContext arg0) {                
          }
  
          @Override
          public boolean handleFault(SOAPMessageContext arg0) {
                  SOAPMessage message= arg0.getMessage();
                  try {
                      message.writeTo(System.out);
                  } catch (SOAPException e) {
                          e.printStackTrace();
                  } catch (IOException e) {
                          e.printStackTrace();
                  }
                  return false;
          }
  
          @Override
          public boolean handleMessage(SOAPMessageContext arg0) {
                  SOAPMessage message= arg0.getMessage();
                  boolean isOutboundMessage=  (Boolean)arg0.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY);
                  try {
                      if(isOutboundMessage){
                              System.out.println("OUTBOUND MESSAGE\n");
  
                              SOAPEnvelope envelope = arg0.getMessage().getSOAPPart().getEnvelope();
                              SOAPHeader header = envelope.addHeader();
  
                              SOAPElement security = header.addChildElement("Security", "S", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
  
                              SOAPElement usernameToken = security.addChildElement("UsernameToken", "S");
                              usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
  
                              SOAPElement username = usernameToken.addChildElement("Username", "S");
                              username.addTextNode("usuarioCajeros");
  
                              SOAPElement password = usernameToken.addChildElement("Password", "S");
                              password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
                              password.addTextNode("5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q==");                  
  
                              message.writeTo(System.out);
  
                      }else{
                              System.out.println("INBOUND MESSAGE\n");
                              message.writeTo(System.out);
                      }
  
                  } catch (SOAPException e) {
                          e.printStackTrace();
                          e.notifyAll();
                  } catch (IOException e) {
                          e.printStackTrace();
                          e.notifyAll();
                  }
                  return false;
          } 
  }
  </code></pre>
  
  <p>i get this error in my wrappers from my gerenated code:</p>
  
  <pre><code>OUTBOUND MESSAGE
  
  &lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;S:Header&gt;&lt;S:Security xmlns:S="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;&lt;S:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;&lt;S:Username&gt;usuarioCajeros&lt;/S:Username&gt;&lt;S:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q==&lt;/S:Password&gt;&lt;/S:UsernameToken&gt;&lt;/S:Security&gt;&lt;/S:Header&gt;&lt;S:Body&gt;&lt;ns2:solicitarRecarga xmlns="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" xmlns:ns2="http://tempuri.org/" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/"&gt;&lt;ns2:request&gt;&lt;Caja&gt;1&lt;/Caja&gt;&lt;CodigoPS&gt;010010&lt;/CodigoPS&gt;&lt;CodigoProyectoRecarga&gt;110145&lt;/CodigoProyectoRecarga&gt;&lt;DescripcionPS&gt;prueba&lt;/DescripcionPS&gt;&lt;NombreCajero&gt;epardo&lt;/NombreCajero&gt;&lt;NumeroCelular&gt;3118027200&lt;/NumeroCelular&gt;&lt;Regional&gt;1&lt;/Regional&gt;&lt;ValorRecarga&gt;10000&lt;/ValorRecarga&gt;&lt;llaveSesion&gt;c8ffe140-8dc3-413f-a469-a359f45ef0a1&lt;/llaveSesion&gt;&lt;/ns2:request&gt;&lt;/ns2:solicitarRecarga&gt;&lt;/S:Body&gt;&lt;/S:Envelope&gt;Exception in thread "main" com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://tempuri.org/}solicitarRecargaResponse but found: {http://tempuri.org/}solicitarRecarga
      at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:203)
      at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:211)
      at com.sun.xml.internal.ws.client.sei.ResponseBuilder$DocLit.readResponse(ResponseBuilder.java:513)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:110)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
      at $Proxy31.solicitarRecarga(Unknown Source)
      at postilion.realtime.efecty.ws.test.Test.main(Test.java:114)
  </code></pre>
  
  <p>I need ur help thanks a lot.</p>