2 Replies Latest reply on Mar 2, 2011 5:23 PM by Mikereiche-Oracle

    UsernameToken header not present in generated SOAP request

      To the native web service '.ws' file I attached a custom UsernameToken policy for REQUEST_ONLY. In the generated WSDL the Policy element is present and "UsingPolicy" is "true".

      I created a Web Service Client using the WSDL and used the below program to send the request:

                CUSTORDERSITEMSSoapService service = new CUSTORDERSITEMSSoapService();
                com.client.CUSTORDERSITEMSPT port = service.getCUSTORDERSITEMSSoapPort();

                List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
                CredentialProvider cp = new ClientUNTCredentialProvider("weblogic".getBytes(), "weblogic".getBytes());
                Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
                rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);

                List<CUSTORDERSITEMS> list = port.custOrdersItemsByLastName("Black");
                System.out.println("No. of Items : " + list.size());

      But in generated SOAP request UsernameToken header is not present.

      Please help.

      Edited by: user13557104 on Mar 2, 2011 1:27 AM