axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alecsandru Chirosca <alecsandru.chiro...@comtec.ro>
Subject Re: SOAP Body and Header response
Date Tue, 26 Apr 2005 07:11:46 GMT
Thanks for your answer!

You are refering to a Context. What is this context?

I have build the --server-side of the service WSDL and I don't have any
reference to a contaxt in the impl class.
Please help.


Sorry, but I'm now to AXIS.

Br,
Alecs

On Mon, 2005-04-25 at 10:22 -0400, mmalinos@aessuccess.org wrote:
> Alecs,
> 
> If I understand you're question correctly, the following code should help.
> 
> Service Side:
> 
> String someResponse = "some response";
> 
> // Get Response Envelope
> SOAPEnvelope responseEnv = ctx.getResponseMessage().getSOAPEnvelope();
> 
> // Create Bean
> ResponseHeader responseHeader = new ResponseHeader();
> responseHeader.setValue1("Value1");
> responseHeader.setValue2("Value2");
> ...
> 
> // Create SOAP Header Element
> SOAPHeaderElement responseHeaderElement = new
> SOAPHeaderElement("http://www.somedomainname.com", "ResponseHeader",
> responseHeader);
> or
> SOAPHeaderElement responseHeaderElement = new
> SOAPHeaderElement("http://www.somedomainname.com", "ResponseHeader");
> responseHeaderElement.setObjectValue(responseHeader);
> 
> 
> // Add header to response envelope
> responseEnv.addHeader(responseRoutingElement);
> 
> return response;
> 
> 
> Client Side is similar:
> 
> // After the invoke
> 
> //Get the response envelope
> SOAPEnvelope returnEnv =
> call.getMessageContext().getResponseMessage().getSOAPEnvelope();
> 
> //Get the header with the same names that you put it into the SOAP with.
> SOAPHeaderElement responseHeaderElement =
> returnEnv.getHeaderByName("http://www.somedomainname.com","ResponseHeader");
> 
> //Grab the object out of the header element.
> responseHeader = null;
> if(responseHeaderElement != null)
> {
>       // Get the bean from the SOAP...
>       responseHeader = (ResponseHeader)
> responseHeaderElement.getObjectValue();
>       // Do whatever you need to do.
> }
> else
> {
>       // Trouble
>       System.out.println("headerElement = null");
> }
> 
> 
> You need to make sure you have your bean serialization/deserialization
> set-up correctly on both ends.
> The response will be in the return value from the invoke...
> 
> Mark A. Malinoski
> AES/PHEAA
> Technical Coordinator/Web Development
> 717-720-2413
> mmalinos@aessuccess.org
> 
> 
> 
> 
>                                                                            
>              Alecsandru                                                    
>              Chirosca                                                      
>              <alecsandru.chiro                                          To 
>              sca@comtec.ro>            axis-user@ws.apache.org             
>                                                                         cc 
>              04/25/2005 09:48                                              
>              AM                                                    Subject 
>                                        SOAP Body and Header response       
>                                                                            
>              Please respond to                                             
>              axis-user@ws.apac                                             
>                   he.org                                                   
>                                                                            
>                                                                            
> 
> 
> 
> 
> Hi,
> 
> Please help me wth this one....
> 
> I tryed and googled a lot in the last 10 days without any result. I need
> to return a SOAP response that is containing informations in both SOAP
> header and SOAP body. I have the beans that correctly serialize to the
> elements in header and boby but I cannot put them togheter.
> 
> Please point me in the right direction here...
> 
> 
> BR,
> Alecs
> 
> 
> 


Mime
View raw message