1
votes

I am trying to use the element redefine in my xsd. I have tried different combinations but still don't seem to get this error resolved. The error shows up when i try to load the WSDL including the redefined schema into SOAP UI. Also, it doesnt show up in the design for the xsd in eclipse.

WSDL -> Imports TestService.xsd -> Imports CreateTest.xsd -> Contains a definition of CreateTestRequestType.

When i load this into my SOAPUI, everything looks good and no errors.

Now, I am trying to redefine the type CreateTestRequestType in another xsd called CreateRedefineTest.xsd and import this xsd into the TestService.xsd (The import statement is comemented, but i necessarily just uncomment this import and comment the other one for testing). But when i load the WSDL into SOAP UI, i get the below error:

Source: null Error: URL "CreateTest.xsd" is not well-formed

EDIT1: I am able to resolve this error by giving an absolute path. Is it possible to make it work with relative path?

EDIT2 I looked at w3 article about this element and the example does use a relative path. But i tried to replicate but it still doesnt work. The example is available at the this location.

I think i am missing some rule, but i have tried multiple things and dont seem to be able to resolve this.

Below is the source code for the WSDL and XSD's.

WSDL:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
	xmlns:test="http://test.com/TESTServices/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:tes="http://test.com/TestService/Test/"
	name="TestService"
	targetNamespace="http://test.com/TESTServices/">

	<wsdl:types>
		<xsd:schema targetNamespace="http://test.com/TestService/Test/">
			<xsd:include schemaLocation="TestService.xsd" />
		</xsd:schema>
	</wsdl:types>
	
	<!-- Create Test -->
	<wsdl:message name="CreateTestRequest">
		<wsdl:part element="tes:CreateTestRequest" name="parameters" />
	</wsdl:message>
	<wsdl:message name="CreateTestResponse">
		<wsdl:part element="tes:CreateTestResponse" name="parameters" />
	</wsdl:message>

	<wsdl:message name="TESTHeader">
		<wsdl:part name="request_header" element="tes:testHeader"/>
	</wsdl:message>

	<wsdl:message name="TestFault">
		<wsdl:part name="testFault" element="tes:testFault"></wsdl:part>
	</wsdl:message>


	<wsdl:portType name="TestServices_v4_0">
		<!-- Create Party -->
		<wsdl:operation name="CreateTest">
			<wsdl:input message="test:CreateTestRequest" />
			<wsdl:output message="test:CreateTestResponse" />
			<wsdl:fault name="fault" message="test:TestFault"></wsdl:fault>
		</wsdl:operation>
	</wsdl:portType>

	<wsdl:binding name="TestServicesSOAP_v4_0" type="test:TestServices_v4_0">
		<soap:binding style="document"
			transport="http://schemas.xmlsoap.org/soap/http" />
		
		<!-- Create Party -->
		<wsdl:operation name="CreateTest">
			<soap:operation soapAction="http://firstniagara.com/PartyService/CreateTest" />
			<wsdl:input>
				<soap:header message="test:TESTHeader" part="request_header"
					use="literal" />
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output>
				<soap:header message="test:TESTHeader" part="request_header"
					use="literal" />
				<soap:body use="literal" />
				
			</wsdl:output>
			<wsdl:fault name="fault">
				<soap:fault name="fault" use="literal" />
			</wsdl:fault>
		</wsdl:operation>
	</wsdl:binding>

	<wsdl:service name="TestServices_v4_0">
		<wsdl:port binding="test:TestServicesSOAP_v4_0" name="TestServicesSOAP">
			<soap:address location="http://localhost/TEST/ESB" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

This WSDL Imports TestService.xsd, which contains below code:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema 
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:ct="http://test.com/TestService/CreateTest/"
	targetNamespace="http://test.com/TestService/Test/"
	elementFormDefault="qualified">

	<xsd:import namespace="http://test.com/TestService/CreateTest/" schemaLocation="CreateTest.xsd" />

<!-- 	<xsd:import namespace="http://test.com/TestService/CreateTest/" schemaLocation="CreateRedefineTest.xsd" /> -->
	
	<!-- CreateParty -->
	<xsd:element name="CreateTestRequest" type="ct:CreateTestRequestType" />
	<xsd:element name="CreateTestResponse" type="ct:CreateTestResponseType" />

	<xsd:element name="testHeader" type="xsd:string" />
	<xsd:element name="testFault" type="xsd:string" />
	
	
	
</xsd:schema>

TestService.xsd contains CreateTest.xsd, which contains the below code and has a type CreateTestRequestType defined:

<xsd:schema 
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://test.com/TestService/CreateTest/"
	elementFormDefault="qualified">
	

	<!--  Create Test-->
	<xsd:complexType name="CreateTestRequestType">
		<xsd:sequence>
			<xsd:element name="RequestId" type="xsd:string" minOccurs="1"/>
			<xsd:element name="TestRecord" type="xsd:string" minOccurs="1" />
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="CreateTestResponseType">
		<xsd:sequence>
			<xsd:element name="RequestId" type="xsd:string" minOccurs="1"/>
			<xsd:element name="Messages" type="xsd:string" minOccurs="0"/>
			<xsd:element name="TestIdentifier" type="xsd:string" minOccurs="0"/>			
		</xsd:sequence>
	</xsd:complexType>
	
</xsd:schema>

Trying to redefine CreateTestRequestType in CreateRedefineTest.xsd as below:

<xsd:schema 
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:cp="http://test.com/TestService/CreateTest/"
	targetNamespace="http://test.com/TestService/CreateTest/"
	elementFormDefault="qualified">
	
  <xsd:redefine schemaLocation="CreateTest.xsd">
  <xsd:complexType name="CreateTestRequestType">
    <xsd:complexContent>
      <xsd:extension base="cp:CreateTestRequestType">
        <xsd:sequence>
          <xsd:element name="country" type="xsd:string"/>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
</xsd:redefine>	

</xsd:schema>
3
I don't know if there is some error in XMLBeans (it's the framework which SOAPUI it's using to load the WSDL and the xsds) with <xs:redefine>. The thing is if I use an absolute path for schemaLocation in xs:redefine using the follow notation file:///C:/Path_to_xsd seems that non error is thrown an the WSDL is load. However then when I create the request and add manually the new element <country> and I validate the request with SOAPUI it says that element is not allowed. So with the full path wsdl loads without error but loads incorrectly... hope you'll be lucky finding a solution.albciff
@albciff, Thanks for looking at this and trying. I tried to use the absolute path and it works and loads with the expected elements and validates OK. I used "/" instead of "\" and it worked fine. Now, i need to figure out how to make it work using relative path. Thanks a lot for trying this!mandy
it's great that my comment helps you :)albciff

3 Answers

1
votes

SoapUI is a great tool which has helped me through out and will keep helping me in future in great ways.

I think this is one of the feature which apparently a lot of users don't use and seems to be a bug in SoapUI 5.0.0. I tried the same thing in a couple older versions of SoapUI and got the same result. I also tried it in a Trial version of SOAP UI NG Pro 1.2.2.

I then tried this in XMLSpy and it worked without any errors, exact same xsd's with no modification. (Note: the TestService.xsd needs the commented import statement for Redefined.xsd)

I also found there was a bug reported, but didn't find a resolution or any comments about the resolution. If someone would like the references of these bugs, the location. You can look up the bugs 651, 586 and 539 which are related if you wish.

I hope at some point this bug is fixed in SoapUI. I also created a new bug to refer to these old bugs and consolidate: SourceForge 671

And hope this post saves other's time if they run into the same problem.

Thanks all for everyone who looked at this post.

1
votes

I want to confirm that I get the same error above when trying to use the xsd:redefine element in my message set with version 5.0.0 of SOAP UI.

Basically, I have to extend the message definition of another the message set defined by the Open Geospatial Group - Web Feature Service and use the redefined schema in the request and response definition of my WSDL.

In addition to the 'not well-formed' error, I also get:

'Source: null Error: type 'QueryType@http://www.opengis.net/wfs' not found.'

Eclipse doesn't have a problem with the WSDL validation and I can import it into Rational Service Tester (V8.5.0.2) without issue.

0
votes

This is probably due to your parser not being able to locate the schema document for "cp:http://test.com/TestService/CreateTest/". Does this still occur if you use absolute URL for the cp xsd, or use an XML Catalog?