Ryan,

That error trace is EXACTLY the same as mine.  I just wish I knew enough
to be able to debug it further.  I don't understand your information
about dependency below though.

My email is [EMAIL PROTECTED] if you want to discuss off list.

Wes 

-----Original Message-----
From: Ryan Moquin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 11, 2007 9:57 AM
To: [email protected]
Subject: Re: Adding headers to soap request

I always make progress after I send out a message about it... I figured
out
that the confusion over the headers is because when this dependency is
missing from wsdltojava (not mentioned on the cxf website to do this),
then
it won't include your header:

<dependencies>
                 <dependency>
                   <groupId>org.apache.cxf</groupId>
                   <artifactId>cxf-rt-bindings-soap</artifactId>
                   <version>${project.version}</version>
                 </dependency>
               </dependencies>

So anyhow, I'm still stuck with my error though, so I guess that wasn't
my
problem:

Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
        at java.util.ArrayList.RangeCheck(ArrayList.java:546)
        at java.util.ArrayList.get(ArrayList.java:321)
        at org.apache.cxf.message.MessageContentsList.get(
MessageContentsList.java:76)
        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleHeaderP
art(
SoapOutInterceptor.java:179)
        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnve
lopeStart
(SoapOutInterceptor.java:124)

        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage
(
SoapOutInterceptor.java:76)
        at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage
(
SoapOutInterceptor.java:57)

On 9/11/07, Ryan Moquin <[EMAIL PROTECTED]> wrote:
>
> I'm writing this as a new message, but I'm hoping that it's answer
will
> solve my other issue I'm writing about.  I think I'm having having
trouble
> understanding how to add a header to my request using cxf.  In short,
I have
> a WSDL that defines this element:
>
> <s:element name="AuthCredentials" type="tns:AuthCredentials"/>
>       <s:complexType name="AuthCredentials">
>         <s:sequence>
>           <s:element minOccurs="0" maxOccurs="1" name="username"
> type="s:string"/>
>           <s:element minOccurs="0" maxOccurs="1" name="password"
> type="s:string"/>
>         </s:sequence>
>       </s:complexType>
>
> and then defines a binding that uses it:
>
> <wsdl:operation name="sendNotification">
>       <soap:operation
soapAction="urn://testnotification/sendNotification"
> style="document"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>         <soap:header message="tns:sendNotificationAuthCredentials"
> part="AuthCredentials" use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>
> When I run this WSDL through wsdltojava using -exsh true, the
generated
> client classes do NOT set the header that is specified in the binding,
which
> is what I thought that the -exsh is supposed to do for you.  So
basically,
> I'm trying to figure out how I would add this element to my request.
Here
> is what WSDL to java generated, how do I add the AuthCredentials
element to
> the messagingPort class so that my request will go through with it?
All I
> get currently is an IndexOutOfBoundsException when CXF tries to create
the
> header of the SOAP message to send, I'm guessing because I don't know
how to
> add the header.  I looked at the CXF examples on it, but it doesn't
look
> like the headers are being added as a header:
>
> public void sendNotification() {
>     NotificationService messagingService = null;
>     NotificationServicePort messagingPort = null;
>
>     messagingService = new NotificationService(wsdl, SERVICE_NAME);
>     messagingPort = messagingService.getNotificationServicePort();
>
>     System.out.println("Invoking sendNotification...");
>     java.lang.String _sendNotification_parametersVal = "";
>     javax.xml.ws.Holder<java.lang.String> _sendNotification_parameters
=
> new javax.xml.ws.Holder<java.lang.String
> >(_sendNotification_parametersVal);
>     messagingPort.sendNotification(_sendNotification_parameters);
>
System.out.println("sendNotification._sendNotification_parameters=" +
> _sendNotification_parameters.value);
>   }
>

Reply via email to