This discussion is archived
2 Replies Latest reply: Mar 2, 2011 9:23 AM by mikereiche RSS

UsernameToken header not present in generated SOAP request

843971 Newbie
Currently Being Moderated
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


  • Correct Answers - 10 points
  • Helpful Answers - 5 points