But the problem is that if it's optional, CXF shouldn't fail if it's not
there, but it does.  And if it's going to fail, it should fail with a
cleaner error than an IndexOutOfBoundsException.

On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote:
>
> Gamble, Wesley (WG10) wrote:
> > Ryan,
> >
> > "All I
> > get currently is an IndexOutOfBoundsException when CXF tries to create
> > the
> > header of the SOAP message to send,"
> >
> > sounds suspiciously like my problem (thread: "Can't get at SOAP error
> > from Web service...").  I'm getting an index out of bounds exception as
> > well on the header processing.
> >
> > What is the -exsh flag on wsdl2java supposed to do for you?  What does
> > "Enables or disables processing of extended soap header message
> > binding." mean?  How would I know the difference between a regular and
> > an extended soap header message?
> >
>
> As per the jaxws spec (2.6.2.1) The out of band soap headers are
> optional to map to a parameter,
> So in tools there's an argument "-exsh", if set to true, you will get an
> extra parameter for the header.
> And it require the soap binding, you have to put the soap binding in
> your classpath.
>
>
>
> > How do you know that "the generated client classes do NOT set the header
> > that is specified in the binding"?
> >
> > Wes
> >
> > -----Original Message-----
> > From: Ryan Moquin [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, September 11, 2007 9:36 AM
> > To: [email protected]
> > Subject: Adding headers to soap request
> >
> > 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