Ask Experts Questions for FREE Help !
Ask
    JavaQA's Avatar
    JavaQA Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 2, 2013, 06:17 PM
    SOAP web service
    We are implementing one JAX-WS Web services which requires to retrieve the username and password in SOAP header elements and use those for further use/processing.
    When we are retrieving username/password it’s coming as null.


    if (Boolean.FALSE.equals(context.get(MessageContext.M ESSAGE_OUTBOUND_PROPERTY))) {
    try {
    SOAPMessage sm = context.getMessage();
    //SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
    SOAPEnvelope envelope = sm.getSOAPPart().getEnvelope();
    SOAPHeader sh = envelope.getHeader();

    System.out.println("Message: "+envelope);
    System.out.println("Envelope: "+envelope);
    System.out.println("Header: "+sh.toString());
    Iterator it = sh.examineAllHeaderElements();
    while(it.hasNext()){
    System.out.println(it.next());
    }

    String username;
    username = sh.getAttribute("Username");
    // username = sh.getAttributeValue("Username");
    //String password = sh.getAttribute("Password");
    System.out.println("uid:"+username);
    //System.out.println("pass: "+password);
    context.put("Username", username);
    //context.put("Passsword", password);
    // default scope is HANDLER (i.e. not readable by SEI
    // implementation)
    context.setScope("Username", MessageContext.Scope.APPLICATION);

Check out some similar questions!

How to send a COM object to a Web service [ 1 Answers ]

Can you please tell me how to send a COM object to a Web service... As it give error that unable to generate XML code. And in inner exception, it says: "Unable to generate a temporary class (result=1). error CS0122: 'System.__ComObject' is inaccessible due to its protection level error...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.