You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kuc1n9 <ku...@gmail.com> on 2015/06/19 08:15:34 UTC

java.lang.IndexOutOfBoundsException at org.apache.cxf.message.MessageContentsList.get(MessageContentsList.java:80)

Hi, 

 

I have a WebService Client wsdl that should allow me to PULL an XML file
with embedded PDF attachment from a WebService Server.

Below is the summary of the WSDL: 

 

                <wsdl:types>

                                <xs:schema
attributeFormDefault="unqualified"

                elementFormDefault="qualified"

                targetNamespace="http://www.sterlingcommerce.com/mesa"

                xmlns="http://www.sterlingcommerce.com/mesa"

                xmlns:tns="http://www.sterlingcommerce.com/mesa"

xmlns:ref=http://ws-i.org/profiles/basic/1.1/xsd

  xmlns:xs="http://www.w3.org/2001/XMLSchema">

 

                                                <xs:import
namespace="http://ws-i.org/profiles/basic/1.1/xsd"
schemaLocation="swaref.xsd"/>

 

                                                <xs:complexType
name="Binary">

 
<xs:simpleContent>

 
<xs:extension base="xs:base64Binary">

 
<xs:attribute name="href" type="ref:swaRef"/>

 
</xs:extension>

 
</xs:simpleContent>

                                                </xs:complexType>

                                                

                                                <xs:element
name="attachment" type="Binary"/>

                                </xs:schema>

                                <xs:schema
attributeFormDefault="unqualified"

 
elementFormDefault="qualified"

targetNamespace="http://address/jbms/msggate/reqresp/v1"

xmlns="http://customs.govt.nz/jbms/msggate/reqresp/v1"

xmlns:xs="http://www.w3.org/2001/XMLSchema">

 

                                                <xs:element
name="RequestResponseResponse">

...

                                                </xs:element>

                                                <xs:element
name="RequestResponse">

...

                                                </xs:element>

                                </xs:schema>

                </wsdl:types>

                <wsdl:message name="TSW_BP_REQUEST_RESPONSE">

                                <wsdl:part element="tns1:RequestResponse"
name="parameters"/>

                </wsdl:message>

                <wsdl:message name="TSW_BP_REQUEST_RESPONSEOutput"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

                                <wsdl:part
element="tns1:RequestResponseResponse" name="parameters"/>

                                <wsdl:part element="mesa_xsd:attachment"
name="attachment"/>

                </wsdl:message>

                <wsdl:portType name="GISPortType">

                                <wsdl:operation
name="executeTSW_BP_REQUEST_RESPONSE">

                                                <wsdl:input
message="mesa_xsd:TSW_BP_REQUEST_RESPONSE"/>

                                                <wsdl:output
message="mesa_xsd:TSW_BP_REQUEST_RESPONSEOutput"/>

                                </wsdl:operation>

                </wsdl:portType>

                <wsdl:binding name="GISBinding" type="mesa_xsd:GISPortType">

                                <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

                                <wsdl:operation
name="executeTSW_BP_REQUEST_RESPONSE">

                                                <soap:operation
soapAction="sii:TSW_BP_REQUEST_RESPONSE" style="document"/>

                                                <wsdl:input>

 
<wsp:PolicyReference URI="#X509V3SignOnly"/>

                                                                <soap:body
use="literal"/>

                                                </wsdl:input>

                                                <wsdl:output>

 
<wsp:PolicyReference URI="#X509V3SignOnly"/>

 
<mime:multipartRelated>

 
<mime:part>

 
<soap:body use="literal"/>

 
</mime:part>

 
</mime:multipartRelated>

                                                </wsdl:output>

                                </wsdl:operation>

                </wsdl:binding>

                <wsdl:service name="TSW_WS_REQUEST_LODGE_RESPONSE">

                                <wsdl:port binding="mesa_xsd:GISBinding"
name="GISPort">

                                                <soap:address
location="https://[address]/soap-new?service=TSW_WS_REQUEST_LODGE_RESPONSE&a
mp;TP=B2BE"/>

                                </wsdl:port>

                </wsdl:service>

 

And below are summary Stub Code generated by cxf: 

Binary.java

public class Binary {

    protected byte[] value;

    protected DataHandler href;

...

}

GISPortType.java

public interface SubmitLodgementPortType {

    public void executeTSWBPREQUESTRESPONSE(parameters,
javax.xml.ws.Holder<RequestResponseResponse> parameters1,
javax.xml.ws.Holder<Binary> attachment); 

}

 

Below is my main Client code: 

public class WSClient 

{

       public static void main(String[] args) 

       {

              TSWWSREQUESTLODGERESPONSE service = new
TSWWSREQUESTLODGERESPONSE();

              GISPortType port = service.getGISPort();        

try

              {

Client client = ClientProxy.getClient(proxy);

                     client.getInInterceptors().add(new
LoggingInInterceptor());

                     client.getOutInterceptors().add(new
LoggingOutInterceptor());

 

                     RequestResponse rr = new RequestResponse();

                     rr.setSubmitter("X");

 

                     Holder<RequestResponseResponse> holderrrr = new
Holder<RequestResponseResponse>();               

Holder<AttachmentList> holdera = new Holder<AttachmentList>();

                     port.executeTSWBPREQUESTRESPONSE(rr, holderrrr,
holdera);

                                }

                                catch()

}

}

 

The inbound message that I received is as below summary: 

<soapenv:Body wsu:Id="id-407836751"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurit
y-utility-1.0.xsd">

<reqresp:RequestResponseResponse>

...

</soapenv:Body>

</soapenv:Envelope>

--ewdcl-jbgw01.x-3419057b14e08b381872ea6-multipart-boundary-string

content-id: 51358611G_52778309.xml

content-type: text/xml

 

<DocumentMetadata xmlns='urn:wco:datamodel:WCO:DM:1'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>

...

</DocumentMetadata>

 

--ewdcl-jbgw01.x-3419057b14e08b381872ea6-multipart-boundary-string

content-id: IM1_Delivery_Order-52778309-2015-06-16-172917318.pdf

content-type: application/pdf

 

%PDF-1.4

[Binary PDF content]

 

The problems start here, I'm getting below error message: 

Jun 19, 2015 3:16:15 PM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging

WARNING: Interceptor for
{http://www.sterlingcommerce.com/mesa}TSW_WS_REQUEST_LODGE_RESPONSE#{http://
www.sterlingcommerce.com/mesa}executeTSW_BP_REQUEST_RESPONSE has thrown
exception, unwinding now

java.lang.IndexOutOfBoundsException: Index: 3, Size: 3

at java.util.ArrayList.rangeCheck(ArrayList.java:635)

at java.util.ArrayList.get(ArrayList.java:411)

at
org.apache.cxf.message.MessageContentsList.get(MessageContentsList.java:80)

at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderIn
Interceptor.java:69)

at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:308)

at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:798)

at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse
Internal(HTTPConduit.java:1641)

at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse
(HTTPConduit.java:1532)

at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPCond
uit.java:1330)

at
org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStr
eam.java:56)

at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:215)

at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)

at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:652)

at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInter
ceptor.handleMessage(MessageSenderInterceptor.java:62)

at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:308)

at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)

at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)

at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)

at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)

at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)

at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)

at com.sun.proxy.$Proxy39.executeTSWBPREQUESTRESPONSE(Unknown Source)

at WSClient.main(WSClient.java:63)

 

This only happen when receiving XML with embedded attachment. It seems to me
the embedded attachment treated as 2nd attachment. 

Just wondering if anyone have work around for this ? All the attachment
suppose to be store in 1 Binary holder... 

 

I'm using maven 3.3.3 and cxf 3.1.1

              <cxf.version>3.1.1</cxf.version>

              <maven.jar.version>2.6</maven.jar.version>

              <maven.bundle.version>2.5.4</maven.bundle.version>

              <maven.compiler.version>3.3</maven.compiler.version>

              <maven.dependency.version>2.10</maven.dependency.version>

              <maven.eclipse.version>2.9</maven.eclipse.version>

              <maven.resources.version>2.7</maven.resources.version>

              <exec.maven.version>1.4.0</exec.maven.version>

              <jaxb-xjc.version>2.2.11</jaxb-xjc.version>

              <spring-context.version>4.1.6.RELEASE</spring-context.version>

              <common-io.version>2.4</common-io.version>

              <woodstox-core-asl.version>4.4.1</woodstox-core-asl.version>

              <commons.lang3.version>3.4</commons.lang3.version>

              <client.mainClass>WSClient</client.mainClass>

              <java.version>1.7</java.version>

 

 

 

Kind Regards, 

Ivanto