I am doing WSDL-first development and still having problems with
defining my schema in a separate XSD file.  If I put it in a separate
file, I get an error upon deployment like:

org.codehaus.xfire.XFireRuntimeException: Couldn't find schema part:
{http://example.com/calculator/types}simpleAddition

If I embed the schema in my WSDL then everything appears to work fine.
I would really prefer to keep the schema external though.  The relevant
files are pasted below.  Thanks for any help you can give!

-Chris

========= CALC.WSDL ==========

<?xml version="1.0" ?>
<wsdl:definitions 
        name="Calculator"
        targetNamespace="http://example.com/calculator";
        xmlns:tns="http://example.com/calculator";
        xmlns:types="http://example.com/calculator/types";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
            
        <wsdl:types>
                <xsd:schema>
                        <xsd:import
namespace="http://example.com/calculator/types";
schemaLocation="calc.xsd"/>
                </xsd:schema>
        </wsdl:types>
    
        <wsdl:message name="simpleAdditionRequest">
                <wsdl:part name="body" element="types:simpleAddition"/>
        </wsdl:message> 
        <wsdl:message name="simpleAdditionResponse">
                <wsdl:part name="body"
element="types:simpleAdditionResponse"/>
        </wsdl:message>
    <wsdl:message name="CalculatorFault">
                <wsdl:part name="fault"
element="types:CalculatorFault"/>
        </wsdl:message>
        
    <wsdl:portType name="CalculatorPortType">
        <wsdl:operation name="simpleAddition">
                        <wsdl:input message="tns:simpleAdditionRequest"
/>
                        <wsdl:output
message="tns:simpleAdditionResponse" />
            <wsdl:fault name="CalculatorFault"
message="tns:CalculatorFault"/>
                </wsdl:operation>
        </wsdl:portType>
    
        <wsdl:binding name="CalculatorPortBinding"
type="tns:CalculatorPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http";
style="document"/>
        <wsdl:operation name="simpleAddition">
            <soap:operation action=""/>
                        <wsdl:input>
                                <soap:body use="literal"/>
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="literal"/>
                        </wsdl:output>
            <wsdl:fault name="CalculatorFault">
                <soap:fault name="CalculatorFault" use="literal" />
            </wsdl:fault>
                </wsdl:operation>
        </wsdl:binding>
    
        <wsdl:service name="Calculator">
                <wsdl:port name="CalculatorPort"
binding="tns:CalculatorPortBinding">
                        <soap:address
location="http://localhost:8080/calculator/services/Calculator"/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>



======= CALC.XSD ========

<?xml version="1.0" ?>
<xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema";
        targetNamespace="http://example.com/calculator/types";
        xmlns:tns="http://example.com/calculator/types";
        version="1.0">
               
    <xs:element name="simpleAddition">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="int1" type="xs:int"/>
                <xs:element name="int2" type="xs:int"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
        <xs:element name="simpleAdditionResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="sum" type="xs:int"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <xs:element name="CalculatorFault">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="errorCode" type="xs:int" />
                <xs:element name="message" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
</xs:schema>



======= APPLICATIONCONTEXT.XML =========

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
      
         <import
resource="classpath:org/codehaus/xfire/spring/xfire.xml" />

        <bean name="calculatorWebService"
class="org.codehaus.xfire.spring.remoting.XFireExporter">
                <property name="serviceBean">
                        <bean
class="com.example.calculator.impl.SimpleCalculatorService" />
                </property>

                <property name="serviceClass"
        
value="com.example.calculator.impl.SimpleCalculatorService" />
                <property name="serviceFactory">
                        <ref bean="xfire.jaxwsServiceFactory" />
                </property>
        <property name="wsdlURL" value="calc.wsdl"/>
        </bean>

        <bean name="xfire.jaxwsServiceFactory"
                class="org.codehaus.xfire.jaxws.JAXWSServiceFactory">
                <constructor-arg index="0">
                        <ref bean="xfire.transportManager" />
                </constructor-arg>
        </bean>    
</beans>



======== WEB.XML ===========

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app 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";
    version="2.4">
    
  <description>Calculator Service</description>
  <display-name>Calculator Web Service</display-name>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext*.xml</param-value>
  </context-param>

  <listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</l
istener-class>
  </listener>

  <servlet>
    <servlet-name>XFireServlet</servlet-name>
    <servlet-class>
        org.codehaus.xfire.spring.XFireSpringServlet
    </servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>XFireServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
  
 
<welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-
list>
  
</web-app>


======== WSGEN USAGE IN BUILD.XML ==========

<wsgen 
    outputDirectory="${gen-src}"
    wsdl="${wsdl.dir}/calc.wsdl" 
    package="com.example.calculator"
    externalbindings="${wsdl.dir}/custom-schema.xml"
    overwrite="true" />



======== SimpleCalculatorService.java ==========

package com.example.calculator.impl;

import javax.jws.WebService;

import com.example.calculator.CalculatorFault;
import com.example.calculator.CalculatorPortType;

@WebService(serviceName = "Calculator", 
            targetNamespace = "http://example.com/calculator";, 
            endpointInterface =
"com.example.calculator.CalculatorPortType")
public class SimpleCalculatorService implements CalculatorPortType {

    public int simpleAddition(int int1, int int2) throws CalculatorFault
{
        return int1 + int2;
    }

}


-----Original Message-----
From: Dan Diephouse [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 08, 2007 9:53 AM
To: [email protected]
Subject: Re: [xfire-user] XFireRuntimeException: Couldn't find schema
for part: ...

Any chance you can send along a complete WSDL/schema? I don't see
anything wrong with what you have. You can send it along privately if
you need to...
 Cheers,
  Dan

On 1/2/07, Christopher Moesel <[EMAIL PROTECTED]> wrote:
>
>  Hi Dan,
>
>  Thanks for the quick response.  I don't believe that I have multiple
> schemas with the same namespace.  I've included representative samples
of my
> WSDL and XSD below (perhaps that will help?)...  I was just doing some
more
> looking- would setting the jaxb.search.packages property help?  I have
not
> set it to anything.  The error looks like it's happening in reading
the WSDL
> though, so I suspect the jaxb.search.packages property isn't even
relevant
> at this point.
>
>  Thanks,
>  Chris
>
>  ===== BEGIN myservice.wsdl =====
>
>  <wsdl:definitions
>          name="MyService"
>          targetNamespace="http://mycompany.com/myservice";
>          xmlns:tns=" http://mycompany.com/myservice";
>          xmlns:types="
> http://mycompany.com/myservice/types";
>          xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>          xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
>          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
>
>      <wsdl:types>
>          <xsd:schema>
>              <xsd:import namespace="
> http://mycompany.com/myservice/types";
> schemaLocation="mytypes.xsd"/>
>          </xsd:schema>
>      </wsdl:types>
>
>     ...
>
>  </wsdl:definitions>
>
>  ===== END myservice.wsdl =====
>
>  ===== BEGIN mytypes.xsd =====
>
>  <?xml version="1.0" ?>
>  <xs:schema
>          xmlns:xs="http://www.w3.org/2001/XMLSchema";
>          targetNamespace="
> http://mycompany.com/myservice/types";
>          xmlns:tns=" http://mycompany.com/myservice/types";
>          version="1.0">
>
>      <xs:element name="someType">
>          <xs:complexType>
>              <xs:sequence>
>                  <xs:element name="string1" type="xs:string"/>
>                  <xs:element name="string2" type="xs:string"/>
>              </xs:sequence>
>          </xs:complexType>
>      </xs:element>
>
>      ...
>
>  </xs:schema>
>
>  ===== END mytypes.xsd =====
>
>
>  On 1/2/07 1:56 PM, "Dan Diephouse" <[EMAIL PROTECTED]> wrote:
>
>
> Hi Christopher,
>
>  Do you per chance have a WSDL with multiple <schema>s with the same
> targetNamespace? Someone filed that bug as XFIRE-720 and I just fixed
it in
> SVN. I'll be publishing snapshots later today, but just wanted to see
if it
> was the same issue.
>
>  - Dan
>
>  On 1/2/07, Christopher Moesel <[EMAIL PROTECTED]> wrote:
>
> Hello All,
>
>  I am attempting to use Xfire for a contract-first web service.  I've
> written
>  the WSDL which imports a .XSD XML Schema file containing the types.
I've
>  been able to successfully use the WsGen ANT task to generate all the
>  server-side files.
>
>  My problem is in declaring the wsdlURL in the service definition.  I
am
>  using the spring configuration and have set the wsdlURL property to
point
> to
>  the WSDL in several ways:
>  A) On the classpath
>  B) Via HTTP URL
>  C) On the file system
>
>  In all cases it's able to find the WSDL, but seems to have trouble
finding
>  the types.  I get the following error when the service is
instantiated on
>  the server:
>
>  org.codehaus.xfire.XFireRuntimeException: Couldn't find
> schema for part:
>  {http://mycompany.com/myservice/types}someType
>
>  [Note that I've changed the name of the NS and type for IP reasons]
>
>  I am using Xfire 1.2.3 and XmlSchema 1.1.  I've looked through the
archives
>  and haven't seen any helpful info yet.  Anyone have any ideas?
>
>  Thanks,
>  Chris
>
>
> ---------------------------------------------------------------------
>  To unsubscribe from this list please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>
>
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to