Dear all,

I am developing SOAP web service using netbeans.
As i have got preferred SOAP request and SOAP response,now i want to add security information like username and/or password in my SOAP header Request.

Please tell me how can i modify or add username in my SOAP header Request and same i can get in SOAP Response using netbeans or in which file.

Please help me.

Thank you.

Recommended Answers

All 5 Replies

This is actually a very rarely used feature, so finding documentation on it is difficult. I, for one, believe that sending a username and a password this way is risky, but, if you really need to do so, you can modify the SOAP header request.

The trick is to create a handler for this, there's excellent documentation at this site : http://www.javadb.com/using-a-message-handler-to-alter-the-soap-header-in-a-web-service-client/

My only question is, are you sure this is what you need to do?

hmm, there's rather frequently a need to add request headers.
Of course you will usually need to send things like username and password as an MD5 or SHA hash rather than in plaintext in that header.

Think of things like OAuth2 tokens as well.

More common though is to have those things sent as HTTP headers:
http://www.mkyong.com/webservices/jax-ws/application-authentication-with-jax-ws/

i just to check with particular username specific page has to be open.
means with given username particular page is displayed or not.

i have to pass username in SOAP request.

you were given 2 ways to do that, which one is appropriate for your scenario and the implementation details are up to you to figure out.

I rather prefer sending the details in the HTTP headers, just the username, of course.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.