Hi Willem,
on the cxf endpoint we use http as transport.

We're working in POJO mode so we're following
http://camel.apache.org/cxf.html paragraph "How to prepare the message
for the camel-cxf endpoint in POJO data format": so we're
  - creating an object of type SingleMms (that's the param type
required by the operation),
  - populate it,
  - marshal it and
  - put it onto the params list that's used to initialize the message
body (I've added a sample in my original message).

We've tried also by adding / removing our 'callerIdentity' cxf header
from the exchange to see if that made any difference, but it didn't.

Thanks

Max

2009/12/8 Willem Jiang <[email protected]>:
> Do you use jms transport on the CXF endpoint?
> I fixed an error (with the same error message) of camel-cxf recently, which
> was caused by the CXF jms transport can't deal with exception message
> rightly.
>
> If not, can you tell me what kind of message do you send to CXF client ?
>
> Willem
>
> Max Ferrari wrote:
>>
>> Hi list,
>> I have managed to reproduce on SMIX 4.0.0 vanilla (camel 1.6.0 and cxf
>> 2.1.4) an issue that we are experiencing also on Fuse ESB 4.1.
>>
>> In one of our bundles we have defined a CXF client with datamode set
>> to POJO and MTOM enabled.
>>
>> Our customer's WSDL (see below) has an implicit header for
>> authentication (the header is defined in the wsdl:binding section but
>> not in the wsdl:portType).
>> We use the maven cxf-codegen-plugin to execute wsdl2java to generate
>> client sources.
>>
>> The problem arises when - from one of our routes - we generate a
>> message and send it to the cxf client bean; before it even reaches the
>> server we get the following exception and then the exchange is routed
>> to the dead letter queue:
>>
>> 11:52:24,685 | WARN | nerContainer-973 | PhaseInterceptorChain |
>> org.apache.cxf.endpoint.ClientImpl 471 | Interceptor has thrown
>> exception, unwinding now
>> org.apache.cxf.interceptor.Fault: Index: 1, Size: 1
>> at
>> org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:119)
>> ...
>> Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
>> at java.util.ArrayList.RangeCheck(ArrayList.java:547)
>> at java.util.ArrayList.get(ArrayList.java:322)
>> at
>> com.intersec.schema.mcms._3.SingleMms_WrapperTypeHelper1.createWrapperObject(Unknown
>> Source)
>> at
>> org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:103)
>> ... 39 more
>>
>> Of course the com.intersec package has to do with the cxf-generated client
>> code.
>>
>> Now, I've dug a bit but the only relevant result I could find is a cxf
>> issue with out-of-band headers that was fixed in cxf 2.0.3:
>> https://issues.apache.org/jira/browse/CXF-1129
>>
>> Not sure if what I'm seeing in our route is our mistake, a new issue
>> with cxf or a regression, however I've tried with the workaround
>> suggested in that cxf Jira entry (running the wsdl2java with '-exsh
>> true'), unfortunately with no results (we get the same error).
>>
>> Any pointers anyone?
>>
>> Relevant excerpts of our source code:
>>
>> //
>> -----------------------------------------------------------------------CXF
>> client definition
>>
>> <cxf:cxfEndpoint
>> id="cxfClientMTOM"
>> serviceClass="com.intersec.schema.mcms._3.MCMSPortType"
>> address="${cxfclient.serviceURI}">
>> <cxf:inInterceptors>
>> <ref bean="logInbound"/>
>> </cxf:inInterceptors>
>> <cxf:outInterceptors>
>> <ref bean="logOutbound"/>
>> <!-- <ref bean="JonasWSSOutInterceptor"/>-->
>> </cxf:outInterceptors>
>> <cxf:properties>
>> <entry key="dataFormat" value="POJO" />
>> <entry key="mtom-enabled" value="true" />
>> </cxf:properties>
>> </cxf:cxfEndpoint>
>>
>> // -----------------------------------------------------------------------
>> sample WSDL
>>
>> <?xml version="1.0"?>
>>
>> <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/";
>>  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>>  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
>>  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
>>  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>>  xmlns:tns="http://schema.intersec.com/mcms/3";
>>  targetNamespace="http://schema.intersec.com/mcms/3";
>>  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
>>  xmlns:xmime="http://www.w3.org/2005/05/xmlmime";
>>  xmlns:apachesoap="http://xml.apache.org/xml-soap";
>>  >
>>  <wsdl:types>
>>    <xsd:schema targetNamespace="http://schema.intersec.com/mcms/3";>
>>      <xsd:import namespace="http://www.w3.org/2005/05/xmlmime";
>>        schemaLocation="xmime.xsd" />
>>      <xsd:complexType name="attachmentArray">
>>        <xsd:sequence>
>>          <xsd:element name="attachment" type="tns:attachment"
>> minOccurs="0" maxOccurs="unbounded" />
>>        </xsd:sequence>
>>      </xsd:complexType>
>>      <xsd:complexType name="attachment">
>>        <xsd:sequence>
>>          <xsd:element minOccurs="0" name="fileName" type="xsd:string" />
>>          <xsd:element minOccurs="0" name="binaryData"
>> type="xmime:base64Binary" />
>>        </xsd:sequence>
>>      </xsd:complexType>
>>
>>      <xsd:element name="singleMms">
>>        <xsd:complexType>
>>          <xsd:sequence>
>>            <xsd:element name="oadc"               type="xsd:string"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="msisdn_to"          type="xsd:string"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="subject"            type="xsd:string"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="smil"
>> type="xmime:base64Binary" xmime:expectedContentTypes="text/xml"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="attachments"
>> type="tns:attachmentArray" minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="allow_adaptations"  type="xsd:boolean"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="message_priority"   type="xsd:int"
>> minOccurs="1" maxOccurs="1"/>
>>            <xsd:element name="message_expiration" type="xsd:int"
>> minOccurs="1" maxOccurs="1"/>
>>          </xsd:sequence>
>>        </xsd:complexType>
>>      </xsd:element>
>>      <xsd:element name="singleMmsResponse">
>>        <xsd:complexType>
>>          <xsd:sequence>
>>            <xsd:element name="singleMmsReturn" type="xsd:boolean"/>
>>          </xsd:sequence>
>>        </xsd:complexType>
>>      </xsd:element>
>>      <xsd:element name="callerIdentity">
>>        <xsd:complexType>
>>          <xsd:sequence>
>>            <xsd:element name="login" type="xsd:string" minOccurs="1"
>> maxOccurs="1" />
>>            <xsd:element name="password" type="xsd:string"
>> minOccurs="1" maxOccurs="1" />
>>          </xsd:sequence>
>>        </xsd:complexType>
>>      </xsd:element>
>>    </xsd:schema>
>>  </wsdl:types>
>>  <wsdl:message name="identityHeader">
>>    <wsdl:part name="request_header" element="tns:callerIdentity"/>
>>  </wsdl:message>
>>  <wsdl:message name="singleMmsRequest">
>>    <wsdl:part name="parameters" element="tns:singleMms"/>
>>  </wsdl:message>
>>  <wsdl:message name="singleMmsResponse">
>>    <wsdl:part name="parameters" element="tns:singleMmsResponse"/>
>>  </wsdl:message>
>>  <wsdl:portType name="MCMSPortType">
>>    <wsdl:operation name="singleMms">
>>      <wsdl:input message="tns:singleMmsRequest" />
>>      <wsdl:output  message="tns:singleMmsResponse" />
>>    </wsdl:operation>
>>  </wsdl:portType>
>>  <wsdl:binding name="MCMSBinding" type="tns:MCMSPortType">
>>    <soap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http"/>
>>    <wsdl:operation name="singleMms">
>>      <soap:operation soapAction="" />
>>      <wsdl:input>
>>        <soap:header use="literal" part="request_header"
>> message="tns:identityHeader" />
>>        <soap:body use="literal" />
>>      </wsdl:input>
>>      <wsdl:output>
>>        <soap:body use="literal" />
>>      </wsdl:output>
>>    </wsdl:operation>
>>  </wsdl:binding>
>>  <wsdl:service name="MCMS">
>>    <wsdl:port name="MCMSPort" binding="tns:MCMSBinding">
>>      <soap:address location="http://localhost:8000/soap/"/>
>>    </wsdl:port>
>>  </wsdl:service>
>> </wsdl:definitions>
>>
>>
>>
>> //
>> -----------------------------------------------------------------------Sample
>> route code
>>
>> [...]
>>
>> .process(new Processor() {
>>
>> @Override
>> public void process(Exchange x) throws Exception {
>>
>> SingleMms soapSingleMMS = new SingleMms();
>> // ... populate the mms fields ...
>>
>> List<String> params = new LinkedList<String>();
>> JAXBContext mcmsJC =
>> JAXBContext.newInstance("com.intersec.schema.mcms._3");
>> Marshaller ma = mcmsJC.createMarshaller();
>> StringWriter mcmsWriter = new StringWriter();
>> ma.marshal(soapSingleMMS, mcmsWriter);
>>
>> // set in request
>> params.add(mcmsWriter.toString());
>> Map<String, Object> requestContext = new HashMap<String, Object>();
>> requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
>> "http://localhost:9080";);
>>
>> // create & add caller identity header
>> CallerIdentity identity = new CallerIdentity();
>> identity.setLogin("dummy");
>> identity.setPassword("dummy");
>> List<Header> headers = new ArrayList<Header>();
>>
>> Header identityHeader = new Header(new
>> QName("com.intersec.schema.mcms._3", "callerIdentity"), identity, new
>> JAXBDataBinding(CallerIdentity.class));
>> headers.add(identityHeader);
>> x.getOut().setHeader(Header.HEADER_LIST, headers);
>> x.getOut().setBody(params);
>> x.getOut().setHeader(Client.REQUEST_CONTEXT , requestContext);
>> x.getOut().setHeader(CxfConstants.OPERATION_NAME, "singleMms");
>>
>> }
>> })
>>
>> // web service request
>> .to("cxf:bean:" + getCxfEndpointId())
>>
>> [...]
>>
>>
>> --
>> Max
>>
>
>

Reply via email to