You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Bindu Dandamudi <bi...@gmail.com> on 2013/06/28 19:32:43 UTC

Re: cxf spring client soap xml response question

Hi Daniel,
I am using cxf 2.6.0 not 2.4.0
And also i see the wrapped mode info in
javax.xml.ws.Holder<java.lang.String> for "sysid" but not for "number" that
I need.

1.) I generated this interface  using the "cxf-code-gen" pligin the
following in pom.xml:-
<wsdlOption>

<wsdl>${project.basedir}/src/main/resources/servicenowwsdl/MiWorkSpaceRequest.wsdl</wsdl>


<wsdlLocation>classpath:MiWorkSpaceRequest.wsdl</wsdlLocation>
                                    <extraargs>
                                        <extraarg>-p</extraarg>

<extraarg>edu.umich.its.itservicestracking.servicenowclient.miworkspace.gen</extraarg>
                                        <extraarg>-exsh</extraarg>
                                        <extraarg>true</extraarg>

<extraarg>-autoNameResolution</extraarg>
                                    </extraargs>
                                </wsdlOption>


2.) here's the details of the insert operation :-
@RequestWrapper(localName = "insert", targetNamespace = "
http://www.service-now.com/u_call_intake", className =
"edu.umich.its.itservicestracking.servicenowclient.miworkspace.gen.Insert")
    @WebMethod(action = "http://www.service-now.com/u_call_intake/insert")
    @ResponseWrapper(localName = "insertResponse", targetNamespace = "
http://www.service-now.com/u_call_intake", className =
"edu.umich.its.itservicestracking.servicenowclient.miworkspace.gen.InsertResponse")
    public void insert(
        @WebParam(name = "active", targetNamespace = "")
        java.lang.Boolean active,

        @WebParam(name = "work_start", targetNamespace = "")
        java.lang.String workStart,
        @WebParam(mode = WebParam.Mode.OUT, name = "sys_id",
targetNamespace = "")
        javax.xml.ws.Holder<java.lang.String> sysId
    );

3.) But there is other operation - "get" not "insert"  that has the
following defined in wrapped mode:-

 @RequestWrapper(localName = "get", targetNamespace = "
http://www.service-now.com/u_call_intake", className =
"edu.umich.its.itservicestracking.servicenowclient.miworkspace.gen.Get")
    @WebMethod(action = "http://www.service-now.com/u_call_intake/get")
    @ResponseWrapper(localName = "getResponse", targetNamespace = "
http://www.service-now.com/u_call_intake", className =
"edu.umich.its.itservicestracking.servicenowclient.miworkspace.gen.GetResponse")
    public void get(
        @WebParam(mode = WebParam.Mode.INOUT, name = "sys_id",
targetNamespace = "")
        javax.xml.ws.Holder<java.lang.String> sysId,
        @WebParam(name = "__use_view", targetNamespace = "")
        *@WebParam(mode = WebParam.Mode.OUT, name = "number",
targetNamespace = "")
        javax.xml.ws.Holder<java.lang.String> number,*
        @WebParam(mode = WebParam.Mode.OUT, name = "opened_at",
targetNamespace = "")
        javax.xml.ws.Holder<java.lang.String> openedAt,
...)

I am not sure how to get the "number" after invoking "insert" operation as
"insertResponse" doesnot vae the Holder for number?
Also not sure how to get response objevt fron "getResponse".

Thanks for your direction and help on this.

Bindu


On Thu, Jun 27, 2013 at 1:50 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> First off, upgrade to a newer version of CXF.   2.4.x is no longer
> supported.
>
> Second, if there is output information for the method, in wrapped mode
> like that, there should be "Holder<String>" params to the method generated
> that would hold the output information.
>
> Alternatively, if using a newer version of CXF, you can pass -bareMethods
> flag to wsdl2java to have it generate the methods in "BARE" mode which
> would change how that information is passed.
>
> Dan
>
>
>
> On Jun 26, 2013, at 9:37 AM, Bindu <bi...@gmail.com> wrote:
>
> >
> >
> > Freeman Fang <fr...@...> writes:
> >
> >>
> >> Hi,
> >>
> >> If you wanna response have a string, the simplest way is change your
> wsdl,
> > as the wsdl is the file to describe
> >> the interface(input parameter, return value, etc)
> >> -------------
> >> Freeman(Yue) Fang
> >>
> >> Red Hat, Inc.
> >> FuseSource is now part of Red Hat
> >> Web: http://fusesource.com | http://www.redhat.com/
> >> Twitter: freemanfang
> >> Blog: http://freemanfang.blogspot.com
> >> http://blog.sina.com.cn/u/1473905042
> >> weibo:  <at> Freeman小屋
> >>
> >> On 2013-6-26, at 上午7:27, Bindu wrote:
> >>
> >>> I have an issue with cxf/spring client SOAP wsdl- webservice.
> >>> I invoke a jaxws - client request to the wsdl operation that returns
> >>> void(like insert operation).The soap xml request - response returns ok
> > with
> >>> 200 and isee in the cxf logs the whole soap envelope with the return
> > values
> >>> , with out any issue.
> >>> I am not sure how to get the response which returns complextype -
> >>> insertResponse operation , where i need to get a string value.
> >>>
> >>> I could get a response from the wsdl operations that directly return
> the
> >>> string value and are not void defined in the service endpoint
> > interface(SEI)
> >>>
> >>> few details of the code i tried:-
> >>> service.insert(..parameters);
> >>> InsertResponse response=?
> >>> String number = response.getNumber();
> >>>
> >>> I tried using cxf interceptors but not sure of the right way.
> >>>
> >>> Any direction will be helpful to proceed further as i am stuck here.
> >>>
> >>> Thanks
> >>> Bindu
> >>>
> >>
> >>
> > I do not have much flexbility in changing the wsdl as it's  consumed from
> > external vendor.
> > But if the wsdl is  providing both the operations in the interface then
> > there should be a way using jaxws- cxf client not to get the response
> form
> > void method after invoking the insert operation call?
> >
> > I see the xml request and response in the cxf logs with all the values
> > returened from "insertResponse"
> >
> > Here's the pieces of interface generated by Apache CXF 2.4.1(using
> cxf/maven
> > plugin) code:-
> > @RequestWrapper(localName = "insert", targetNamespace = "http://bbbbb.
> ..",
> > className = "gen.Insert")
> >    @WebMethod(action = "http://bbbbb....")
> >    @ResponseWrapper(localName = "insertResponse", targetNamespace =
> > "http://bbbb...", className = "gen.InsertResponse")
> >    public void insert(
> >        @WebParam(name = "active", targetNamespace = "")
> > ....)
> >
> > Here's the InsertResponse class and i am trying to get the string number.
> >
> > @XmlRootElement(name = "insertResponse")
> > public class InsertResponse {
> >
> >    @XmlElement(name = "sys_id")
> >    protected String sysId;
> >    protected String number;
> >
> >
> > Thanks
> > Bindu
> >
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>