I would personally generate your objects outside of the IDE (using Maven at a command line) and just use the IDE as a text editor instead. You're introducing extra sources for error using the IDE. (For example, the only import in your cxf-beans.xml AFAIK should just be <import resource="classpath:META-INF/cxf/cxf.xml" />.) I don't know what is generating your project below (it looks like something more than just CXF--those source files like the web.xml look unfamilar to me), you may have a question for that project, not for CXF.

Glen

On 03/13/2013 03:47 PM, newbie wrote:
STS is a spring source tool suite, an eclipse IDE. I am using the approach of
generating the WSDL from java class.
The example provided doesnt require WSDL generation.

When i say createWebservice through IDE, it runs the following in my console
-

INFO: Creating Service {http://hello.demo/}HelloWorldService from class
demo.hello.HelloWorld
java2ws -cp
C:\Java\springsource\mywebservice-workspace-sts-3.1.0.RELEASE\HelloWorldApp\target\classes
-s
C:\Java\springsource\mywebservice-workspace-sts-3.1.0.RELEASE\HelloWorldApp\.cxftmp/src
-d
C:\Java\springsource\mywebservice-workspace-sts-3.1.0.RELEASE\HelloWorldApp\.cxftmp/wsdl
-classdir
C:\Java\springsource\mywebservice-workspace-sts-3.1.0.RELEASE\HelloWorldApp\target\classes
-o helloworld.wsdl -verbose -frontend jaxws -databinding jaxb -wsdl
-wrapperbean demo.hello.HelloWorld
java2ws - Apache CXF 2.7.3

Mar 13, 2013 2:38:48 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://hello.demo/}HelloWorldService from class
demo.hello.HelloWorld

Hence annotates my code with jaxws.

package demo.hello;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(targetNamespace = "http://hello.demo/";, portName =
"HelloWorldPort", serviceName = "HelloWorldService")
public class HelloWorld {

        @WebMethod(operationName = "getNameToDisplayHelloWorld", action =
"urn:GetNameToDisplayHelloWorld")
        public String getNameToDisplayHelloWorld(@WebParam(name = "arg0") String
name) {
                return "Hello World ".concat(name);
        }

}

Adds CXF servlet entry into my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
        version="3.0">
        <display-name>HelloWorldApp</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>
        <servlet>
                <description>Apache CXF Endpoint</description>
                <display-name>cxf</display-name>
                <servlet-name>cxf</servlet-name>
                
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>cxf</servlet-name>
                <url-pattern>/services/*</url-pattern>
        </servlet-mapping>
        <session-config>
                <session-timeout>60</session-timeout>
        </session-config>
        <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>WEB-INF/cxf-beans.xml</param-value>
        </context-param>
        <listener>
        
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
</web-app>

generates cxf-beans.xml, which contains my jax:endpoint

<?xml version="1.0" encoding="UTF-8"?>
<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-2.5.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" />
        <jaxws:endpoint xmlns:tns="http://hello.demo/"; id="helloworld"
                implementor="demo.hello.HelloWorld" 
wsdlLocation="wsdl/helloworld.wsdl"
                endpointName="tns:HelloWorldPort" 
serviceName="tns:HelloWorldService"
                address="/HelloWorldPort">
                <jaxws:features>
                        <bean class="org.apache.cxf.feature.LoggingFeature" />
                </jaxws:features>
        </jaxws:endpoint>
</beans>

WSDL generated is located in wsdl folder

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="HelloWorldService"
targetNamespace="http://hello.demo/";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:tns="http://hello.demo/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
   <wsdl:types>
<xs:schema elementFormDefault="unqualified"
targetNamespace="http://hello.demo/"; version="1.0"
xmlns:tns="http://hello.demo/"; xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xs:element name="getNameToDisplayHelloWorld"
type="tns:getNameToDisplayHelloWorld"/>
<xs:element name="getNameToDisplayHelloWorldResponse"
type="tns:getNameToDisplayHelloWorldResponse"/>
<xs:complexType name="getNameToDisplayHelloWorld">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getNameToDisplayHelloWorldResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
   </wsdl:types>
   <wsdl:message name="getNameToDisplayHelloWorldResponse">
     <wsdl:part name="parameters"
element="tns:getNameToDisplayHelloWorldResponse">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="getNameToDisplayHelloWorld">
     <wsdl:part name="parameters" element="tns:getNameToDisplayHelloWorld">
     </wsdl:part>
   </wsdl:message>
   <wsdl:portType name="HelloWorld">
     <wsdl:operation name="getNameToDisplayHelloWorld">
       <wsdl:input name="getNameToDisplayHelloWorld"
message="tns:getNameToDisplayHelloWorld">
     </wsdl:input>
       <wsdl:output name="getNameToDisplayHelloWorldResponse"
message="tns:getNameToDisplayHelloWorldResponse">
     </wsdl:output>
     </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="HelloWorldServiceSoapBinding" type="tns:HelloWorld">
     <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
     <wsdl:operation name="getNameToDisplayHelloWorld">
       <soap:operation soapAction="urn:GetNameToDisplayHelloWorld"
style="document"/>
       <wsdl:input name="getNameToDisplayHelloWorld">
         <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="getNameToDisplayHelloWorldResponse">
         <soap:body use="literal"/>
       </wsdl:output>
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HelloWorldService">
     <wsdl:port name="HelloWorldPort"
binding="tns:HelloWorldServiceSoapBinding">
       <soap:address location="http://localhost:9090/HelloWorldPort"/>
     </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

Every thing looks good, works fine with apache cxf 2.4.2. But fails in
2.7.... with above posted error.

Do we really need cxf.xml, cxf-servlet.xml, cxf-soap-extension.xml..??
Imports are failing even cxf-beans.xml is failing with xmlparse schema not
found error after loading itself.







--
View this message in context: 
http://cxf.547215.n5.nabble.com/Developing-Apache-CXF-JAXWS-webservice-getting-error-cant-resolve-help-required-tp5724527p5724530.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to