You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2002/05/22 23:05:12 UTC

DO NOT REPLY [Bug 9327] New: - org.apache.axis.client.Call.invoke() not adding headers.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9327>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9327

org.apache.axis.client.Call.invoke() not adding headers.

           Summary: org.apache.axis.client.Call.invoke() not adding headers.
           Product: Axis
           Version: current (nightly)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Basic Architecture
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: jesse_olsen@hp.com


SUMMARY: org.apache.axis.client.Call.invoke() not adding headers.

AXIS VERSION: beta2 and current (nightly)
JDK VERSION:  java full version "JDK-1.3.0_01-WebGain-003"
HOW TO REPRODUCE: insert headers into a message, then call invoke()--
 the headers do not get added to the request Envelope (reqEnv)
 like it does when called via the other invoke methods
 (the methods that get passed parameters). 
TESTCASE: //something like...

        Message msg = new Message 
             ("<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/
\">" +  
                               "<S:Body></S:Body>" +
                                "</S:Envelope>",
                                false); 

        SOAPHeader soapHeader = new SOAPHeader();
        soapHeader.addChild(...);
                .
                .
                .
        call = new Call(url);	//url = URL for some server to call...
        call.setRequestMessage(msg);
        call.addHeader(soapHeader);
        call.invoke();	// the server will not get the header...
        MessageContext ctx = call.getMessageContext();
        respMsg = ctx.getResponseMessage();        

DETAILS:

In org.apache.axis.client.Call there are several invoke
methods.  They each add headers with code similar to the
following, or by calling another invoke which has code
similar to the following:

    //taken from...
    //public Object invoke( RPCElement body ) throws AxisFault {

        // If we have headers to insert, do so now.
        if (myHeaders != null) {
            for (int i = 0; i < myHeaders.size(); i++) {
                reqEnv.addHeader((SOAPHeaderElement)myHeaders.get(i));
            }
        }

...except for invoke() with no parameters.  It is missing this code,
but is called by other invoke methods, so that the other methods
insert the headers, but calls to invoke() (with no paramters) does not.

SOLUTION: A solution would be to insert the missing code as
mentioned above, BUT the code IS in the other invokes.  It
looks like this problem could be resolved with a little
refactoring, so that all the invokes call the code, the
"addHeaders" code would be called only once, and the code could
probably be in a seperate method, so it only exists
in one place.

The invoke methods:
    public Object invoke(QName operationName, Object[] params)
    public Object invoke(Object[] params) throws java.rmi.RemoteException {
    public void invokeOneWay(Object[] params) {
        invoke( getParamList(params) );
    public Object invoke(String namespace, String method, Object[] args)
        Object ret = invoke( body );

    public Object invoke( String method, Object [] args ) throws AxisFault
        return invoke("", method, args);
    public Object invoke( RPCElement body ) throws AxisFault {

        // If we have headers to insert, do so now.
        if (myHeaders != null) {
            for (int i = 0; i < myHeaders.size(); i++) {
                reqEnv.addHeader((SOAPHeaderElement)myHeaders.get(i));
            }
        }
        invoke();

    public void invoke() throws AxisFault {
	  // MISSING reqEnv.addHeader code!!!