You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2017/03/24 15:54:41 UTC

[jira] [Resolved] (CXF-6039) XML to Java Config of CXF Jaxws Endpoint

     [ https://issues.apache.org/jira/browse/CXF-6039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-6039.
------------------------------
       Resolution: Incomplete
    Fix Version/s: Invalid

Both of those methods should work with latest code.   Additionally, you could use the @MTOM and @SchemaValidation annotations on the impl.

> XML to Java Config of CXF Jaxws Endpoint
> ----------------------------------------
>
>                 Key: CXF-6039
>                 URL: https://issues.apache.org/jira/browse/CXF-6039
>             Project: CXF
>          Issue Type: Bug
>         Environment: Spring 3.2.8
> CXF 2.7.11
>            Reporter: Trilok
>             Fix For: Invalid
>
>
> I am Trying to convert XML configuration to java configuration for jaxws endpoint. XML configuration works fine. 
> I tried both ways to convert XML to java config. Either one is working. I am doing bit wise copy of XML to java.
> XML Configuation:
> 	 <jaxws:endpoint id="userService"
> 		implementor="com.example.components.userdata.ws.ImportUserEndpoint"
> 		address="/userService" xmlns:user="urn:example:wsdl:user:soap:v1" endpointName="user:userSoapServicePort" serviceName="user:userSoapServicePorts" wsdlLocation="classpath:/service/user-soap-v1.wsdl">
> 		<jaxws:properties>
> 			<entry key="schema-validation-enabled" value="true" />
> 		</jaxws:properties>
> 		<jaxws:binding>
> 			<soap:soapBinding mtomEnabled="true" version="1.2" />
> 		</jaxws:binding>
> 	</jaxws:endpoint> 
> First way using jaxwsEndpointImpl:
>         @Bean
> 	public ApplicationTransport applicationTransport() {
> 		return new ApplicationTransport();
> 	}
> 	@Bean
> 	@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
> 	public ImportUserEndpoint importUserEndpoint() {
> 		return new ImportUserEndpoint(applicationTransport());
> 	}
>         @Bean
> 	@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
> 	public Endpoint userService() {
> 		String namespaceURI = "urn:example:wsdl:user:soap:v1";
> 		QName endpointName = new QName(namespaceURI, "userSoapServicePort");
> 		QName serviceName = new QName(namespaceURI, "userSoapServicePorts");
> 		EndpointImpl Endpoint = new EndpointImpl(cxfBus, importUserEndpoint());
> 		Endpoint.setServiceName(serviceName);
> 		Endpoint.setEndpointName(endpointName);
> 		Endpoint.setWsdlLocation("classpath:/service/user-soap-v1.wsdl");
> 		Endpoint.setImplementorClass(ImportUserEndpoint.class);
> 		Endpoint.setBindingUri(SOAPBinding.SOAP12HTTP_MTOM_BINDING);
> 		Endpoint.setAddress("/userService1");
> 		Endpoint.publish();
> 		return Endpoint;
>         }
> Second way using JaxWSserverfactory:
>         @Bean
> 	public ApplicationTransport applicationTransport() {
> 		return new ApplicationTransport();
> 	}
> 	@Bean
> 	@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
> 	public ImportUserEndpoint importUserEndpoint() {
> 		return new ImportUserEndpoint(applicationTransport());
> 	}
>         @Bean
> 	@Scope(value = "request", proxyMode = ScopedProxyMode.TARGET_CLASS)
> 	public ImportUserEndpoint userService() {
> 		ImportUserEndpoint importUserEndpoint = importUserEndpoint();
> 		JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
> 		svrFactory.setServiceClass(UserService.class);//This is the service contract
> 		svrFactory.setServiceBean(importUserEndpoint);
> 		svrFactory.setAddress("/userService");
> 		svrFactory.create();
> 		return importUserEndpoint;
>         }



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)