What I did was to add a list of Element named "headers" to the proxy
class and two new methods (addHeader(Element) and removeHeaders()),
then I changed the invoke method to include that headers. That is the
code of a modified operation:

private Vector<Element> headers = new Vector<Element>();
        
        
        public void addHeaderElement(Element header) {
                headers.add(header);
                
        }
        
        public void removeAllHeaders() {
                headers.removeAllElements();
        }
        
        public String install(URI packageLocation)
                throws SoapFault
        {
                Object[] params = new Object[1];

                params[0] = packageLocation;

                ProxyHandler handler = getHandler("install");
                Element body = handler.toXML(params);
                Element[] a = {};
                Element[] elementHeaders = headers.toArray(a);
                Element retElement = 
invoke(handler.getAction(),body,elementHeaders);
                return (String)handler.fromXML(retElement);
        }

I don't think adding that two operations to an upper level (say
AbstractResourceClient) would be too much trouble.

On 12/12/06, Daniel Jemiolo <[EMAIL PROTECTED]> wrote:
We added some support for this in 2.1, although it may not be perfect
(suggestions are welcome). Here's the JavaDoc on the method that clients
can call down to in order to send custom headers with their request:


http://ws.apache.org/muse/docs/2.1.0/javadoc/org/apache/muse/core/AbstractResourceClient.html#invoke(java.lang.String,%20org.w3c.dom.Element,%20org.w3c.dom.Element[])


You can change the generated client method implementation to use this
invoke() instead of the normal one, giving you the opportunity to provide
custom headers.

One issue with providing the headers through some other means
(addHeader(), etc.) is that the clients are stateless. Any alternative
would either need to handle this stateless-ness or suggest a stateful
solution that isn't too hard to use.

Dan



"José Antonio Sánchez" <[EMAIL PROTECTED]> wrote on 12/12/2006 12:16:24
PM:

> When I generate a client stub in Axis2 I can use the method
> stub._getServiceClient().addHeader(OMElement element) to add a custom
> element to the request's SOAP header but I cannot find something
> similar in the Muse proxy. Is there a way to use a generated proxy and
> to add a custom element to the header?
> If there is no direct method to do this, is it safe to use a
> ResourceParameter in the EndpointReference to send that custom
> message?
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to