You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "pawel.jasinski" <pa...@gmail.com> on 2008/09/09 15:03:28 UTC

maven cxf-codegen plugin - wsdl2java lost arguments

hi,

i am unable to pass correctly arguments from pom.xml to wsdl2java
codegenerator
The relevant pom.xml part:

 <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf-version}</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <sourceRoot> ${basedir}/target/generated </sourceRoot>
              <wsdlOptions>
                <wsdlOption>
                 
<wsdl>${basedir}/src/main/resources/wsdl/subscribe_v1_0.wsdl</wsdl>
                  <extraargs>
                    <extraarg>-client</extraarg>
                    <extraarg>-server</extraarg>
                    <extraarg>-verbose</extraarg>
                    <extraarg>-b</extraarg>
                   
<extraarg>${basedir}/src/main/resources/wsdl/subscribe-binding.xml</extraarg>
                  </extraargs>
                </wsdlOption>
              </wsdlOptions>
            </configuration>
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

The client, server and binding option disappear.
When invoke with mvn -X I can get the following:

[DEBUG] Configuring mojo 'org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java'
-->
[DEBUG]   (f) classesDirectory = /home/rejap/w34/didatu.esb/target/classes
[DEBUG]   (f) markerDirectory =
/home/rejap/w34/didatu.esb/target/cxf-codegen-plugin-markers
[DEBUG]   (f) project = MavenProject: com.ruag.poc:didatu.esb:0.0.1-SNAPSHOT
@ /home/rejap/w34/didatu.esb/pom.xml
[DEBUG]   (f) sourceRoot = /home/rejap/w34/didatu.esb/target/generated
[DEBUG]   (f) testWsdlRoot =
/home/rejap/w34/didatu.esb/src/test/resources/wsdl
[DEBUG]   (f) useCompileClasspath = false
[DEBUG]   (s) wsdl =
/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl
[DEBUG]   (s) extraargs = [-client, -server, -verbose, -b,
/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe-binding.xml]
[DEBUG]   (f) wsdlOptions =
[Lorg.apache.cxf.maven_plugin.WsdlOption;@13a0212
[DEBUG]   (f) wsdlRoot = /home/rejap/w34/didatu.esb/src/main/resources/wsdl
[DEBUG] -- end configuration --
[INFO] [cxf-codegen:wsdl2java {execution: generate-sources}]
[DEBUG] Calling wsdl2java with args: [-verbose, -d,
/home/rejap/w34/didatu.esb/target/generated,
file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl]
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -verbose -d /home/rejap/w34/didatu.esb/target/generated
file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl
wsdl2java - Apache CXF 2.1.2

I also tried to change cxf version to 2.1, the problem persist.
Version 2.0.8 appears to do the job.

Can anybody see any fundamental problem with my pom file?
Can I mix code from code-gen 2.0.8 with the cxf 2.1.1 or cxf 2.1.2?


Thanks
Pawel




-- 
View this message in context: http://www.nabble.com/maven-cxf-codegen-plugin---wsdl2java-lost-arguments-tp19391891p19391891.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: maven cxf-codegen plugin - wsdl2java lost arguments

Posted by Daniel Kulp <dk...@apache.org>.
I see the problem in the code.   :-(

You can workaround it with:
<configuration>
   <sourceRoot> ${basedir}/target/generated </sourceRoot>
   <defaultOptions>
       <options>
            <extraargs>
            <extraarg>-client</extraarg>
            <extraarg>-server</extraarg>
            <extraarg>-verbose</extraarg>
            <extraarg>-b</extraarg>
 <extraarg>${basedir}/src/main/resources/wsdl/subscribe-binding.xml</extraarg>
            </extraargs>
         </option>
</defaultOptions>
</configuration>

I'll get a fix committed for 2.1.3-SNAPSHOT.

Dan



On Tuesday 09 September 2008 9:03:28 am pawel.jasinski wrote:
> hi,
>
> i am unable to pass correctly arguments from pom.xml to wsdl2java
> codegenerator
> The relevant pom.xml part:
>
>  <plugin>
>         <groupId>org.apache.cxf</groupId>
>         <artifactId>cxf-codegen-plugin</artifactId>
>         <version>${cxf-version}</version>
>         <executions>
>           <execution>
>             <id>generate-sources</id>
>             <phase>generate-sources</phase>
>             <configuration>
>               <sourceRoot> ${basedir}/target/generated </sourceRoot>
>               <wsdlOptions>
>                 <wsdlOption>
>
> <wsdl>${basedir}/src/main/resources/wsdl/subscribe_v1_0.wsdl</wsdl>
>                   <extraargs>
>                     <extraarg>-client</extraarg>
>                     <extraarg>-server</extraarg>
>                     <extraarg>-verbose</extraarg>
>                     <extraarg>-b</extraarg>
>
> <extraarg>${basedir}/src/main/resources/wsdl/subscribe-binding.xml</extraar
>g> </extraargs>
>                 </wsdlOption>
>               </wsdlOptions>
>             </configuration>
>             <goals>
>               <goal>wsdl2java</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
> The client, server and binding option disappear.
> When invoke with mvn -X I can get the following:
>
> [DEBUG] Configuring mojo
> 'org.apache.cxf:cxf-codegen-plugin:2.1.2:wsdl2java' -->
> [DEBUG]   (f) classesDirectory = /home/rejap/w34/didatu.esb/target/classes
> [DEBUG]   (f) markerDirectory =
> /home/rejap/w34/didatu.esb/target/cxf-codegen-plugin-markers
> [DEBUG]   (f) project = MavenProject:
> com.ruag.poc:didatu.esb:0.0.1-SNAPSHOT @ /home/rejap/w34/didatu.esb/pom.xml
> [DEBUG]   (f) sourceRoot = /home/rejap/w34/didatu.esb/target/generated
> [DEBUG]   (f) testWsdlRoot =
> /home/rejap/w34/didatu.esb/src/test/resources/wsdl
> [DEBUG]   (f) useCompileClasspath = false
> [DEBUG]   (s) wsdl =
> /home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl
> [DEBUG]   (s) extraargs = [-client, -server, -verbose, -b,
> /home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe-binding.xml]
> [DEBUG]   (f) wsdlOptions =
> [Lorg.apache.cxf.maven_plugin.WsdlOption;@13a0212
> [DEBUG]   (f) wsdlRoot = /home/rejap/w34/didatu.esb/src/main/resources/wsdl
> [DEBUG] -- end configuration --
> [INFO] [cxf-codegen:wsdl2java {execution: generate-sources}]
> [DEBUG] Calling wsdl2java with args: [-verbose, -d,
> /home/rejap/w34/didatu.esb/target/generated,
> file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl
>] Loading FrontEnd jaxws ...
> Loading DataBinding jaxb ...
> wsdl2java -verbose -d /home/rejap/w34/didatu.esb/target/generated
> file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl
> wsdl2java - Apache CXF 2.1.2
>
> I also tried to change cxf version to 2.1, the problem persist.
> Version 2.0.8 appears to do the job.
>
> Can anybody see any fundamental problem with my pom file?
> Can I mix code from code-gen 2.0.8 with the cxf 2.1.1 or cxf 2.1.2?
>
>
> Thanks
> Pawel



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

Re: accessing ServletContext from within @WebMethod

Posted by Marc Logemann <ml...@logemann.org>.
Hi,

thanks folks, i just discovered it too and wanted to post this and ask  
if this is correct (which is of course)

     @Resource
     private WebServiceContext context;

     public void submitOrder(Order order) {

         MessageContext messageContext = context.getMessageContext();
         ServletContext servletContext =  
(ServletContext 
)messageContext.get(AbstractHTTPDestination.HTTP_CONTEXT);

:)

But of course i am using Spring and i was not aware that i can use  
ServletContextAware, which makes it even easier.

Thanks again for quick response and yeah, i could have seen this  
myself in the docs but i have my very own problems with the CXF docs,  
because they are quite ... ahmmmm..... fragmented :)


--
Marc Logemann
blog http://logemannreloaded.blogspot.com
privat http://www.logemann.org



Am 09.09.2008 um 18:16 schrieb Ian Roberts:

> Marc Logemann wrote:
>> Hi,
>>
>> in a webservice i need to get hold of an ServletContext because i  
>> need
>> to load some resources for BIRT eclipse reporting.
>> Is this possible somehow?
>
> If you're creating your implementation object using Spring then the
> easiest way is to implement the ServletContextAware interface and  
> Spring
> will inject it for you by calling setServletContext.  Alternatively,  
> you
> can get a reference to the servlet context via the WebServiceContext
> (this may only work during calls to your web service operations, if  
> you
> need access to the context before any of your WS methods have been
> called, use ServletContextAware).
>
> @Resource
> private WebServiceContext ctx;
>
> public String webServiceOperation(....) {
>  ServletContext sctx =
>     ctx.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
>  ...
> }
>
> Ian
>
> -- 
> Ian Roberts               | Department of Computer Science
> i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK
>


Re: accessing ServletContext from within @WebMethod

Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
Marc Logemann wrote:
> Hi,
> 
> in a webservice i need to get hold of an ServletContext because i need
> to load some resources for BIRT eclipse reporting.
> Is this possible somehow?

If you're creating your implementation object using Spring then the
easiest way is to implement the ServletContextAware interface and Spring
will inject it for you by calling setServletContext.  Alternatively, you
can get a reference to the servlet context via the WebServiceContext
(this may only work during calls to your web service operations, if you
need access to the context before any of your WS methods have been
called, use ServletContextAware).

@Resource
private WebServiceContext ctx;

public String webServiceOperation(....) {
  ServletContext sctx =
     ctx.getMessageContext().get(MessageContext.SERVLET_CONTEXT);
  ...
}

Ian

-- 
Ian Roberts               | Department of Computer Science
i.roberts@dcs.shef.ac.uk  | University of Sheffield, UK

accessing ServletContext from within @WebMethod

Posted by Marc Logemann <ml...@logemann.org>.
Hi,

in a webservice i need to get hold of an ServletContext because i need  
to load some resources for BIRT eclipse reporting.
Is this possible somehow?

--
Marc Logemann
blog http://logemannreloaded.blogspot.com
privat http://www.logemann.org

Re: maven cxf-codegen plugin - wsdl2java lost arguments

Posted by "pawel.jasinski" <pa...@gmail.com>.
hi,

the cli is my work around for the problem, here is what I get:

rejap@rzuem5008u:~/w34/didatu.esb$ ~/java/apache-cxf-2.1.2/bin/wsdl2java -d
target/generated -client -server -verbose -b
src/main/resources/wsdl/subscribe-binding.xml
src/main/resources/wsdl/subscribe_v1_0.wsdl 
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -d target/generated -client -server -verbose -b
src/main/resources/wsdl/subscribe-binding.xml
src/main/resources/wsdl/subscribe_v1_0.wsdl
wsdl2java - Apache CXF 2.1.2

rejap@rzuem5008u:~/w34/didatu.esb$ find target
target
target/generated
target/generated/com
target/generated/com/ruag
target/generated/com/ruag/poc
target/generated/com/ruag/poc/didatu
target/generated/com/ruag/poc/didatu/subscribe
target/generated/com/ruag/poc/didatu/subscribe/v1
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe.java
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe_Service.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types
target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPostNoType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/package-info.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPosNoResponseType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/MessageType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/ObjectFactory.java
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe_SubscribeSOAP_Server.java
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe_SubscribeSOAP_Client.java


BTW, I use client and server as demonstration of the argument passing
problem. The real problem is that I can not supply binding argument.

Pawel
-- 
View this message in context: http://www.nabble.com/maven-cxf-codegen-plugin---wsdl2java-lost-arguments-tp19391891p19393865.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: maven cxf-codegen plugin - wsdl2java lost arguments

Posted by Glen Mazza <gl...@gmail.com>.
I don't believe you'll get anything that ends with Client and Server, but may
be wrong here.  What happens if you issue the same command from the command
line?

Glen


pawel.jasinski wrote:
> 
> Glen,
> 
> I execute "mvn -X clean generate-sources", than I look into target folder.
> I expect something what ends with Client and Server, here is what I got
> 
> rejap@rzuem5008u:~/w34/didatu.esb$ find target
> target
> target/generated
> target/generated/com
> target/generated/com/ruag
> target/generated/com/ruag/poc
> target/generated/com/ruag/poc/didatu
> target/generated/com/ruag/poc/didatu/subscribe
> target/generated/com/ruag/poc/didatu/subscribe/v1
> target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe_Service.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/types
> target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPostNoType.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/types/package-info.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPosNoResponseType.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/types/MessageType.java
> target/generated/com/ruag/poc/didatu/subscribe/v1/types/ObjectFactory.java
> target/cxf-codegen-plugin-markers
> target/cxf-codegen-plugin-markers/.src_main_resources_wsdl_subscribe_v1_0.wsdl.DONE
> target/classes
> 
> This line:
> [DEBUG]   (s) extraargs = [-client, -server, -verbose, -b,
> /home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe-binding.xml]
> 
> is followed by:
> 
> wsdl2java -verbose -d /home/rejap/w34/didatu.esb/target/generated
> file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl 
> 
> which should have all the arguments again. I believe -verbose comes from
> -X on maven (I may be wrong).
> 
> Pawel
> 

-- 
View this message in context: http://www.nabble.com/maven-cxf-codegen-plugin---wsdl2java-lost-arguments-tp19391891p19393642.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: maven cxf-codegen plugin - wsdl2java lost arguments

Posted by "pawel.jasinski" <pa...@gmail.com>.
Glen,

I execute "mvn -X clean generate-sources", than I look into target folder.
I expect something what ends with Client and Server, here is what I got

rejap@rzuem5008u:~/w34/didatu.esb$ find target
target
target/generated
target/generated/com
target/generated/com/ruag
target/generated/com/ruag/poc
target/generated/com/ruag/poc/didatu
target/generated/com/ruag/poc/didatu/subscribe
target/generated/com/ruag/poc/didatu/subscribe/v1
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe.java
target/generated/com/ruag/poc/didatu/subscribe/v1/Subscribe_Service.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types
target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPostNoType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/package-info.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/SubscribeByPosNoResponseType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/MessageType.java
target/generated/com/ruag/poc/didatu/subscribe/v1/types/ObjectFactory.java
target/cxf-codegen-plugin-markers
target/cxf-codegen-plugin-markers/.src_main_resources_wsdl_subscribe_v1_0.wsdl.DONE
target/classes

This line:
[DEBUG]   (s) extraargs = [-client, -server, -verbose, -b,
/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe-binding.xml]

is followed by:

wsdl2java -verbose -d /home/rejap/w34/didatu.esb/target/generated
file:/home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe_v1_0.wsdl 

which should have all the arguments again. I believe -verbose comes from -X
on maven (I may be wrong).

Pawel
-- 
View this message in context: http://www.nabble.com/maven-cxf-codegen-plugin---wsdl2java-lost-arguments-tp19391891p19392351.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: maven cxf-codegen plugin - wsdl2java lost arguments

Posted by Glen Mazza <gl...@gmail.com>.

pawel.jasinski wrote:
> 
> The client, server and binding option disappear.
> When invoke with mvn -X I can get the following:
> 
> [DEBUG]   (s) extraargs = [-client, -server, -verbose, -b,
> /home/rejap/w34/didatu.esb/src/main/resources/wsdl/subscribe-binding.xml]
> 

No, they seem to be there.  Are you sure there's a problem?  BTW, I think
-server is on by default, so you may not need that option.

Glen

-- 
View this message in context: http://www.nabble.com/maven-cxf-codegen-plugin---wsdl2java-lost-arguments-tp19391891p19391976.html
Sent from the cxf-user mailing list archive at Nabble.com.