NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Using Message Handler to edit SOAP header

 
Post new topic   Reply to topic    NetBeans Forums -> SOA Users
View previous topic :: View next topic  
Author Message
lepoja



Joined: 25 Aug 2011
Posts: 1

PostPosted: Thu Aug 25, 2011 10:41 am    Post subject: Using Message Handler to edit SOAP header Reply with quote

Hi people,

I am trying to use message handler in order to edit header or body of SOAP request and response of simple Web service I created (calculates sum of two numbers). Here is code of handleMessage method of my handler:

public boolean handleMessage(SOAPMessageContext messageContext)
{

SOAPMessage message=messageContext.getMessage();
SOAPPart sp = message.getSOAPPart();
SOAPEnvelope se;
SOAPBody sb = null;
SOAPHeader sh = null;

try
{
se = sp.getEnvelope();
sb = se.getBody();
sh = se.getHeader();
}
catch(Exception e)
{
System.out.println("SOAP exception " + e);
}

try
{
QName qname=new QName("http://www.openuri.org/2002/04/soap/conversation/","HeaderElement");
SOAPHeaderElement soap_header=sh.addHeaderElement(qname);

QName bname=new QName("http://www.evision.rs/2002/04/soap/conversation/","BodyElement");
SOAPBodyElement soap_body=sb.addBodyElement(qname);
}
catch(Exception e)
{
System.out.println("Exception : " + e);
}

return true;
}

When I debug this thing it seems that SOAP header and body are beeing edited fine (one element added in header and body). But when I test web service, I get the page with result, where SOAP request and response have no elements I added (screen shot in attachment).

Thank you in advance.



Best regards



webservice_result.jpg
 Description:
SOAP request and response
 Filesize:  435.35 KB
 Viewed:  10349 Time(s)

webservice_result.jpg


Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> SOA Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo