You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Bence Takács (JIRA)" <ji...@apache.org> on 2014/08/13 14:20:12 UTC

[jira] [Comment Edited] (CXF-5942) Non-blocking WS call with CXF

    [ https://issues.apache.org/jira/browse/CXF-5942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14095239#comment-14095239 ] 

Bence Takács edited comment on CXF-5942 at 8/13/14 12:18 PM:
-------------------------------------------------------------

Actually I added the '_' because I thought it is missing ;-)
The code did not work with or without that.

I tried to generate the code from wsdl but it throws a weird exception:
{noformat}
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
Unexpected argument: file:/D:/.../src/main/resources/quote-reporter.wsdl

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Usage : wsdl2java ...
{noformat}

Without the '-asyncMethods' everything is fine: the classes are generated.

Using the following code:
{code}
<execution>
	<id>generate-sources</id>
	<phase>generate-sources</phase>
	<configuration>
		<sourceRoot>${project.build.directory}/generated/mywebservice</sourceRoot>
		<wsdlOptions>
			<wsdlOption>
				<wsdl>${basedir}/src/main/resources/quote-reporter.wsdl</wsdl>
				<extraargs>
					<extraarg>-p</extraarg>
					<extraarg>com.gen</extraarg>
					<extraarg>-impl</extraarg>
					<extraarg>-verbose</extraarg>
					<extraarg>-asyncMethods</extraarg>
					<extraarg>http://localhost:8080/sample-ws-cxf/SampleWebService?wsdl </extraarg>
				</extraargs>
			</wsdlOption>
		</wsdlOptions>
	</configuration>
	<goals>
		<goal>wsdl2java</goal>
	</goals>
</execution>
{code}

I also tried to add dependencies:
{code}
<dependencies>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-frontend-jaxws</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-frontend-simple</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-transports-http-hc</artifactId>
		<version>${cxf.version}</version>
	</dependency>
</dependencies>
{code}

The same issue with downloaded sample wsdl and updated cxf version 2.7.12


was (Author: bence.takacs):
Actually I added the '_' because I thought it is missing ;-)
The code did not work with or without that.

I tried to generate the code from wsdl but it throws a weird exception:
{noformat}
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
Unexpected argument: file:/D:/.../src/main/resources/quote-reporter.wsdl

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
Usage : wsdl2java ...
{noformat}

Without the '-asyncMethods' everything is fine: the classes are generated.

Using the following code:
{code}
<execution>
	<id>generate-sources</id>
	<phase>generate-sources</phase>
	<configuration>
		<sourceRoot>${project.build.directory}/generated/mywebservice</sourceRoot>
		<wsdlOptions>
			<wsdlOption>
				<wsdl>${basedir}/src/main/resources/quote-reporter.wsdl</wsdl>
				<extraargs>
					<extraarg>-p</extraarg>
					<extraarg>com.gen</extraarg>
					<extraarg>-impl</extraarg>
					<extraarg>-verbose</extraarg>
					<extraarg>-asyncMethods</extraarg>
					<extraarg>http://localhost:8080/sample-ws-cxf/SampleWebService?wsdl </extraarg>
				</extraargs>
			</wsdlOption>
		</wsdlOptions>
	</configuration>
	<goals>
		<goal>wsdl2java</goal>
	</goals>
</execution>
{code}

I also tried to add dependencies:
{code}
<dependencies>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-frontend-jaxws</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-frontend-simple</artifactId>
		<version>${cxf.version}</version>
	</dependency>
	<dependency>
		<groupId>org.apache.cxf</groupId>
		<artifactId>cxf-rt-transports-http-hc</artifactId>
		<version>${cxf.version}</version>
	</dependency>
</dependencies>
{code}

> Non-blocking WS call with CXF
> -----------------------------
>
>                 Key: CXF-5942
>                 URL: https://issues.apache.org/jira/browse/CXF-5942
>             Project: CXF
>          Issue Type: Wish
>          Components: Transports
>    Affects Versions: 3.0.0-milestone1
>            Reporter: Bence Takács
>            Priority: Minor
>              Labels: non-blocking
>
> It is not clear which are the use cases when one can use asynchronous client calls. The possible use cases would be:
> - server-side implemented callback transport
> - server-side implemented polling transport
> - client-side only callback using non-blocking IO
> However http.asyncclient supports all of them, I see no sign of CXF supporting the last one. Is there a way of calling a server this way?
> Using the configuration below I tried to call a WS this way, but CXF is always looking for async binding on the server side (javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method getDataFromWebService_Async). 
> Client configuration:
> {quote}
> <jaxws:client id="client"
>     serviceClass="my.sample.SampleWebService"
>     address="http://localhost:8080/sample-ws-cxf/SampleWebService">
>     <jaxws:properties>
>         <entry key="javax.xml.ws.client.connectionTimeout" value="10" />
>         <entry key="javax.xml.ws.client.receiveTimeout" value="11000" />
>         <entry key="org.apache.cxf.transport.http.async.usePolicy" value="ALWAYS" />
>         <entry key="org.apache.cxf.transport.http.async.ioThreadCount" value="2" /> 
>     </jaxws:properties>
> </jaxws:client>
> {quote}
> code:
> {quote}{noformat}
> client.getDataFromWebService_Async("" + id.getAndIncrement(), new AsyncHandler<Person>() {
>     @Override
>     public void handleResponse(Response<Person> resp) {
>         Person person;
>         try {
>             person = resp.get();
>             ...
>         } catch (InterruptedException | ExecutionException e) {
>             ...
>         }
>     }
> });
> {noformat}{quote}
> If I log out the conduit, it tells that it is: org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit ( log.info(ClientProxy.getClient(client).getConduit().getClass().getName()); )
> I'm using cxf 3.0.1, and httpasyncclient version 4.0.1 with spring 3.2.2.RELEASE



--
This message was sent by Atlassian JIRA
(v6.2#6252)