Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How I can add SOAPAction to header

843833Nov 20 2009 — edited Nov 20 2009
I am using javax.xml.soap.* classes in JSDK 1.6. I have tried several methods to add SOAPAction to header to header like below,

First one:
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", "http://tempuri.org/GetSessionID");

Second one:
Name n = soapEnvelope.createName("SOAPAction");
SOAPHeaderElement soapaction = header.addHeaderElement(n);
soapaction.addTextNode("http://tempuri.org/GetSessionID");
soapaction.setMustUnderstand(true);

All did not work, each time I got an error message.

I run into the code fro the same session http://forums.sun.com/thread.jspa?threadID=5159365, But I did not find any Call class in JSDK.

Service service = new Service();
Call call = (Call) service.createCall();
call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://WebServices.SSO/Login");
call.setTargetEndpointAddress( new java.net.URL(endpointUrl) );

Could you take a look at this problem, I assue that it is so simple for you since I an newbie in SOAP.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2009
Added on Nov 20 2009
1 comment
548 views