[ 
http://issues.apache.org/jira/browse/AXIS2-767?page=comments#action_12442127 ] 
            
Michele Mazzucco commented on AXIS2-767:
----------------------------------------


   [[ Old comment, sent by email on Tue, 30 May 2006 10:25:13 +0100 ]]

Hi Deepal,

I'm sorry, I updated from RC4 to version 1.0, but I can't still see any
result when the addStringHeader() method is called (please note,
however, that it is called in the service side, not by the client),
while the addHeader() call seems to work fine. My clients are
testEchoNonBlockingDualClient and testEchoBlockingDualClient.


Service code.

public void echo (OMElement incomingPayload) throws XMLStreamException {
                
                incomingPayload.build();
                incomingPayload.detach();               
                
                OMElement outgoingPayload = incomingPayload;
                
                Options oldOptions = inMsgCtx.getOptions();
                
                String messageID = inMsgCtx.getMessageID();
                EndpointReference targetEPR = oldOptions.getReplyTo();
                String action = oldOptions.getAction();
                
                sendResult(messageID, targetEPR, action, outgoingPayload);
        }

private void sendResult(String messageId, EndpointReference targetEPR,
                        String action, OMElement payload) {
                
                ServiceClient sender = null;
                try {
                        Options options = new Options();
                        options.setTo(targetEPR);
                        options.setFrom(targetEPR);
                        
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                        options.setUseSeparateListener(false);
                        options.setAction(action);
                        
                        String uuid = UUIDGenerator.getUUID();
                        log.info(" >>> uuid: " + uuid);                 
                        options.setMessageId(uuid);
                        
                        options.setRelationships(new RelatesTo[] {
                                        new RelatesTo(messageId,
                                        AddressingConstants.Submission.
                WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE)});
                        
        ConfigurationContext confCtx = 
ListenerManager.defaultConfigurationContext;
                        
                        sender = new ServiceClient(confCtx, null);
                        
                        sender.addStringHeader(new QName("second_qname"), 
"Second Header text");
//                      sender.addHeader(getHeader());  <-- works fine
                        

                        sender.setOptions(options);
                        
                        // Blocking Invocation
                        sender.fireAndForget(payload);
                        
                        log.info("Reply sent"); <---- You can see this but if 
you use tcpmon
you don't see anything on the wire (if you call the addStringHeader()
method)


                } catch (AxisFault axisFault) {
                        axisFault.printStackTrace();
                } catch (Exception ex) {
                        ex.printStackTrace();
                } finally {
                        try {
                                sender.finalizeInvoke();
                        } catch (AxisFault axisFault) {
                                // have to ignore this
                                axisFault.printStackTrace();
                        }
                }
        }


private OMElement getHeader() {
//        OMNamespace omNs1 = fac.createOMNamespace(
//                "http://example1.org/example1";, "example header");
        OMElement method = fac.createOMElement("header", omNs);
//        OMElement value = fac.createOMElement("Header Text", omNs);
        method.addChild(fac.createOMText("Header value "));
//        method.addChild(value);

        return method;
        }


Best regards,
Michele



> ServiceClient.addStringHeader()
> -------------------------------
>
>                 Key: AXIS2-767
>                 URL: http://issues.apache.org/jira/browse/AXIS2-767
>             Project: Apache Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Windows XP SP2, Java Sun JDK 1.5.0_03, ant 1.6.5
>            Reporter: Michele Mazzucco
>         Assigned To: Deepal Jayasinghe
>            Priority: Critical
>
> The calls ServiceClient.addStringHeader() and ServiceClient.addHeader() cause 
> the message to be not received.
> Using tcpmon and the MyService sample (provided with Axis2) you get:
> 1) no headers added:
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Set-Cookie: JSESSIONID=CF2A6A3A366706087FBBD8818E91A62C; Path=/axis2
> Content-Type: multipart/related;
> boundary=MIMEBoundaryurn_uuid_1CAAD3F62EB8F21F2011478815557861;
> type="application/xop+xml";
> start="<0.urn:uuid:[EMAIL PROTECTED]>";
> start-info="text/xml";charset=UTF-8
> Transfer-Encoding: chunked
> Date: Wed, 17 May 2006 15:59:15 GMT
> 23e
> --MIMEBoundaryurn_uuid_1CAAD3F62EB8F21F2011478815557861
> content-type:application/xop+xml; charset=UTF-8; type="text/xml";
> content-transfer-encoding:binary
> content-id:<0.urn:uuid:[EMAIL PROTECTED]>
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header
> /><soapenv:Body><example1:echo
> xmlns:example1="http://example1.org/example1";
> xmlns:tns="http://ws.apache.org/axis2";><example1:Text>Axis2 Echo String
> </example1:Text></example1:echo></soapenv:Body></soapenv:Envelope>
> 3b
> --MIMEBoundaryurn_uuid_1CAAD3F62EB8F21F2011478815557861--
> 0
> 2) sender.addHeader(OMElement), where the OMElement is very similar to
> the object returned by ClientUtil.getEchoElement():
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=utf-8
> Content-Length: 2118
> Date: Wed, 17 May 2006 16:01:31 GMT
> Connection: close
> <html><head><title>Apache Tomcat/5.5.15 - Error
> report</title><style><!--H1
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
> H2
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
> H3
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
> BODY
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
> B
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
> P
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
> </head><body><h1>HTTP Status 500 - </h1><HR size="1"
> noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b>
> <u></u></p><p><b>description</b> <u>The server encountered an internal
> error () that prevented it from fulfilling this
> request.</u></p><p><b>exception</b>
> <pre>org.apache.axiom.om.OMException:
> com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character
> '&gt;' (code 62) expected '='
>  at [row,col {unknown-source}]: [1,226]
>       
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:207)
>       
> org.apache.axiom.om.impl.llom.OMElementImpl.getNextOMSibling(OMElementImpl.java:263)
>       
> org.apache.axiom.om.impl.traverse.OMChildrenQNameIterator.next(OMChildrenQNameIterator.java:101)
>       
> org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:223)
>       
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.getHeader(SOAPEnvelopeImpl.java:76)
>       
> org.apache.axis2.engine.AxisEngine.createFaultMessageContext(AxisEngine.java:194)
>       
> org.apache.axis2.transport.http.AxisServlet.handleFault(AxisServlet.java:168)
>       org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:153)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> </pre></p><p><b>note</b> <u>The full stack trace of the root cause is
> available in the Apache Tomcat/5.5.15 logs.</u></p><HR size="1"
> noshade="noshade"><h3>Apache Tomcat/5.5.15</h3></body></html>
> 3) sender.addStringHeader(new QName("qname"), "Header text"):
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: text/html;charset=utf-8
> Content-Length: 1857
> Date: Wed, 17 May 2006 16:06:42 GMT
> Connection: close
> <html><head><title>Apache Tomcat/5.5.15 - Error
> report</title><style><!--H1
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
> H2
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}
> H3
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}
> BODY
> {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
> B
> {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}
> P
> {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A
> {color : black;}A.name {color : black;}HR {color : #525D76;}--></style>
> </head><body><h1>HTTP Status 500 - </h1><HR size="1"
> noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b>
> <u></u></p><p><b>description</b> <u>The server encountered an internal
> error () that prevented it from fulfilling this
> request.</u></p><p><b>exception</b> <pre>java.lang.NullPointerException
>       
> org.apache.axiom.soap.impl.llom.SOAPHeaderImpl.getHeaderBlocksWithNSURI(SOAPHeaderImpl.java:217)
>       
> org.apache.axis2.handlers.addressing.AddressingInHandler.invoke(AddressingInHandler.java:64)
>       org.apache.axis2.engine.Phase.invoke(Phase.java:378)
>       org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:492)
>       org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:462)
>       
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:283)
>       org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:137)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> </pre></p><p><b>note</b> <u>The full stack trace of the root cause is
> available in the Apache Tomcat/5.5.15 logs.</u></p><HR size="1"
> noshade="noshade"><h3>Apache Tomcat/5.5.15</h3></body></html>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to