Re: Adding headers to soap request?
Cheers Dan - your a star :-) On 11 Apr 2008, at 17:12, Daniel Kulp wrote: OK. I'm sick of answering this. :-) Added to the FAQ: http://cwiki.apache.org/confluence/display/CXF/FAQ#FAQ-HowcanIaddsoapheaderstotherequest%2Fresponse%3F Dan
Re: Adding headers to soap request?
OK. I'm sick of answering this. :-) Added to the FAQ: http://cwiki.apache.org/confluence/display/CXF/FAQ#FAQ-HowcanIaddsoapheaderstotherequest%2Fresponse%3F Dan On Friday 11 April 2008, Tim Perrett wrote: > Hey chaps, > > Is there a way to add headers to the soap request inside the CXF > service class? (or any other way) > > Cheers, Tim -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
Adding headers to soap request?
Hey chaps, Is there a way to add headers to the soap request inside the CXF service class? (or any other way) Cheers, Tim
Re: Adding headers to soap request
Hi Wes, Sorry, I didn't express myself correctly, I mean the cxf soap binding jar, the command line tools is ok, it included all the cxf jars. when you run the wsdl2java in a maven plugin, you have to put the cxf soap binding jar into your classpath, otherwise wsdl2java will not generate the extra soap header as a parameter even if you specify the 'exsh' argument Regards, James James, Thanks for your response. Where can I find an example of the correct SOAP binding for one of these extended SOAP header messages? Wes -Original Message- From: James Mao [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 11, 2007 9:22 PM To: cxf-user@incubator.apache.org Subject: Re: Adding headers to soap request Gamble, Wesley (WG10) wrote: 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.
Re: Adding headers to soap request
Ok, the bug is submitted with the problematic WSDL attached. CXF-993. Back to staring at my SSL problem and hoping it will somehow fix itself. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > Great, That's definitely helpful. > > Thanks Ryan, > > James > > > > Sure, I'll see if I can somehow get my test case working that fails, > though > > maybe it doesn't fail and the bug with the interceptor that I mentioned > > earlier is causing it to fail no matter how I run wsdl2java. I'll see > if I > > can finish getting a small test case. > > > > > > On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > > >> Hi Ryan, > >> > >> > >>> I was able to get this to work now with my scaled down test wsdl, but > >>> > >> not > >> > >>> the full wsdl that I need it to work with, I'll do my best to help you > >>> > >> with > >> > >>> what I know about this. > >>> > >>> I did notice your thread that sounded familiar. Apparently if you add > >>> > >> the > >> > >>> -exsh true parameter to wsdl2java, you'll end up with an extra > parameter > >>> > >> in > >> > >>> your method signature of your port class implementation. This extra > >>> parameter is the header specified in your wsdl. If you don't add the > >>> > >> exsh, > >> > >>> you won't get the parameter and end up with an IndexOutOfBounds error > >>> because cxf is expecting the header. I'm not sure why cxf would > assume > >>> > >> you > >> > >>> are including the header if you never generated your classes to accept > >>> > >> one. > >> > >> If exsh not turned on, then there'll not generate the extra header > >> parameter, and it should not fail the runtime, > >> otherwise there's a bug in the runtime. the header parameter is > optional, > >> > >> I remember that i fixed this in both the tools and runtime, > >> but maybe there's one case that i didn't cover, so, do you mind send > >> your case (simplified) which i can reproduce, > >> If you can file a jira, that will be great. > >> > >> Regards, > >> James > >> > >> > >> > >> > >>> I know my classes weren't setting the header because when I did a find > >>> usages on my AuthCredentials class, which is put in the header, it > >>> > >> wasn't > >> > >>> used anywhere. Actually the generated client code, didn't even > actually > >>> make calls to invoke the webservice. It would just create a response > >>> > >> object > >> > >>> set to null and return it, and that was it. So the generated client > in > >>> > >> my > >> > >>> opinion was useless anyhow. > >>> > >>> On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? > >>>> > >>>> 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: cxf-user@incubator.apache.org > >>>> Subject: Adding headers
RE: Adding headers to soap request
James, Thanks for your response. Where can I find an example of the correct SOAP binding for one of these extended SOAP header messages? Wes -Original Message- From: James Mao [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 11, 2007 9:22 PM To: cxf-user@incubator.apache.org Subject: Re: Adding headers to soap request Gamble, Wesley (WG10) wrote: > 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.
Re: Adding headers to soap request
with 2.0.1, I can give you a simple wsdl that fails without the exsh option on. I'll go fill out the bug report for you real quick. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > We have not finally announce the release of 2.0.2, > The CXF 2.1 is just begin, and we will migrate the jaxws api and jaxb > versions to 2.1, > So, I would say there'll have big changes in CXF2.1, I would suggest you > stick to 2.0.2 > I hope you can get the test case done, so I can fix it for you. > > Regards, > James > > > No problem. Do you have any idea how stable 2.1 is? I notice that my > issue > > with the IndexOutOfBounds with the one Interceptor doesn't happen on 2.1but > > does on 2.0.1 (so somehow it have been fixed, directly or > indirectly). Is > > it helpful to know if it's a problem on 2.1? Is it relatively safe to > use > > 2.1 snapshots? > > > > On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > > >> Great, That's definitely helpful. > >> > >> Thanks Ryan, > >> > >> James > >> > >> > >> > >>> Sure, I'll see if I can somehow get my test case working that fails, > >>> > >> though > >> > >>> maybe it doesn't fail and the bug with the interceptor that I > mentioned > >>> earlier is causing it to fail no matter how I run wsdl2java. I'll see > >>> > >> if I > >> > >>> can finish getting a small test case. > >>> > >>> > >>> On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > >>> > >>> > >>>> Hi Ryan, > >>>> > >>>> > >>>> > >>>>> I was able to get this to work now with my scaled down test wsdl, > but > >>>>> > >>>>> > >>>> not > >>>> > >>>> > >>>>> the full wsdl that I need it to work with, I'll do my best to help > you > >>>>> > >>>>> > >>>> with > >>>> > >>>> > >>>>> what I know about this. > >>>>> > >>>>> I did notice your thread that sounded familiar. Apparently if you > add > >>>>> > >>>>> > >>>> the > >>>> > >>>> > >>>>> -exsh true parameter to wsdl2java, you'll end up with an extra > >>>>> > >> parameter > >> > >>>> in > >>>> > >>>> > >>>>> your method signature of your port class implementation. This extra > >>>>> parameter is the header specified in your wsdl. If you don't add > the > >>>>> > >>>>> > >>>> exsh, > >>>> > >>>> > >>>>> you won't get the parameter and end up with an IndexOutOfBounds > error > >>>>> because cxf is expecting the header. I'm not sure why cxf would > >>>>> > >> assume > >> > >>>> you > >>>> > >>>> > >>>>> are including the header if you never generated your classes to > accept > >>>>> > >>>>> > >>>> one. > >>>> > >>>> If exsh not turned on, then there'll not generate the extra header > >>>> parameter, and it should not fail the runtime, > >>>> otherwise there's a bug in the runtime. the header parameter is > >>>> > >> optional, > >> > >>>> I remember that i fixed this in both the tools and runtime, > >>>> but maybe there's one case that i didn't cover, so, do you mind send > >>>> your case (simplified) which i can reproduce, > >>>> If you can file a jira, that will be great. > >>>> > >>>> Regards, > >>>> James > >>>> > >>>> > >>>> > >>>> > >>>> > >>>>> I know my classes weren't setting the header because when I did a > find > >>>>> usages on my AuthCredentials class, which is put in the header, it > >>>>> > >>>>> > >>>> wasn't > >>>> > >>>> > >>>>> used anywhere. Actually the generated client code, didn't even > >
Re: Adding headers to soap request
We have not finally announce the release of 2.0.2, The CXF 2.1 is just begin, and we will migrate the jaxws api and jaxb versions to 2.1, So, I would say there'll have big changes in CXF2.1, I would suggest you stick to 2.0.2 I hope you can get the test case done, so I can fix it for you. Regards, James No problem. Do you have any idea how stable 2.1 is? I notice that my issue with the IndexOutOfBounds with the one Interceptor doesn't happen on 2.1 but does on 2.0.1 (so somehow it have been fixed, directly or indirectly). Is it helpful to know if it's a problem on 2.1? Is it relatively safe to use 2.1 snapshots? On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: Great, That's definitely helpful. Thanks Ryan, James Sure, I'll see if I can somehow get my test case working that fails, though maybe it doesn't fail and the bug with the interceptor that I mentioned earlier is causing it to fail no matter how I run wsdl2java. I'll see if I can finish getting a small test case. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: Hi Ryan, I was able to get this to work now with my scaled down test wsdl, but not the full wsdl that I need it to work with, I'll do my best to help you with what I know about this. I did notice your thread that sounded familiar. Apparently if you add the -exsh true parameter to wsdl2java, you'll end up with an extra parameter in your method signature of your port class implementation. This extra parameter is the header specified in your wsdl. If you don't add the exsh, you won't get the parameter and end up with an IndexOutOfBounds error because cxf is expecting the header. I'm not sure why cxf would assume you are including the header if you never generated your classes to accept one. If exsh not turned on, then there'll not generate the extra header parameter, and it should not fail the runtime, otherwise there's a bug in the runtime. the header parameter is optional, I remember that i fixed this in both the tools and runtime, but maybe there's one case that i didn't cover, so, do you mind send your case (simplified) which i can reproduce, If you can file a jira, that will be great. Regards, James I know my classes weren't setting the header because when I did a find usages on my AuthCredentials class, which is put in the header, it wasn't used anywhere. Actually the generated client code, didn't even actually make calls to invoke the webservice. It would just create a response object set to null and return it, and that was it. So the generated client in my opinion was useless anyhow. On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? 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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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
Re: Adding headers to soap request
Hi Ryan, We are just voting 2.0.2 in the cxf-dev, you can get staged kit from [1] [1]http://people.apache.org/~dkulp/stage_cxf/2.0.2-incubator-take1/ Willem. Ryan Moquin wrote: No problem. Do you have any idea how stable 2.1 is? I notice that my issue with the IndexOutOfBounds with the one Interceptor doesn't happen on 2.1 but does on 2.0.1 (so somehow it have been fixed, directly or indirectly). Is it helpful to know if it's a problem on 2.1? Is it relatively safe to use 2.1 snapshots? On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: Great, That's definitely helpful. Thanks Ryan, James Sure, I'll see if I can somehow get my test case working that fails, though maybe it doesn't fail and the bug with the interceptor that I mentioned earlier is causing it to fail no matter how I run wsdl2java. I'll see if I can finish getting a small test case. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: Hi Ryan, I was able to get this to work now with my scaled down test wsdl, but not the full wsdl that I need it to work with, I'll do my best to help you with what I know about this. I did notice your thread that sounded familiar. Apparently if you add the -exsh true parameter to wsdl2java, you'll end up with an extra parameter in your method signature of your port class implementation. This extra parameter is the header specified in your wsdl. If you don't add the exsh, you won't get the parameter and end up with an IndexOutOfBounds error because cxf is expecting the header. I'm not sure why cxf would assume you are including the header if you never generated your classes to accept one. If exsh not turned on, then there'll not generate the extra header parameter, and it should not fail the runtime, otherwise there's a bug in the runtime. the header parameter is optional, I remember that i fixed this in both the tools and runtime, but maybe there's one case that i didn't cover, so, do you mind send your case (simplified) which i can reproduce, If you can file a jira, that will be great. Regards, James I know my classes weren't setting the header because when I did a find usages on my AuthCredentials class, which is put in the header, it wasn't used anywhere. Actually the generated client code, didn't even actually make calls to invoke the webservice. It would just create a response object set to null and return it, and that was it. So the generated client in my opinion was useless anyhow. On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? 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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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?
Re: Adding headers to soap request
No problem. Do you have any idea how stable 2.1 is? I notice that my issue with the IndexOutOfBounds with the one Interceptor doesn't happen on 2.1 but does on 2.0.1 (so somehow it have been fixed, directly or indirectly). Is it helpful to know if it's a problem on 2.1? Is it relatively safe to use 2.1 snapshots? On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > Great, That's definitely helpful. > > Thanks Ryan, > > James > > > > Sure, I'll see if I can somehow get my test case working that fails, > though > > maybe it doesn't fail and the bug with the interceptor that I mentioned > > earlier is causing it to fail no matter how I run wsdl2java. I'll see > if I > > can finish getting a small test case. > > > > > > On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > > >> Hi Ryan, > >> > >> > >>> I was able to get this to work now with my scaled down test wsdl, but > >>> > >> not > >> > >>> the full wsdl that I need it to work with, I'll do my best to help you > >>> > >> with > >> > >>> what I know about this. > >>> > >>> I did notice your thread that sounded familiar. Apparently if you add > >>> > >> the > >> > >>> -exsh true parameter to wsdl2java, you'll end up with an extra > parameter > >>> > >> in > >> > >>> your method signature of your port class implementation. This extra > >>> parameter is the header specified in your wsdl. If you don't add the > >>> > >> exsh, > >> > >>> you won't get the parameter and end up with an IndexOutOfBounds error > >>> because cxf is expecting the header. I'm not sure why cxf would > assume > >>> > >> you > >> > >>> are including the header if you never generated your classes to accept > >>> > >> one. > >> > >> If exsh not turned on, then there'll not generate the extra header > >> parameter, and it should not fail the runtime, > >> otherwise there's a bug in the runtime. the header parameter is > optional, > >> > >> I remember that i fixed this in both the tools and runtime, > >> but maybe there's one case that i didn't cover, so, do you mind send > >> your case (simplified) which i can reproduce, > >> If you can file a jira, that will be great. > >> > >> Regards, > >> James > >> > >> > >> > >> > >>> I know my classes weren't setting the header because when I did a find > >>> usages on my AuthCredentials class, which is put in the header, it > >>> > >> wasn't > >> > >>> used anywhere. Actually the generated client code, didn't even > actually > >>> make calls to invoke the webservice. It would just create a response > >>> > >> object > >> > >>> set to null and return it, and that was it. So the generated client > in > >>> > >> my > >> > >>> opinion was useless anyhow. > >>> > >>> On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? > >>>> > >>>> 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:[
Re: Adding headers to soap request
Great, That's definitely helpful. Thanks Ryan, James Sure, I'll see if I can somehow get my test case working that fails, though maybe it doesn't fail and the bug with the interceptor that I mentioned earlier is causing it to fail no matter how I run wsdl2java. I'll see if I can finish getting a small test case. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: Hi Ryan, I was able to get this to work now with my scaled down test wsdl, but not the full wsdl that I need it to work with, I'll do my best to help you with what I know about this. I did notice your thread that sounded familiar. Apparently if you add the -exsh true parameter to wsdl2java, you'll end up with an extra parameter in your method signature of your port class implementation. This extra parameter is the header specified in your wsdl. If you don't add the exsh, you won't get the parameter and end up with an IndexOutOfBounds error because cxf is expecting the header. I'm not sure why cxf would assume you are including the header if you never generated your classes to accept one. If exsh not turned on, then there'll not generate the extra header parameter, and it should not fail the runtime, otherwise there's a bug in the runtime. the header parameter is optional, I remember that i fixed this in both the tools and runtime, but maybe there's one case that i didn't cover, so, do you mind send your case (simplified) which i can reproduce, If you can file a jira, that will be great. Regards, James I know my classes weren't setting the header because when I did a find usages on my AuthCredentials class, which is put in the header, it wasn't used anywhere. Actually the generated client code, didn't even actually make calls to invoke the webservice. It would just create a response object set to null and return it, and that was it. So the generated client in my opinion was useless anyhow. On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? 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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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 _sendNotification_parameters = new javax.xml.ws.Holder(_sendNotification_parametersVal); messagingPort.sendNotification(_sendNotification_parameters); System.out.println("sendNotification._sendNotification_parameters=" + _sendNotification_parameters.value); }
Re: Adding headers to soap request
Sure, I'll see if I can somehow get my test case working that fails, though maybe it doesn't fail and the bug with the interceptor that I mentioned earlier is causing it to fail no matter how I run wsdl2java. I'll see if I can finish getting a small test case. On 9/11/07, James Mao <[EMAIL PROTECTED]> wrote: > > Hi Ryan, > > > I was able to get this to work now with my scaled down test wsdl, but > not > > the full wsdl that I need it to work with, I'll do my best to help you > with > > what I know about this. > > > > I did notice your thread that sounded familiar. Apparently if you add > the > > -exsh true parameter to wsdl2java, you'll end up with an extra parameter > in > > your method signature of your port class implementation. This extra > > parameter is the header specified in your wsdl. If you don't add the > exsh, > > you won't get the parameter and end up with an IndexOutOfBounds error > > because cxf is expecting the header. I'm not sure why cxf would assume > you > > are including the header if you never generated your classes to accept > one. > > > > If exsh not turned on, then there'll not generate the extra header > parameter, and it should not fail the runtime, > otherwise there's a bug in the runtime. the header parameter is optional, > > I remember that i fixed this in both the tools and runtime, > but maybe there's one case that i didn't cover, so, do you mind send > your case (simplified) which i can reproduce, > If you can file a jira, that will be great. > > Regards, > James > > > > > I know my classes weren't setting the header because when I did a find > > usages on my AuthCredentials class, which is put in the header, it > wasn't > > used anywhere. Actually the generated client code, didn't even actually > > make calls to invoke the webservice. It would just create a response > object > > set to null and return it, and that was it. So the generated client in > my > > opinion was useless anyhow. > > > > On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? > >> > >> 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: cxf-user@incubator.apache.org > >> 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: > >> > >> > >> > >> > >>>> type="s:string"/> > >>>> type="s:string"/> > >> > >> > >> > >> and then defines a binding that uses it: > >> > >> > >>>> soapAction="urn://testnotification/sendNotification" > >> style="document"/> > >> > >> > >> >> part="AuthCredentials" use="literal"/> > >> > >> > >> > >> > >> > >> > >> 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 fo
Re: Adding headers to soap request
Hi Ryan, I was able to get this to work now with my scaled down test wsdl, but not the full wsdl that I need it to work with, I'll do my best to help you with what I know about this. I did notice your thread that sounded familiar. Apparently if you add the -exsh true parameter to wsdl2java, you'll end up with an extra parameter in your method signature of your port class implementation. This extra parameter is the header specified in your wsdl. If you don't add the exsh, you won't get the parameter and end up with an IndexOutOfBounds error because cxf is expecting the header. I'm not sure why cxf would assume you are including the header if you never generated your classes to accept one. If exsh not turned on, then there'll not generate the extra header parameter, and it should not fail the runtime, otherwise there's a bug in the runtime. the header parameter is optional, I remember that i fixed this in both the tools and runtime, but maybe there's one case that i didn't cover, so, do you mind send your case (simplified) which i can reproduce, If you can file a jira, that will be great. Regards, James I know my classes weren't setting the header because when I did a find usages on my AuthCredentials class, which is put in the header, it wasn't used anywhere. Actually the generated client code, didn't even actually make calls to invoke the webservice. It would just create a response object set to null and return it, and that was it. So the generated client in my opinion was useless anyhow. On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? 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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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 _sendNotification_parameters = new javax.xml.ws.Holder(_sendNotification_parametersVal); messagingPort.sendNotification(_sendNotification_parameters); System.out.println("sendNotification._sendNotification_parameters=" + _sendNotification_parameters.value); }
Re: Adding headers to soap request
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: cxf-user@incubator.apache.org > > 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: > > > > > > > > > >> type="s:string"/> > >> type="s:string"/> > > > > > > > > and then defines a binding that uses it: > > > > > >> soapAction="urn://testnotification/sendNotification" > > style="document"/> > > > > > > > part="AuthCredentials" use="literal"/> > > > > > > > > > > > > > > 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 _sendNotification_parameters = > > new > > javax.xml.ws.Holder(_sendNotification_parametersVal); > > messagingPort.sendNotification(_sendNotification_parameters); > > System.out.println("sendNotification._sendNotification_parameters=" > > + > > _sendNotification_parameters.value); > > } > > > > >
Re: Adding headers to soap request
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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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 _sendNotification_parameters = new javax.xml.ws.Holder(_sendNotification_parametersVal); messagingPort.sendNotification(_sendNotification_parameters); System.out.println("sendNotification._sendNotification_parameters=" + _sendNotification_parameters.value); }
Re: Adding headers to soap request
Right, it actually makes sense to me now, but go figure when I apply this to the WSDL of the service I want to call, the extra parameter for the header is somehow disappearing. I'm in a debugging session with CXF right now attempting to find out at what point it loses it.. so far it's retaining that parameter.. I'll let you all know when I isolate the code that seems to be causing my problem, which should be shortly. On 9/11/07, Ulhas Bhole <[EMAIL PROTECTED]> wrote: > > Hi Ryan, > > The problem you are seeing might be because he Header processing is > getting the expectation of header from Service model generated from > WSDL. However, the actual header insertion is not happening because the > generated method signature is not containing the header parameter. > > You can take a look at the system tests related to SOAP Headers. > > Regards, > > Ulhas Bhole > > Ryan Moquin wrote: > > I was able to get this to work now with my scaled down test wsdl, but > not > > the full wsdl that I need it to work with, I'll do my best to help you > with > > what I know about this. > > > > I did notice your thread that sounded familiar. Apparently if you add > the > > -exsh true parameter to wsdl2java, you'll end up with an extra parameter > in > > your method signature of your port class implementation. This extra > > parameter is the header specified in your wsdl. If you don't add the > exsh, > > you won't get the parameter and end up with an IndexOutOfBounds error > > because cxf is expecting the header. I'm not sure why cxf would assume > you > > are including the header if you never generated your classes to accept > one. > > > > I know my classes weren't setting the header because when I did a find > > usages on my AuthCredentials class, which is put in the header, it > wasn't > > used anywhere. Actually the generated client code, didn't even actually > > make calls to invoke the webservice. It would just create a response > object > > set to null and return it, and that was it. So the generated client in > my > > opinion was useless anyhow. > > > > On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? > >> > >> 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: cxf-user@incubator.apache.org > >> 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: > >> > >> > >> > >> > >>>> type="s:string"/> > >>>> type="s:string"/> > >> > >> > >> > >> and then defines a binding that uses it: > >> > >> > >>>> soapAction="urn://testnotification/sendNotification" > >> style="document"/> > >> > >> > >> >> part="AuthCredentials" use="literal"/> > >> > >> > >> > >> > >> > >> > >> 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 >
Re: Adding headers to soap request
Hi Ryan, The problem you are seeing might be because he Header processing is getting the expectation of header from Service model generated from WSDL. However, the actual header insertion is not happening because the generated method signature is not containing the header parameter. You can take a look at the system tests related to SOAP Headers. Regards, Ulhas Bhole Ryan Moquin wrote: > I was able to get this to work now with my scaled down test wsdl, but not > the full wsdl that I need it to work with, I'll do my best to help you with > what I know about this. > > I did notice your thread that sounded familiar. Apparently if you add the > -exsh true parameter to wsdl2java, you'll end up with an extra parameter in > your method signature of your port class implementation. This extra > parameter is the header specified in your wsdl. If you don't add the exsh, > you won't get the parameter and end up with an IndexOutOfBounds error > because cxf is expecting the header. I'm not sure why cxf would assume you > are including the header if you never generated your classes to accept one. > > I know my classes weren't setting the header because when I did a find > usages on my AuthCredentials class, which is put in the header, it wasn't > used anywhere. Actually the generated client code, didn't even actually > make calls to invoke the webservice. It would just create a response object > set to null and return it, and that was it. So the generated client in my > opinion was useless anyhow. > > On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? >> >> 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: cxf-user@incubator.apache.org >> 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: >> >> >> >> >> > type="s:string"/> >> > type="s:string"/> >> >> >> >> and then defines a binding that uses it: >> >> >> > soapAction="urn://testnotification/sendNotification" >> style="document"/> >> >> >> > part="AuthCredentials" use="literal"/> >> >> >> >> >> >> >> 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 _sendNotification_parameters = >> new >> javax.xml.ws.Holder(_sendNotification_parametersVal); >> messagingPort.sendNotification(_sendNotification_parameters); >> System.out.println("sendNotification._sendNotification_parameters=" >> + >> _sendNotification_parameters.value); >> } >> >> > > IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Adding headers to soap request
I was able to get this to work now with my scaled down test wsdl, but not the full wsdl that I need it to work with, I'll do my best to help you with what I know about this. I did notice your thread that sounded familiar. Apparently if you add the -exsh true parameter to wsdl2java, you'll end up with an extra parameter in your method signature of your port class implementation. This extra parameter is the header specified in your wsdl. If you don't add the exsh, you won't get the parameter and end up with an IndexOutOfBounds error because cxf is expecting the header. I'm not sure why cxf would assume you are including the header if you never generated your classes to accept one. I know my classes weren't setting the header because when I did a find usages on my AuthCredentials class, which is put in the header, it wasn't used anywhere. Actually the generated client code, didn't even actually make calls to invoke the webservice. It would just create a response object set to null and return it, and that was it. So the generated client in my opinion was useless anyhow. On 9/11/07, Gamble, Wesley (WG10) <[EMAIL PROTECTED]> 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? > > 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: cxf-user@incubator.apache.org > 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: > > > > >type="s:string"/> >type="s:string"/> > > > > and then defines a binding that uses it: > > >soapAction="urn://testnotification/sendNotification" > style="document"/> > > > part="AuthCredentials" use="literal"/> > > > > > > > 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 _sendNotification_parameters = > new > javax.xml.ws.Holder(_sendNotification_parametersVal); > messagingPort.sendNotification(_sendNotification_parameters); > System.out.println("sendNotification._sendNotification_parameters=" > + > _sendNotification_parameters.value); > } >
RE: Adding headers to soap request
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: cxf-user@incubator.apache.org 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: org.apache.cxf cxf-rt-bindings-soap ${project.version} 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: > > > > >type="s:string"/> >type="s:string"/> > > > > and then defines a binding that uses it: > > >style="document"/> > > > part="AuthCredentials" use="literal"/> > > > > > > > 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 _sendNotification_parameters = > new javax.xml.ws.Holder >(_sendNotification_parametersVal); > messagingPort.sendNotification(_sendNotification_parameters); > System.out.println("sendNotification._sendNotification_parameters=" + > _sendNotification_parameters.value); > } >
RE: Adding headers to soap request
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? 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: cxf-user@incubator.apache.org 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: and then defines a binding that uses it: 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 _sendNotification_parameters = new javax.xml.ws.Holder(_sendNotification_parametersVal); messagingPort.sendNotification(_sendNotification_parameters); System.out.println("sendNotification._sendNotification_parameters=" + _sendNotification_parameters.value); }
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: org.apache.cxf cxf-rt-bindings-soap ${project.version} 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.handleHeaderPart( SoapOutInterceptor.java:179) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart (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: > > > > >type="s:string"/> >type="s:string"/> > > > > and then defines a binding that uses it: > > >style="document"/> > > > part="AuthCredentials" use="literal"/> > > > > > > > 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 _sendNotification_parameters = > new javax.xml.ws.Holder >(_sendNotification_parametersVal); > messagingPort.sendNotification(_sendNotification_parameters); > System.out.println("sendNotification._sendNotification_parameters=" + > _sendNotification_parameters.value); > } >
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: and then defines a binding that uses it: 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 _sendNotification_parameters = new javax.xml.ws.Holder(_sendNotification_parametersVal); messagingPort.sendNotification(_sendNotification_parameters); System.out.println("sendNotification._sendNotification_parameters=" + _sendNotification_parameters.value); }