Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP status code from Soap message

 
kaliappan durairaj
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me how to get the HTTP status code from soap message in Webservice.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on the SOAP stack you use. But why do you need that code? You shouldn't tie the service to a particular transport; if you need an error/status code you can make it part of the SOAP response.
 
kaliappan durairaj
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually in Webservices am having an handler at the client side, below the sample code

public boolean handleResponse(MessageContext arg0) {
Logger.info("Entering into the handleResponse method.............", this.getClass());
SOAPMessageContext ctx = (SOAPMessageContext) arg0;
}

How can we get the HTTP status code from the javax.xml.rpc.handler.MessageContext argument?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
https://jax-ws.dev.java.net/articles/MessageContext.html explains how to do that. It's really not good design to rely on HTTP features, though.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic