Message Headers handling bug
----------------------------
Key: XFIRE-988
URL: http://jira.codehaus.org/browse/XFIRE-988
Project: XFire
Issue Type: Bug
Components: Core
Affects Versions: 1.2.6, 1.2.5
Environment: Windows XP Pro Sp2, jdk 1.5, weblogic 8.1 sp3,
jakarta-tomcat-5.0.28, jboss 4.04
Reporter: Jorge Perez
Assignee: Dan Diephouse
Priority: Critical
http://pastie.caboo.se/60568
There is a bug when filing the headers:
I have a wsdl file which includes header params here is part of it:
.
.
.
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://operation.org/1.1/Listener.Wsdl">
<s:element name="Request" type="s:string" />
<s:element name="Response" type="s:string" />
</s:schema>
.
.
.
<s:complexType name="myHeader">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="action" type="s:string"
/>
</s:sequence>
</s:complexType>
.
.
.
<wsdl:message name="myOperationHeader">
<wsdl:part name="myHeader" element="s2:myHeader" />
</wsdl:message>
<wsdl:message name="myOperationSoapIn">
<wsdl:part name="Request" element="tns:Request" />
</wsdl:message>
<wsdl:message name="myOperationSoapOut">
<wsdl:part name="myOperationResult" element="tns:Response" />
</wsdl:message>
.
.
.
<wsdl:portType name="MyOperationSoap">
<wsdl:operation name="myOperation">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/">operation
message</documentation>
<wsdl:input message="tns:myOperationSoapIn" />
<wsdl:output message="tns:myOperationSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyOperationSoap" type="tns:MyOperationSoap">
<wsdl:operation name="myOperation">
<soap:operation
soapAction="http://operation.org/1.1/Listener.Wsdl#myOperation"
style="document" />
<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:myOperationHeader" part="myHeader"
use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:myOperationHeader" part="myHeader"
use="literal" />
</wsdl:output>
</wsdl:operation>
.
.
.
Part of my service.xml file:
.
.
.
<implementationClass>
org.some.where.OperationListenerImpl
</implementationClass>
<serviceFactory>
org.codehaus.xfire.jaxb2.JaxbServiceFactory
</serviceFactory>
<style>document</style>
<use>literal</use>
<scope>application</scope>
.
.
.
And my OperationListenerImpl:
.
.
.
public String myOperation(String Request,
org.operation._1_1.header.MyHeader myHeader,
Holder<org.operation._1_1.header.MyHeader> myHeader2) {
.
.
.
}
When I called myOperation from a client it causes this error trace:
20:50:11,364 [ERROR] xfire: 35 - Fault occurred!
java.lang.ArrayIndexOutOfBoundsException
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.readHeaders(Lorg.codehaus.xfire.MessageContext;Lorg.codehaus.xfire.service.MessagePartContainer;[Ljava.lang.Object;)Ljava.lang.Object;(ServiceInvocationHandler.java:195)
at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(Lorg.codehaus.xfire.MessageContext;)V(ServiceInvocationHandler.java:76)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(Lorg.codehaus.xfire.MessageContext;)V(HandlerPipeline.java:131)
at
org.codehaus.xfire.transport.DefaultEndpoint.onReceive(Lorg.codehaus.xfire.MessageContext;Lorg.codehaus.xfire.exchange.InMessage;)V(DefaultEndpoint.java:64)
at
org.codehaus.xfire.transport.AbstractChannel.receive(Lorg.codehaus.xfire.MessageContext;Lorg.codehaus.xfire.exchange.InMessage;)V(AbstractChannel.java:38)
at
org.codehaus.xfire.transport.http.XFireServletController.invoke(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;Ljava.lang.String;)V(XFireServletController.java:304)
at
org.codehaus.xfire.transport.http.XFireServletController.doService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(XFireServletController.java:129)
at
org.codehaus.xfire.transport.http.XFireServlet.doPost(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(XFireServlet.java:116)
at
javax.servlet.http.HttpServlet.service(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(ServletStubImpl.java:996)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(ServletStubImpl.java:419)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(ServletStubImpl.java:315)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(AuthenticatedSubject.java:321)
at
weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
at
weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
at
weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown
Source)
Then In the ServiceInvocationHandler class I noticed how the total was
calculated and found that outHeaderMsg.size() was
ignored so I added it to the calculation of total:
org.codehaus.xfire.service.binding.ServiceInvocationHandler.fillInHolders(MessageContext
context,
OperationInfo opInfo,
MessageInfo inMsg,
MessageInfo outMsg,
MessagePartContainer headerMsg,
MessagePartContainer outHeaderMsg,
List params) throws XFireFault
.
.
.
// int total = inMsg.size() + headersNumber + outSize;
int total = inMsg.size() + headersNumber + outSize + outHeaderMsg.size();
.
.
.
So when outHeaderMsg was added then it did not caused the error
ArrayIndexOutOfBoundException when trying:
for (int i = 0; i < parts.size(); i++)
{
MessagePartInfo part = (MessagePartInfo) parts.get(i);
newParams[part.getIndex()] = params.get(i);
}
After that modification I was able to receive all values from the header but
I'am not sure if this complete solves the issue of handling headers correctly.
But it's quite sure there is a bug here.
By the moment I'm only concentrated in working with the 2 firts params of my
method...
String Request and org.operation._1_1.header.MyHeader myHeader
but I don't know if later I will be able to work with the param:
Holder<org.operation._1_1.header.MyHeader> myHeader2
successfully.
Regards..
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email