You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Kashif Ahmed Qazi <ka...@etilizepak.com> on 2008/05/13 07:05:53 UTC

Name Space Conflicts in wsdl

I have developed webservice using Xfire . now I'm migrating my services 
to CXF. I'm facing
some issues please any one can help me to resolvc these issues.

I have  written Authentication code and tested it with other cxf service 
is working fine.
when i tried to migrate service from Xfire to CXF  then I'm facing some 
configuration issues. the service is generating the wsdl  given below 
but having tow different namespace in it.

wsdl:definitions targetNamespace="http://com.etilize.spexlive/account">
<wsdl:definitions name="AccountConsoleService" 
targetNamespace="*http://account.service.spexlive.etilize.com*/">
<wsdl:import location=*MailScanner has detected a possible fraud attempt 
from "localhost:8080" claiming to be* 
"http://localhost:8080/spexLiveWebService/soap/AccountConsoleService?wsdl=AccountManagementIntf.wsdl" 
namespace="*http://com.etilize.spexlive/account*">


*The tomcat console has the following errors.*

SEVERE: Schema element 
{http://com.etilize.spexlive/account}updateCompanyApplicationNameResponse 
references undefined type 
{http://com.etilize.spexlive/account}updateCompanyApplicationNameResponse 
for service 
{http://account.service.spexlive.etilize.com/}AccountConsoleService.
May 12, 2008 5:06:31 PM 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean 
fillInSchemaCrossreferences

Please find the attached service.xml cxf.xml and web.xml and generated 
wsdl file.

Can u help me  to resolve this issue.

also help me to write a java client to use the service I'm using Jaxb2 
data binding.


Regards,
Kashif Ahmed Qazi

Re: Name Space Conflicts in wsdl

Posted by Daniel Kulp <dk...@apache.org>.
The wsdl/namespace issue is per spec.

Check your @WebService annotation on the SEI interface and on the  
Service impl.   Specify the same targetNamespace on both annotations  
and it should work OK.   If either is missing, the code maps the  
package name to the namespace for the wsdl.

Getting the namespaces fixed up MIGHT fix the other issues, not really  
sure.   If not, a sample testcase would be great.

Dan


On May 13, 2008, at 1:05 AM, Kashif Ahmed Qazi wrote:

> I have developed webservice using Xfire . now I'm migrating my  
> services to CXF. I'm facing
> some issues please any one can help me to resolvc these issues.
>
> I have  written Authentication code and tested it with other cxf  
> service is working fine.
> when i tried to migrate service from Xfire to CXF  then I'm facing  
> some configuration issues. the service is generating the wsdl  given  
> below but having tow different namespace in it.
>
> wsdl:definitions targetNamespace="http://com.etilize.spexlive/ 
> account">
> <wsdl:definitions name="AccountConsoleService" targetNamespace="http://account.service.spexlive.etilize.com/ 
> ">
> <wsdl:import location=MailScanner has detected a possible fraud  
> attempt from "localhost:8080" claiming to be "http://localhost:8080/spexLiveWebService/soap/AccountConsoleService?wsdl=AccountManagementIntf.wsdl 
> " namespace="http://com.etilize.spexlive/account">
>
>
> The tomcat console has the following errors.
>
> SEVERE: Schema element {http://com.etilize.spexlive/ 
> account}updateCompanyApplicationNameResponse references undefined  
> type {http://com.etilize.spexlive/ 
> account}updateCompanyApplicationNameResponse for service {http://account.service.spexlive.etilize.com/ 
> }AccountConsoleService.
> May 12, 2008 5:06:31 PM  
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean  
> fillInSchemaCrossreferences
>
> Please find the attached service.xml cxf.xml and web.xml and  
> generated wsdl file.
>
> Can u help me  to resolve this issue.
>
> also help me to write a java client to use the service I'm using  
> Jaxb2 data binding.
>
>
> Regards,
> Kashif Ahmed Qazi
> <beans xmlns="http://www.springframework.org/schema/beans"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xmlns:jaxws="http://cxf.apache.org/jaxws"
>      xsi:schemaLocation="http://www.springframework.org/schema/beans
>                          http://www.springframework.org/schema/beans/spring-beans.xsd
>                          http://cxf.apache.org/jaxws
>                          http://cxf.apache.org/schemas/jaxws.xsd">
>
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>
>  <bean id="dataBinding" class="org.apache.cxf.jaxb.JAXBDataBinding"/>
>
>  <bean id="serviceFactory"  
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> 		<property name="dataBinding" ref="dataBinding" />
> 		<property name="serviceConfigurations">
> 			<list>
> 				<bean  
> class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration" />
> 				<bean  
> class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration" />
> 				<bean  
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration" />
> 			</list>
> 		</property>
> 	</bean>
>
>  <jaxws:endpoint id="AMService"
>                   
> implementor 
> ="com.etilize.spexlive.service.account.AccountManagementImpl"
>                  address="/AccountConsoleService">
>
>    <jaxws:schemaLocations>
> 		<jaxws:schemaLocation>
> 			classpath:META-INF/schema/account.xsd
> 		</jaxws:schemaLocation>
> 	</jaxws:schemaLocations>
> 	 <!--
> 	<jaxws:dataBinding>
>      <bean class="org.apache.cxf.jaxb.JAXBDataBinding">
>       <property name="contextProperties">
>    		<map>
>   			<entry>
>      			<key><value>com.sun.xml.bind.defaultNamespaceRemap</value></ 
> key>
>      			<value>uri:ultima:thule</value>
>   			</entry>
>      		</map>
>        </property>
>
>      </bean>
>
>      </jaxws:dataBinding>
>      -->
>      <jaxws:serviceFactory>
> 			<ref bean="serviceFactory" />
> 	 </jaxws:serviceFactory>
> 	<!--
>    <jaxws:inInterceptors>
>      <bean  
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
>      <bean  
> class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
>        <constructor-arg>
>          <map>
>            <entry key="action" value="UsernameToken" />
>            <entry key="passwordType" value="PasswordDigest" />
>            <entry key="passwordCallbackClass"  
> value 
> ="com.etilize.spexlive.service.security.ServerPasswordCallback" />
>          </map>
>        </constructor-arg>
>      </bean>
>    </jaxws:inInterceptors>
>     -->
>
>  </jaxws:endpoint>
>
> </beans>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_ID" version="2.4"
> 	xmlns="http://java.sun.com/xml/ns/j2ee"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd 
> ">
> 	<display-name>SpexLiveConsoleService</display-name>
> 	<welcome-file-list>
> 		<welcome-file>index.html</welcome-file>
> 		<welcome-file>index.htm</welcome-file>
> 		<welcome-file>index.jsp</welcome-file>
> 		<welcome-file>default.html</welcome-file>
> 		<welcome-file>default.htm</welcome-file>
> 		<welcome-file>default.jsp</welcome-file>
> 	</welcome-file-list>	
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 		<param-value>
> 			classpath:com/etilize/spexlive/service/cxf.xml			
> 		</param-value>
> 	</context-param>
> 	<listener>
> 		<listener-class>
> 			org.springframework.web.context.ContextLoaderListener
> 		</listener-class>
> 	</listener>
> 	<servlet>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<servlet-class>
> 			org.apache.cxf.transport.servlet.CXFServlet
> 		</servlet-class>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CXFServlet</servlet-name>
> 		<url-pattern>/soap/*</url-pattern>
> 	</servlet-mapping>
>
> </web-app>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xfire.codehaus.org/config/1.0">
> 	<!--
> 	<xfire>
> 		<inHandlers>
> 			<handler
> 				 
> handlerClass 
> ="com.etilize.spexlive.service.handler.AuthenticationHandler">
> 			</handler>
> 		</inHandlers>
> 	</xfire> -->
>
> 	<bean id="AccountManagementService"  
> class="com.etilize.spexlive.service.account.AccountManagementImpl" />
> 	
> 	<bean id="CatalogManagementService"  
> class="com.etilize.spexlive.service.catalog.CatalogManagementImpl" />
>
> 	<service>
> 		<serviceBean>#AccountManagementService</serviceBean>
> 		<serviceFactory>#jaxbServiceFactory</serviceFactory>
> 		<schemas>
> 			<schema>META-INF/schema/account.xsd</schema>
> 		</schemas>
> 		<style>document</style>
> 	</service>
> 	
> 	<service>
> 		<serviceBean>#CatalogManagementService</serviceBean>
> 		<serviceFactory>#jaxbServiceFactory</serviceFactory>
> 		<schemas>
> 			<schema>META-INF/schema/catalog.xsd</schema>
> 		</schemas>
> 		<style>document</style>
> 	</service>
>
> 	<bean name="jaxbServiceFactory"
> 		class="org.codehaus.xfire.jaxb2.JaxbServiceFactory">
> 		<constructor-arg ref="xfire.transportManager" />
> 	</bean>
> </beans>
> package com.etilize.spexlive.service.client;
>
> import java.util.HashMap;
> import java.util.Map;
>
> import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
> import org.apache.cxf.interceptor.LoggingInInterceptor;
> import org.apache.cxf.interceptor.LoggingOutInterceptor;
> import org.apache.cxf.jaxb.JAXBDataBinding;
> import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
> import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
> import org.apache.ws.security.WSConstants;
> import org.apache.ws.security.handler.WSHandlerConstants;
> import com.etilize.spexlive.service.account.AccountManagement;
> import  
> com.etilize.spexlive.service.account.data.ActivateAdministrator;
> import com.etilize.spexlive.service.account.data.GetUserList;
> import com.etilize.spexlive.service.account.data.UserList;
>
> public final class Client {
>
>    private Client() {
>    }
>
>    public static void main(String args[]) throws Exception {
>
>    	/*
>    	 * //JaxbServiceFactory serviceFactory=new JaxbServiceFactory()
>        Service serviceModel = new ObjectServiceFactory(new  
> AegisBindingProvider(new  
> JaxbTypeRegistry 
> ())).create(AccountManagement.class,null,version_ns,props);
>    	
>
>    	 */
>    	
>    	JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>
>    	
>    	
>    	factory.setDataBinding(new JAXBDataBinding());
>    	
>    		factory.setServiceClass(AccountManagement.class);
>    		 
> System 
> .out.println("*************************************************");
>    	
>    	factory.setAddress("http://localhost:8080/spexLiveWebService/soap/AccountConsoleService 
> ");
>    	AccountManagement service = (AccountManagement)  
> factory.create();    	
>    	
>    	System.out.println("Starting Client...");
> 		GetUserList requestList = new GetUserList();
>        requestList.setUserId(111);
>        requestList.setCompanyId(343);
>        ActivateAdministrator ad= new ActivateAdministrator();
>        ad.setAdministratorId(1);
>        ad.setUserId(1);
>         
> System.out.println("Activate:"+service.activateAdministrator(ad));
>        UserList list=service.getUserList(requestList);
>        System.out.println("User List"+list.getCount());
>        System.out.println("Exiting Client.");
>    	
>    	
>    	
>    	
>    	
>    	
>    	//System.exit(0);
>
>    }
>
> }

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