You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by sreuland <sh...@ereuland.com> on 2008/10/31 01:53:12 UTC

can I specify classpath for wsdllocation param to wsdl2java?

I've tried different uri forms and not having any luck. When the wsdl2java is
run against a wsdl, the Service class that it generates has a static
initializer for locating the wsdl file during runtime:

 public final static URL WSDL_LOCATION;
    public final static QName SERVICE = new
QName("http://namespaces.stuff.my", "MyService");
    public final static QName MyPort = new
QName("http://namespaces.stuff.my", "MyPort");
    ....    
    static {
        URL url = null;
        try {
            url = new URL("my.wsdl");
        } catch (MalformedURLException e) {
            System.err.println("Can not initialize the default wsdl from
my.wsdl");
            // e.printStackTrace();
        }
        WSDL_LOCATION = url;
    }


I'm trying to avoid a published wsdl url on the web, the other option
'file:my.wsdl' does work but is causing maintenance issue as each client
needs to place 'my.wsdl' in jvm's startup directory. Ideally I'd like to
embed the wsdl as a resource in a jar and then reference it from classpath.
Any possibility that wsdl2java could detect if a 'classpath:' scheme is
present in wsdllocation parameter like 'classpath:my/stuff/my.wsdl' and then
emit code like :

static {
        URL url = null;
        try {
            url = new
MyService.class.getClassLoader().getResource("my/stuff/my.wsdl");
        } catch (MalformedURLException e) {
            System.err.println("Can not initialize the default wsdl from
classpath for my/stuff/my.wsdl");
            // e.printStackTrace();
        }
        WSDL_LOCATION = url;
    }
-- 
View this message in context: http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20258375.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Sergey Beryozkin <se...@progress.com>.
Hi,

I'm not sure if it can help but there's a ServiceContractResolver interface available in CXF

public interface ServiceContractResolver {
URI getContractLocation(QName qname);
}

So if you have a custom cxf configuration file which would register a ServiceContractResolver bean then in a client code you can 
simply do

new GreeterService(null, GREETER_QNAME)

and your ServiceContractResolver will be checked.

I'm not sure if wsdltojava can generate such code for you though...If this option works for you then may be you can modify the 
generated code or open a JIRA and request an enhancement for wsdltojava

Cheers, Sergey



>
> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> Service class throws a MalFormed exception. The only way I've managed to get
> the URL() constructor to find my.wsdl is when i specify a 'file' scheme such
> as 'file:my.wsdl', then the URL constructor finds the file but it has to be
> relative to the starting directory of the jvm(not embedded in a jar). I
> figured if code generation in wsdl2java could recognize 'classpath:' scheme
> in wsdlLocation param and generate url =
> Service.class.getClassLoader().getResource("my.wsdl");  instead of try { url
> = new URL("my.wsdl"); } catch (MalformedURLException e) { } then runtime
> should find wsdl from classpath since java.net.URL constructor won't.
> -- 
> View this message in context: 
> http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20270757.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Roland Carlsson <bu...@gmail.com>.
Download soupui and generate the sources from there. It's a great tool.

//Roland

2008/10/31 sreuland <sh...@ereuland.com>

>
> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> Service class throws a MalFormed exception. The only way I've managed to
> get
> the URL() constructor to find my.wsdl is when i specify a 'file' scheme
> such
> as 'file:my.wsdl', then the URL constructor finds the file but it has to be
> relative to the starting directory of the jvm(not embedded in a jar). I
> figured if code generation in wsdl2java could recognize 'classpath:' scheme
> in wsdlLocation param and generate url =
> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
> url
> = new URL("my.wsdl"); } catch (MalformedURLException e) { } then runtime
> should find wsdl from classpath since java.net.URL constructor won't.
> --
> View this message in context:
> http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20270757.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Glen Mazza <gl...@gmail.com>.
That seems like a nice idea, but I'm unsure if that would be JSR-224
compliant (JAX-WS 2.1, May 2007).  

Section 2.7:  Conformance: A generated service class MUST have a default
(i.e. zero-argument) public construc-
tor. This constructor MUST call the protected constructor declared in
javax.xml.ws.Service, passing
as arguments the WSDL location and the service name. -->The values of the
actual arguments for this call
MUST be equal (in the java.lang.Object.equals sense) to the values specified
in the mandatory
WebServiceClient annotation on the generated service class itself.<--

>From the --> <-- section above, it appears that whatever the value of the
wsdlLocation in @WebServiceClient must be used as the URL for the
constructor.

Section 7.5, 7.5 javax.xml.ws.WebServiceClient:  "wsdlLocation:  The URL for
the WSDL description of the service.

When resolving the URI specified as the wsdlLocation element or any document
it may transitively
reference, a JAX-WS implementation MUST use the catalog facility defined in
section 4.4."

wsdlLocation must be a URL then, which would preclude the classpath: option.

I would check Section 4.4--using a catalog might help you here.  Also,
another issue, I have not found that the hardcoded file must be located
relative to the JVM.  For my DoubleIt example, it hardcodes to a specific
directory:

url = new
URL("file:/work/workspace/DoubleIt/trunk/service-war/src/main/webapp/WEB-INF/wsdl/DoubleIt.wsdl");

Perhaps you can use a relative path as well--which would give you a little
bit more flexibility without needing a catalog.

HTH,
Glen



sreuland wrote:
> 
> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> Service class throws a MalFormed exception. The only way I've managed to
> get the URL() constructor to find my.wsdl is when i specify a 'file'
> scheme such as 'file:my.wsdl', then the URL constructor finds the file but
> it has to be relative to the starting directory of the jvm(not embedded in
> a jar). I figured if code generation in wsdl2java could recognize
> 'classpath:' scheme in wsdlLocation param and generate url =
> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
> runtime should find wsdl from classpath since java.net.URL constructor
> won't.
> 

-- 
View this message in context: http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20301958.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Craig Tataryn <cr...@tataryn.net>.
Done:
https://issues.apache.org/jira/browse/CXF-2703

Craig.

On Thu, Mar 4, 2010 at 6:59 PM, Craig Tataryn <cr...@tataryn.net> wrote:
> Will do
>
> On 2010-03-04, at 4:42 PM, Daniel Kulp <dk...@apache.org> wrote:
>
>> On Thursday 04 March 2010 4:57:10 pm Craig Tataryn wrote:
>>>
>>> Dan, would this be an artifact of the problem I had raised a while
>>> back on the dev list?
>>>
>>>
>>> http://old.nabble.com/Possible-fix-for-resolving-classpath-schemas-issues..
>>> ..-to27461783.html
>>
>> Yep.   That would be it.
>>
>> In anycase, and test cases attached to a JIRA would be a great help.
>>
>> Dan
>>
>>
>>>
>>> Craig.
>>>
>>> On Thu, Mar 4, 2010 at 1:24 PM, mindchi <tb...@acm.org> wrote:
>>>>
>>>> Dan,
>>>>
>>>> Can you tell me how I can access the test cases you are referring to?
>>>> I am currently working with 2.2.6 and am still having problems with
>>>> this.
>>>>
>>>> Thanks.
>>>>
>>>> Thom --
>>>>
>>>> dkulp wrote:
>>>>>
>>>>> On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
>>>>>>
>>>>>> I have a question about this solution.
>>>>>> I have a wsdl file which imports another wsdl file, which in turn
>>>>>> imports an xsd file. I can do the getResource on the top level wsdl
>>>>>> file, but will
>>>>>> CXF be able to figure out where to get the other files, or will it
>>>>>> just
>>>>>> resort
>>>>>> to the JVM start directory as before. It apparently goes to the JVM
>>>>>> start directory for those other files.
>>>>>>
>>>>>> Based on what I've tried so far, it looks like there's no way to get
>>>>>> all of
>>>>>> this working cleanly. That is, have everything packaged in a jar and
>>>>>> accessed
>>>>>> from there.
>>>>>
>>>>> It SHOULD work.    I've been working with a couple people that are
>>>>> doing
>>>>> this
>>>>> and 2.2.6 does have a bunch of fixes in it to get there.   A good chunk
>>>>> of the
>>>>> problems is in JAXB.    I've had to hack around several bugs in JAXB to
>>>>> get it
>>>>> working, but the test cases I've been given now work with 2.2.6.
>>>>>
>>>>>> Is this something that there should be a JIRA written up for?
>>>>>
>>>>> If it's not working for you with 2.2.6, definitely file a JIRA and
>>>>> attach a
>>>>> test case.   Attaching the test case is important cause, as I said, the
>>>>> test
>>>>> cases other users have provided do work so I'd really need to see what
>>>>> you are
>>>>> doing differently.
>>>>>
>>>>> Dan
>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> Thom --
>>>>>>
>>>>>> dkulp wrote:
>>>>>>>
>>>>>>> Oh.   Right.   Client side uses a URL and not a string.  Forgot about
>>>>>>> that.   :-(
>>>>>>>
>>>>>>> Yea, the only real option is to pass:
>>>>>>> -wsdlLocation ""
>>>>>>> (empty string) which with 2.1.3 I think will not generate the URL at
>>>>>>
>>>>>> all.
>>>>>>
>>>>>>> You would then need to do the getResource(...) thing yourself to find
>>>>>>
>>>>>> the
>>>>>>
>>>>>>> appropriate URL.
>>>>>>>
>>>>>>> Dan
>>>>>>>
>>>>>>> On Friday 31 October 2008 1:34:40 pm sreuland wrote:
>>>>>>>>
>>>>>>>> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
>>>>>>>> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
>>>>>>>> initializer url = new java.net.URL("classpath:my.wsdl");  in
>>>>>>>> generated Service class throws a MalFormed exception. The only way
>>>>>>>> I've managed
>>>>>>
>>>>>> to
>>>>>>
>>>>>>>> get the URL() constructor to find my.wsdl is when i specify a 'file'
>>>>>>>> scheme
>>>>>>>> such as 'file:my.wsdl', then the URL constructor finds the file but
>>>>>>>> it has
>>>>>>>> to be relative to the starting directory of the jvm(not embedded in
>>>>>>>> a jar).
>>>>>>>> I figured if code generation in wsdl2java could recognize
>>>>>>>> 'classpath:' scheme in wsdlLocation param and generate url =
>>>>>>>> Service.class.getClassLoader().getResource("my.wsdl");  instead of
>>>>>>>> try
>>>>>>
>>>>>> {
>>>>>>
>>>>>>>> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
>>>>>>>> runtime should find wsdl from classpath since java.net.URL
>>>>>>>> constructor won't.
>>>>>
>>>>> --
>>>>> Daniel Kulp
>>>>> dkulp@apache.org
>>>>> http://dankulp.com/blog
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-
>>>> wsdl2java--tp20258375p27785376.html Sent from the cxf-user mailing list
>>>> archive at Nabble.com.
>>
>> --
>> Daniel Kulp
>> dkulp@apache.org
>> http://dankulp.com/blog
>



-- 
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Craig Tataryn <cr...@tataryn.net>.
Will do

On 2010-03-04, at 4:42 PM, Daniel Kulp <dk...@apache.org> wrote:

> On Thursday 04 March 2010 4:57:10 pm Craig Tataryn wrote:
>> Dan, would this be an artifact of the problem I had raised a while
>> back on the dev list?
>>
>> http://old.nabble.com/Possible-fix-for-resolving-classpath-schemas-issues 
>> ..
>> ..-to27461783.html
>
> Yep.   That would be it.
>
> In anycase, and test cases attached to a JIRA would be a great help.
>
> Dan
>
>
>>
>> Craig.
>>
>> On Thu, Mar 4, 2010 at 1:24 PM, mindchi <tb...@acm.org> wrote:
>>> Dan,
>>>
>>> Can you tell me how I can access the test cases you are referring  
>>> to?
>>> I am currently working with 2.2.6 and am still having problems  
>>> with this.
>>>
>>> Thanks.
>>>
>>> Thom --
>>>
>>> dkulp wrote:
>>>> On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
>>>>> I have a question about this solution.
>>>>> I have a wsdl file which imports another wsdl file, which in turn
>>>>> imports an xsd file. I can do the getResource on the top level  
>>>>> wsdl
>>>>> file, but will
>>>>> CXF be able to figure out where to get the other files, or will  
>>>>> it just
>>>>> resort
>>>>> to the JVM start directory as before. It apparently goes to the  
>>>>> JVM
>>>>> start directory for those other files.
>>>>>
>>>>> Based on what I've tried so far, it looks like there's no way to  
>>>>> get
>>>>> all of
>>>>> this working cleanly. That is, have everything packaged in a jar  
>>>>> and
>>>>> accessed
>>>>> from there.
>>>>
>>>> It SHOULD work.    I've been working with a couple people that  
>>>> are doing
>>>> this
>>>> and 2.2.6 does have a bunch of fixes in it to get there.   A good  
>>>> chunk
>>>> of the
>>>> problems is in JAXB.    I've had to hack around several bugs in  
>>>> JAXB to
>>>> get it
>>>> working, but the test cases I've been given now work with 2.2.6.
>>>>
>>>>> Is this something that there should be a JIRA written up for?
>>>>
>>>> If it's not working for you with 2.2.6, definitely file a JIRA and
>>>> attach a
>>>> test case.   Attaching the test case is important cause, as I  
>>>> said, the
>>>> test
>>>> cases other users have provided do work so I'd really need to see  
>>>> what
>>>> you are
>>>> doing differently.
>>>>
>>>> Dan
>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> Thom --
>>>>>
>>>>> dkulp wrote:
>>>>>> Oh.   Right.   Client side uses a URL and not a string.  Forgot  
>>>>>> about
>>>>>> that.   :-(
>>>>>>
>>>>>> Yea, the only real option is to pass:
>>>>>> -wsdlLocation ""
>>>>>> (empty string) which with 2.1.3 I think will not generate the  
>>>>>> URL at
>>>>>
>>>>> all.
>>>>>
>>>>>> You would then need to do the getResource(...) thing yourself  
>>>>>> to find
>>>>>
>>>>> the
>>>>>
>>>>>> appropriate URL.
>>>>>>
>>>>>> Dan
>>>>>>
>>>>>> On Friday 31 October 2008 1:34:40 pm sreuland wrote:
>>>>>>> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
>>>>>>> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The  
>>>>>>> static
>>>>>>> initializer url = new java.net.URL("classpath:my.wsdl");  in
>>>>>>> generated Service class throws a MalFormed exception. The only  
>>>>>>> way
>>>>>>> I've managed
>>>>>
>>>>> to
>>>>>
>>>>>>> get the URL() constructor to find my.wsdl is when i specify a  
>>>>>>> 'file'
>>>>>>> scheme
>>>>>>> such as 'file:my.wsdl', then the URL constructor finds the  
>>>>>>> file but
>>>>>>> it has
>>>>>>> to be relative to the starting directory of the jvm(not  
>>>>>>> embedded in
>>>>>>> a jar).
>>>>>>> I figured if code generation in wsdl2java could recognize
>>>>>>> 'classpath:' scheme in wsdlLocation param and generate url =
>>>>>>> Service.class.getClassLoader().getResource("my.wsdl");   
>>>>>>> instead of
>>>>>>> try
>>>>>
>>>>> {
>>>>>
>>>>>>> url = new URL("my.wsdl"); } catch (MalformedURLException e)  
>>>>>>> { } then
>>>>>>> runtime should find wsdl from classpath since java.net.URL
>>>>>>> constructor won't.
>>>>
>>>> --
>>>> Daniel Kulp
>>>> dkulp@apache.org
>>>> http://dankulp.com/blog
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-
>>> wsdl2java--tp20258375p27785376.html Sent from the cxf-user mailing  
>>> list
>>> archive at Nabble.com.
>
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 04 March 2010 4:57:10 pm Craig Tataryn wrote:
> Dan, would this be an artifact of the problem I had raised a while
> back on the dev list?
> 
> http://old.nabble.com/Possible-fix-for-resolving-classpath-schemas-issues..
> ..-to27461783.html

Yep.   That would be it.   

In anycase, and test cases attached to a JIRA would be a great help.

Dan


> 
> Craig.
> 
> On Thu, Mar 4, 2010 at 1:24 PM, mindchi <tb...@acm.org> wrote:
> > Dan,
> > 
> > Can you tell me how I can access the test cases you are referring to?
> > I am currently working with 2.2.6 and am still having problems with this.
> > 
> > Thanks.
> > 
> > Thom --
> > 
> > dkulp wrote:
> >> On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
> >>> I have a question about this solution.
> >>> I have a wsdl file which imports another wsdl file, which in turn
> >>> imports an xsd file. I can do the getResource on the top level wsdl
> >>> file, but will
> >>> CXF be able to figure out where to get the other files, or will it just
> >>> resort
> >>> to the JVM start directory as before. It apparently goes to the JVM
> >>> start directory for those other files.
> >>> 
> >>> Based on what I've tried so far, it looks like there's no way to get
> >>> all of
> >>> this working cleanly. That is, have everything packaged in a jar and
> >>> accessed
> >>> from there.
> >> 
> >> It SHOULD work.    I've been working with a couple people that are doing
> >> this
> >> and 2.2.6 does have a bunch of fixes in it to get there.   A good chunk
> >> of the
> >> problems is in JAXB.    I've had to hack around several bugs in JAXB to
> >> get it
> >> working, but the test cases I've been given now work with 2.2.6.
> >> 
> >>> Is this something that there should be a JIRA written up for?
> >> 
> >> If it's not working for you with 2.2.6, definitely file a JIRA and
> >> attach a
> >> test case.   Attaching the test case is important cause, as I said, the
> >> test
> >> cases other users have provided do work so I'd really need to see what
> >> you are
> >> doing differently.
> >> 
> >> Dan
> >> 
> >>> Thanks.
> >>> 
> >>> 
> >>> Thom --
> >>> 
> >>> dkulp wrote:
> >>> > Oh.   Right.   Client side uses a URL and not a string.  Forgot about
> >>> > that.   :-(
> >>> > 
> >>> > Yea, the only real option is to pass:
> >>> > -wsdlLocation ""
> >>> > (empty string) which with 2.1.3 I think will not generate the URL at
> >>> 
> >>> all.
> >>> 
> >>> > You would then need to do the getResource(...) thing yourself to find
> >>> 
> >>> the
> >>> 
> >>> > appropriate URL.
> >>> > 
> >>> > Dan
> >>> > 
> >>> > On Friday 31 October 2008 1:34:40 pm sreuland wrote:
> >>> >> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> >>> >> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> >>> >> initializer url = new java.net.URL("classpath:my.wsdl");  in
> >>> >> generated Service class throws a MalFormed exception. The only way
> >>> >> I've managed
> >>> 
> >>> to
> >>> 
> >>> >> get the URL() constructor to find my.wsdl is when i specify a 'file'
> >>> >> scheme
> >>> >> such as 'file:my.wsdl', then the URL constructor finds the file but
> >>> >> it has
> >>> >> to be relative to the starting directory of the jvm(not embedded in
> >>> >> a jar).
> >>> >> I figured if code generation in wsdl2java could recognize
> >>> >> 'classpath:' scheme in wsdlLocation param and generate url =
> >>> >> Service.class.getClassLoader().getResource("my.wsdl");  instead of
> >>> >> try
> >>> 
> >>> {
> >>> 
> >>> >> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
> >>> >> runtime should find wsdl from classpath since java.net.URL
> >>> >> constructor won't.
> >> 
> >> --
> >> Daniel Kulp
> >> dkulp@apache.org
> >> http://dankulp.com/blog
> > 
> > --
> > View this message in context:
> > http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-
> > wsdl2java--tp20258375p27785376.html Sent from the cxf-user mailing list
> > archive at Nabble.com.

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

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Craig Tataryn <cr...@tataryn.net>.
Dan, would this be an artifact of the problem I had raised a while
back on the dev list?

http://old.nabble.com/Possible-fix-for-resolving-classpath-schemas-issues....-to27461783.html

Craig.

On Thu, Mar 4, 2010 at 1:24 PM, mindchi <tb...@acm.org> wrote:
>
> Dan,
>
> Can you tell me how I can access the test cases you are referring to?
> I am currently working with 2.2.6 and am still having problems with this.
>
> Thanks.
>
> Thom --
>
>
> dkulp wrote:
>>
>> On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
>>> I have a question about this solution.
>>> I have a wsdl file which imports another wsdl file, which in turn imports
>>> an xsd file. I can do the getResource on the top level wsdl file, but
>>> will
>>> CXF be able to figure out where to get the other files, or will it just
>>> resort
>>> to the JVM start directory as before. It apparently goes to the JVM start
>>> directory for those other files.
>>>
>>> Based on what I've tried so far, it looks like there's no way to get all
>>> of
>>> this working cleanly. That is, have everything packaged in a jar and
>>> accessed
>>> from there.
>>
>> It SHOULD work.    I've been working with a couple people that are doing
>> this
>> and 2.2.6 does have a bunch of fixes in it to get there.   A good chunk of
>> the
>> problems is in JAXB.    I've had to hack around several bugs in JAXB to
>> get it
>> working, but the test cases I've been given now work with 2.2.6.
>>
>>> Is this something that there should be a JIRA written up for?
>>
>> If it's not working for you with 2.2.6, definitely file a JIRA and attach
>> a
>> test case.   Attaching the test case is important cause, as I said, the
>> test
>> cases other users have provided do work so I'd really need to see what you
>> are
>> doing differently.
>>
>> Dan
>>
>>>
>>> Thanks.
>>>
>>>
>>> Thom --
>>>
>>> dkulp wrote:
>>> > Oh.   Right.   Client side uses a URL and not a string.  Forgot about
>>> > that.   :-(
>>> >
>>> > Yea, the only real option is to pass:
>>> > -wsdlLocation ""
>>> > (empty string) which with 2.1.3 I think will not generate the URL at
>>> all.
>>> > You would then need to do the getResource(...) thing yourself to find
>>> the
>>> > appropriate URL.
>>> >
>>> > Dan
>>> >
>>> > On Friday 31 October 2008 1:34:40 pm sreuland wrote:
>>> >> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
>>> >> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
>>> >> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
>>> >> Service class throws a MalFormed exception. The only way I've managed
>>> to
>>> >> get the URL() constructor to find my.wsdl is when i specify a 'file'
>>> >> scheme
>>> >> such as 'file:my.wsdl', then the URL constructor finds the file but it
>>> >> has
>>> >> to be relative to the starting directory of the jvm(not embedded in a
>>> >> jar).
>>> >> I figured if code generation in wsdl2java could recognize 'classpath:'
>>> >> scheme in wsdlLocation param and generate url =
>>> >> Service.class.getClassLoader().getResource("my.wsdl");  instead of try
>>> {
>>> >> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
>>> >> runtime should find wsdl from classpath since java.net.URL constructor
>>> >> won't.
>>
>> --
>> Daniel Kulp
>> dkulp@apache.org
>> http://dankulp.com/blog
>>
>>
>
> --
> View this message in context: http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p27785376.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>



-- 
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by mindchi <tb...@acm.org>.
Dan,

Can you tell me how I can access the test cases you are referring to?
I am currently working with 2.2.6 and am still having problems with this.

Thanks.

Thom --


dkulp wrote:
> 
> On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
>> I have a question about this solution.
>> I have a wsdl file which imports another wsdl file, which in turn imports
>> an xsd file. I can do the getResource on the top level wsdl file, but
>> will
>> CXF be able to figure out where to get the other files, or will it just
>> resort
>> to the JVM start directory as before. It apparently goes to the JVM start
>> directory for those other files.
>> 
>> Based on what I've tried so far, it looks like there's no way to get all
>> of
>> this working cleanly. That is, have everything packaged in a jar and
>> accessed
>> from there.
> 
> It SHOULD work.    I've been working with a couple people that are doing
> this 
> and 2.2.6 does have a bunch of fixes in it to get there.   A good chunk of
> the 
> problems is in JAXB.    I've had to hack around several bugs in JAXB to
> get it 
> working, but the test cases I've been given now work with 2.2.6.
>  
>> Is this something that there should be a JIRA written up for?
> 
> If it's not working for you with 2.2.6, definitely file a JIRA and attach
> a 
> test case.   Attaching the test case is important cause, as I said, the
> test 
> cases other users have provided do work so I'd really need to see what you
> are 
> doing differently.
> 
> Dan
> 
>> 
>> Thanks.
>> 
>> 
>> Thom --
>> 
>> dkulp wrote:
>> > Oh.   Right.   Client side uses a URL and not a string.  Forgot about
>> > that.   :-(
>> > 
>> > Yea, the only real option is to pass:
>> > -wsdlLocation ""
>> > (empty string) which with 2.1.3 I think will not generate the URL at
>> all.
>> > You would then need to do the getResource(...) thing yourself to find
>> the
>> > appropriate URL.
>> > 
>> > Dan
>> > 
>> > On Friday 31 October 2008 1:34:40 pm sreuland wrote:
>> >> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
>> >> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
>> >> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
>> >> Service class throws a MalFormed exception. The only way I've managed
>> to
>> >> get the URL() constructor to find my.wsdl is when i specify a 'file'
>> >> scheme
>> >> such as 'file:my.wsdl', then the URL constructor finds the file but it
>> >> has
>> >> to be relative to the starting directory of the jvm(not embedded in a
>> >> jar).
>> >> I figured if code generation in wsdl2java could recognize 'classpath:'
>> >> scheme in wsdlLocation param and generate url =
>> >> Service.class.getClassLoader().getResource("my.wsdl");  instead of try
>> {
>> >> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
>> >> runtime should find wsdl from classpath since java.net.URL constructor
>> >> won't.
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p27785376.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 02 March 2010 2:28:22 pm mindchi wrote:
> I have a question about this solution.
> I have a wsdl file which imports another wsdl file, which in turn imports
> an xsd file. I can do the getResource on the top level wsdl file, but will
> CXF be able to figure out where to get the other files, or will it just
> resort
> to the JVM start directory as before. It apparently goes to the JVM start
> directory for those other files.
> 
> Based on what I've tried so far, it looks like there's no way to get all of
> this working cleanly. That is, have everything packaged in a jar and
> accessed
> from there.

It SHOULD work.    I've been working with a couple people that are doing this 
and 2.2.6 does have a bunch of fixes in it to get there.   A good chunk of the 
problems is in JAXB.    I've had to hack around several bugs in JAXB to get it 
working, but the test cases I've been given now work with 2.2.6.
 
> Is this something that there should be a JIRA written up for?

If it's not working for you with 2.2.6, definitely file a JIRA and attach a 
test case.   Attaching the test case is important cause, as I said, the test 
cases other users have provided do work so I'd really need to see what you are 
doing differently.

Dan

> 
> Thanks.
> 
> 
> Thom --
> 
> dkulp wrote:
> > Oh.   Right.   Client side uses a URL and not a string.  Forgot about
> > that.   :-(
> > 
> > Yea, the only real option is to pass:
> > -wsdlLocation ""
> > (empty string) which with 2.1.3 I think will not generate the URL at all.
> > You would then need to do the getResource(...) thing yourself to find the
> > appropriate URL.
> > 
> > Dan
> > 
> > On Friday 31 October 2008 1:34:40 pm sreuland wrote:
> >> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> >> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> >> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> >> Service class throws a MalFormed exception. The only way I've managed to
> >> get the URL() constructor to find my.wsdl is when i specify a 'file'
> >> scheme
> >> such as 'file:my.wsdl', then the URL constructor finds the file but it
> >> has
> >> to be relative to the starting directory of the jvm(not embedded in a
> >> jar).
> >> I figured if code generation in wsdl2java could recognize 'classpath:'
> >> scheme in wsdlLocation param and generate url =
> >> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
> >> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
> >> runtime should find wsdl from classpath since java.net.URL constructor
> >> won't.

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

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by mindchi <tb...@acm.org>.
I have a question about this solution. 
I have a wsdl file which imports another wsdl file, which in turn imports
an xsd file. I can do the getResource on the top level wsdl file, but will
CXF be able to figure out where to get the other files, or will it just
resort
to the JVM start directory as before. It apparently goes to the JVM start 
directory for those other files.

Based on what I've tried so far, it looks like there's no way to get all of
this working cleanly. That is, have everything packaged in a jar and
accessed
from there.

Is this something that there should be a JIRA written up for?

Thanks.


Thom --


dkulp wrote:
> 
> 
> Oh.   Right.   Client side uses a URL and not a string.  Forgot about 
> that.   :-(
> 
> Yea, the only real option is to pass:
> -wsdlLocation "" 
> (empty string) which with 2.1.3 I think will not generate the URL at all.    
> You would then need to do the getResource(...) thing yourself to find the 
> appropriate URL.
> 
> Dan
> 
> 
> On Friday 31 October 2008 1:34:40 pm sreuland wrote:
>> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
>> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
>> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
>> Service class throws a MalFormed exception. The only way I've managed to
>> get the URL() constructor to find my.wsdl is when i specify a 'file'
>> scheme
>> such as 'file:my.wsdl', then the URL constructor finds the file but it
>> has
>> to be relative to the starting directory of the jvm(not embedded in a
>> jar).
>> I figured if code generation in wsdl2java could recognize 'classpath:'
>> scheme in wsdlLocation param and generate url =
>> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
>> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
>> runtime should find wsdl from classpath since java.net.URL constructor
>> won't.
> 
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 
> 

-- 
View this message in context: http://old.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p27760130.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Daniel Kulp <dk...@apache.org>.
Oh.   Right.   Client side uses a URL and not a string.  Forgot about 
that.   :-(

Yea, the only real option is to pass:
-wsdlLocation "" 
(empty string) which with 2.1.3 I think will not generate the URL at all.    
You would then need to do the getResource(...) thing yourself to find the 
appropriate URL.

Dan


On Friday 31 October 2008 1:34:40 pm sreuland wrote:
> Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
> 'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
> initializer url = new java.net.URL("classpath:my.wsdl");  in generated
> Service class throws a MalFormed exception. The only way I've managed to
> get the URL() constructor to find my.wsdl is when i specify a 'file' scheme
> such as 'file:my.wsdl', then the URL constructor finds the file but it has
> to be relative to the starting directory of the jvm(not embedded in a jar).
> I figured if code generation in wsdl2java could recognize 'classpath:'
> scheme in wsdlLocation param and generate url =
> Service.class.getClassLoader().getResource("my.wsdl");  instead of try {
> url = new URL("my.wsdl"); } catch (MalformedURLException e) { } then
> runtime should find wsdl from classpath since java.net.URL constructor
> won't.



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

Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by sreuland <sh...@ereuland.com>.
Hello Dan, thanks for reply, I've tried 'classpath:my.wsdl' or
'classpath:/my.wsdl' as wsdlLocation param to wsdl2java. The static
initializer url = new java.net.URL("classpath:my.wsdl");  in generated
Service class throws a MalFormed exception. The only way I've managed to get
the URL() constructor to find my.wsdl is when i specify a 'file' scheme such
as 'file:my.wsdl', then the URL constructor finds the file but it has to be
relative to the starting directory of the jvm(not embedded in a jar). I
figured if code generation in wsdl2java could recognize 'classpath:' scheme
in wsdlLocation param and generate url =
Service.class.getClassLoader().getResource("my.wsdl");  instead of try { url
= new URL("my.wsdl"); } catch (MalformedURLException e) { } then runtime
should find wsdl from classpath since java.net.URL constructor won't.
-- 
View this message in context: http://www.nabble.com/can-I-specify-classpath-for-wsdllocation-param-to-wsdl2java--tp20258375p20270757.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: can I specify classpath for wsdllocation param to wsdl2java?

Posted by Daniel Kulp <dk...@apache.org>.
When running wsdl2java, there is a -wsdlLocation param that can be used to 
specify exactly what gets embedded into the code.    Thus, ou can use the 
classpath url you specified.

Dan

On Thursday 30 October 2008 8:53:12 pm sreuland wrote:
> I've tried different uri forms and not having any luck. When the wsdl2java
> is run against a wsdl, the Service class that it generates has a static
> initializer for locating the wsdl file during runtime:
>
>  public final static URL WSDL_LOCATION;
>     public final static QName SERVICE = new
> QName("http://namespaces.stuff.my", "MyService");
>     public final static QName MyPort = new
> QName("http://namespaces.stuff.my", "MyPort");
>     ....
>     static {
>         URL url = null;
>         try {
>             url = new URL("my.wsdl");
>         } catch (MalformedURLException e) {
>             System.err.println("Can not initialize the default wsdl from
> my.wsdl");
>             // e.printStackTrace();
>         }
>         WSDL_LOCATION = url;
>     }
>
>
> I'm trying to avoid a published wsdl url on the web, the other option
> 'file:my.wsdl' does work but is causing maintenance issue as each client
> needs to place 'my.wsdl' in jvm's startup directory. Ideally I'd like to
> embed the wsdl as a resource in a jar and then reference it from classpath.
> Any possibility that wsdl2java could detect if a 'classpath:' scheme is
> present in wsdllocation parameter like 'classpath:my/stuff/my.wsdl' and
> then emit code like :
>
> static {
>         URL url = null;
>         try {
>             url = new
> MyService.class.getClassLoader().getResource("my/stuff/my.wsdl");
>         } catch (MalformedURLException e) {
>             System.err.println("Can not initialize the default wsdl from
> classpath for my/stuff/my.wsdl");
>             // e.printStackTrace();
>         }
>         WSDL_LOCATION = url;
>     }



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