You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Matt Coarr <mc...@mitre.org> on 2003/05/30 21:11:37 UTC

getting elements from the soap header in document-based soap

Hello,

I have a application that is making a soap request using document-based 
messages (not rpc) for the request and response.  The server application 
is sending some data back in the soap header.

How can I get the data from the soap header?  Here the basic gist of 
what I'm trying to do:
* call message.send()
* call message.receiveEnvelope() to get the Envelope object that 
encapsulates the SOAP response
* call responseEnvelope.getHeader() to get the Header object
* then grab each of the header parts from the header, each part should 
be an Element stored within the vector returned by getHeaderEntries()

Is this the right way to get the response envelope?

The returned Header object is null.  So this is where I run into trouble.

Here's what shows up in my log (notice that when the envelope is printed 
out, it looks like the header is empty):

  DEBUG [Thread-43] GetPnrProxy - message:
  DEBUG [Thread-43] GetPnrProxy - org.apache.soap.messaging.Message@1441712
  DEBUG [Thread-43] GetPnrProxy - envelope:
  DEBUG [Thread-43] GetPnrProxy - [Attributes={ 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"}] [Header=[Attributes={}] 
[HeaderEntries={[[cwt:pnrHeader: null]]}]] [Body=[Attributes={}] 
[BodyEntries=
[(0)=[cwt:getpnrinfo: null]]
]] [EnvelopeEntries=]
  DEBUG [Thread-43] GetPnrProxy - (soap message sent); getting soap 
transport
  DEBUG [Thread-43] GetPnrProxy - getting response envelope
  DEBUG [Thread-43] GetPnrProxy - responseEnvelope:
  DEBUG [Thread-43] GetPnrProxy - [Attributes={ 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"}] [Header=null] 
[Body=[Attributes={}] [BodyEntries=
[(0)=[soap:Fault: null]]
]] [EnvelopeEntries=]

Thank you very much for any suggestions you may have!
Matt