Dean Hiller
Dean Hiller

Reputation: 20182

cxf - wsdl2java does not allow declaration of namespaces in xsd?

We have a working wsdl2java but the xsd is missing xmlns definition and targetNamespace definition. When added the wsdl2java then breaks with these errors

 <<< ERROR! 
Part <parameter> in Message <{enrollment}enrollmentResultRequestMessage> referenced Type <Enrollment> can not be found in the schemas
Part <parameter> in Message <{enrollment}enrollmentRequestMessage> referenced Type <Enrollment> can not be found in the schemas

All I did was change

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

to

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://yyy.com/enrollment" targetNamespace="http://yyy.com/enrollment">

I upgraded cxf to 2.5.2 and still doesn't work. Anyone have any idea why this would not work? We need to start using xsds that are specification and don't want to have to remove namespaces every time. Any ideas?

is our wsdl wrong in this case or something(though it works with the first version of the xsd)...

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                  xmlns:tns="enrollment2"
                  xmlns:en="http://yyy.com/enrollment" 
                  targetNamespace="enrollment2">
    <wsdl:import namespace="http://yyy.com/enrollment" location="enrollment.xsd"/>

    <wsdl:types>
        <xs:schema targetNamespace="enrollment2" elementFormDefault="qualified"/>
    </wsdl:types>

thanks, Dean

Upvotes: 0

Views: 4288

Answers (1)

Srimathi
Srimathi

Reputation: 247

You need to use xsd:import as a child of wsdl:types/xs:schema to include the xsd types.

<wsdl:types>
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
     <xsd:import namespace="http://yyy.com/enrollment" location="enrollment.xsd">
  </xsd:schema>
</wsdl:types>

That being said, wsdl:import is to import another wsdl defintion with different namespace than yours.

Upvotes: 3

Related Questions