3

I have the this wsdl document generated from a .NET application using StackService. I'm using Apache CXF in order to get some generated java classes.

I'm running the following command (windows):

D:\SomePath>wsdl2java -d d:\temp http://mywsdl.com

The result is as follows:

WSDLToJava Error:

Summary: Failures: 50, Warnings: 0

<<< ERROR!

Part in Message <{http://schemas.servicestack.net/types}CadastroUsuarioOut> referenced Type <{http://schemas.servicestack.net/types}CadastroUsuarioResponse> can not be found in the schemas

Part in Message <{http://schemas.servicestack.net/types}ContratoImovelIn> referenced Type <{http://schemas.servicestack.net/types}ContratoImovel> can not be found in the schemas

plus 48 more like these Part in message errors

The WSDL is auto-generated and is being consumed successfully by other systems.

Any ideias?

Thanks

Androiderson
  • 16,865
  • 6
  • 62
  • 72
  • Since it says the type is not defined in the schemas, the first step would be checking whether this is true, i.e. does the WSDL refer to some XML schemas (*.xsd files)? Are they available to wsdl2java? Do they contain the missing type definition? – meriton Mar 18 '13 at 20:39

2 Answers2

2

I've got the same error-message (with a different wsdl of course) and i see there are <xsd:imports in your <wsdl:types.

The solution for my problem was to add schemaLocation to the <xsd:imports.

Example old

<xsd:import namespace="http://schemas.servicestack.net/types"/>

Example new

<xsd:import namespace="http://schemas.servicestack.net/types" schemaLocation="types.xsd" />
DaniEll
  • 1,022
  • 4
  • 22
  • 31
  • This solution worked for me. Thank you. But why do you think the WSDL needed the schema location specifically defined with schemaLocation? Why was having the XSDs in the same directory as the WSDL not enough? – Cale Sweeney Apr 28 '17 at 16:37
1

Check the 'types' section of the wsdl. The 'types' section defines various xml types used to exchange data in the SOAP message. Check out the sample wsdl file -

http://heasarc.gsfc.nasa.gov/itwg/wsdl_all.html

Verify if the 'types' section for your wsdl is valid and defines all the datatypes that are used by the service.

By looking at the error it looks like 'CadastroUsuarioResponse' and 'ContratoImovel' are missing in 'types' definition.

Sashi
  • 1,977
  • 16
  • 15