You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Roland Carlsson <bu...@gmail.com> on 2008/10/27 10:51:17 UTC

wsdl2java failed?

Hi!

I have a webservice that are generated from a wsdl-file. When I compare my
code with the examples they doesn't seem to work in the same way. The
problem is that I don't get methods to get the responseObject. wsdl2java
genereates a class called EstateObject but the other classes doesn't seem to
use it and I don't find the way.

Below is the client-code generated by wsdl2java and the output from that. I
could send the wsdl if asked for (if there no obvious solution to my
problem.

Thannk in advance
Roland


I generated the code from SoapUI - generate CFX classes.
It generated the following code below (I have added line 51 and 53).

-------------------------
public static void main(String args[]) throws Exception {
        URL wsdlURL = Fast3KObject.WSDL_LOCATION;
        if (args.length > 0) {
            File wsdlFile = new File(args[0]);
            try {
                if (wsdlFile.exists()) {
                    wsdlURL = wsdlFile.toURI().toURL();
                } else {
                    wsdlURL = new URL(args[0]);
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }

        Fast3KObject ss = new Fast3KObject(wsdlURL, SERVICE_NAME);
        Fast3KObjectSoap port = ss.getFast3KObjectSoap();

        {
        System.out.println("Invoking getObject...");
        java.lang.String _getObject_objectNo = "547200";

se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectResponse.GetObjectResult
_getObject__return = port.getObject(_getObject_objectNo);
        System.out.println("getObject.result=" + _getObject__return);
        System.out.println("any=" + _getObject__return.any);

        System.out.println("KLAR");
        }

        System.exit(0);
    }

----------------------------------

and that generates the following output.

-------------------------------
2008-okt-27 10:36:37 org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Invoking getObject...
getObject.result=se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectResponse$GetObjectResult@1b3278a
any=[diffgr:diffgram: null]
KLAR
------------------------

Re: wsdl2java failed?

Posted by Roland Carlsson <bu...@gmail.com>.
Thank you for your answer!

The problem is that I don't find a way to use the EstateObject.java
generated by wsdl2java from the GetObjectResponse or
GetObjectResponse.GetObjectResult
in the client code example.There are no getEstateObject method in the
generated code. So I don't understand how I am supposed to get an instance
of the EstateObject after i called the webservice. The ObjectFactory doesn't
take arguments to create an EstateObject from the GetObjectResult.

------ code example
// call the webservice
GetObjectResponse.GetObjectResult _getObject__return =
port.getObject(_getObject_objectNo);

EstateObject estateObject = _getObject_return.? // there is no
getEstateObject.
----------

The java files generated are the following:

EstateObject.java // contains the static inner classes Object and
Object.EstateAddress and Object.RealEstate
Fast3KObject.java
Fast3KObjectSoap_Fast3KObjectSoap_client.java
Fast3KObjectSoap_Fast3KObjectSoap_server.java
Fast3KObjectSoap.java
Fast3KObjectSoapImpl.java
GetObject.java
GetObjectResponse.java
ObjectFactory.java // has a couple of createEstateObject and variations but
it create only empty object (no arguments or setters)
package-info.java

Best regards
Roland

Ps: Daniel, I apologize for sending the above directly to you yesterday. I
should have checked the addresses before sending.


2008/10/27 Daniel Kulp <dk...@apache.org>

> On Monday 27 October 2008 5:51:17 am Roland Carlsson wrote:
> > I have a webservice that are generated from a wsdl-file. When I compare
> my
> > code with the examples they doesn't seem to work in the same way. The
> > problem is that I don't get methods to get the responseObject. wsdl2java
> > genereates a class called EstateObject but the other classes doesn't seem
> > to use it and I don't find the way.
>
> I'm not sure what the problem is......
>
> JAXB will generate classes for everything in the schema, even if nothing
> really uses it.   Thus, if you have an EstateObject type in the schema, it
> will get generated.
>
>
> > Below is the client-code generated by wsdl2java and the output from that.
> I
> > could send the wsdl if asked for (if there no obvious solution to my
> > problem.
>
> The code below all looks "normal" for generated code.   You'd need to be
> more
> specific about what you are looking for.
>
> Dan
>
>
> >
> > Thannk in advance
> > Roland
> >
> >
> > I generated the code from SoapUI - generate CFX classes.
> > It generated the following code below (I have added line 51 and 53).
> >
> > -------------------------
> > public static void main(String args[]) throws Exception {
> >         URL wsdlURL = Fast3KObject.WSDL_LOCATION;
> >         if (args.length > 0) {
> >             File wsdlFile = new File(args[0]);
> >             try {
> >                 if (wsdlFile.exists()) {
> >                     wsdlURL = wsdlFile.toURI().toURL();
> >                 } else {
> >                     wsdlURL = new URL(args[0]);
> >                 }
> >             } catch (MalformedURLException e) {
> >                 e.printStackTrace();
> >             }
> >         }
> >
> >         Fast3KObject ss = new Fast3KObject(wsdlURL, SERVICE_NAME);
> >         Fast3KObjectSoap port = ss.getFast3KObjectSoap();
> >
> >         {
> >         System.out.println("Invoking getObject...");
> >         java.lang.String _getObject_objectNo = "547200";
> >
> >
> se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectResponse.GetObjectR
> >esult _getObject__return = port.getObject(_getObject_objectNo);
> >         System.out.println("getObject.result=" + _getObject__return);
> >         System.out.println("any=" + _getObject__return.any);
> >
> >         System.out.println("KLAR");
> >         }
> >
> >         System.exit(0);
> >     }
> >
> > ----------------------------------
> >
> > and that generates the following output.
> >
> > -------------------------------
> > 2008-okt-27 10:36:37 org.apache.cxf.bus.spring.BusApplicationContext
> > getConfigResources
> > INFO: No cxf.xml configuration file detected, relying on defaults.
> > Invoking getObject...
> >
> getObject.result=se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectRe
> >sponse$GetObjectResult@1b3278a any=[diffgr:diffgram: null]
> > KLAR
> > ------------------------
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>

Re: wsdl2java failed?

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 27 October 2008 5:51:17 am Roland Carlsson wrote:
> I have a webservice that are generated from a wsdl-file. When I compare my
> code with the examples they doesn't seem to work in the same way. The
> problem is that I don't get methods to get the responseObject. wsdl2java
> genereates a class called EstateObject but the other classes doesn't seem
> to use it and I don't find the way.

I'm not sure what the problem is......  

JAXB will generate classes for everything in the schema, even if nothing 
really uses it.   Thus, if you have an EstateObject type in the schema, it 
will get generated.


> Below is the client-code generated by wsdl2java and the output from that. I
> could send the wsdl if asked for (if there no obvious solution to my
> problem.

The code below all looks "normal" for generated code.   You'd need to be more 
specific about what you are looking for.

Dan


>
> Thannk in advance
> Roland
>
>
> I generated the code from SoapUI - generate CFX classes.
> It generated the following code below (I have added line 51 and 53).
>
> -------------------------
> public static void main(String args[]) throws Exception {
>         URL wsdlURL = Fast3KObject.WSDL_LOCATION;
>         if (args.length > 0) {
>             File wsdlFile = new File(args[0]);
>             try {
>                 if (wsdlFile.exists()) {
>                     wsdlURL = wsdlFile.toURI().toURL();
>                 } else {
>                     wsdlURL = new URL(args[0]);
>                 }
>             } catch (MalformedURLException e) {
>                 e.printStackTrace();
>             }
>         }
>
>         Fast3KObject ss = new Fast3KObject(wsdlURL, SERVICE_NAME);
>         Fast3KObjectSoap port = ss.getFast3KObjectSoap();
>
>         {
>         System.out.println("Invoking getObject...");
>         java.lang.String _getObject_objectNo = "547200";
>
> se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectResponse.GetObjectR
>esult _getObject__return = port.getObject(_getObject_objectNo);
>         System.out.println("getObject.result=" + _getObject__return);
>         System.out.println("any=" + _getObject__return.any);
>
>         System.out.println("KLAR");
>         }
>
>         System.exit(0);
>     }
>
> ----------------------------------
>
> and that generates the following output.
>
> -------------------------------
> 2008-okt-27 10:36:37 org.apache.cxf.bus.spring.BusApplicationContext
> getConfigResources
> INFO: No cxf.xml configuration file detected, relying on defaults.
> Invoking getObject...
> getObject.result=se.redpill.alfresco.module.jkp.wsclient.fast3k.GetObjectRe
>sponse$GetObjectResult@1b3278a any=[diffgr:diffgram: null]
> KLAR
> ------------------------



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog