Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error accurs when validating the SOAP response with WSDL

843833Nov 22 2007 — edited Nov 22 2007
I have a SOAP service running and responding to SOAP requests normally. However, when I tried to validate the response against the WSDL in SOAPUI 1.7.6, it gave me error saying:(see wsdl and response xml in the end of this post)
line 4: Expected element 'offer' instead of 'offer@http://www.conceptwave.com/pt_pcapi' here in element offers@http://www.conceptwave.com/pt_pcapi

It seems the targetNamespace in my WSDL schema only applies to its direct "element"-type children nodes. If it's a non-element node, for example, "complexType" or a non-direct children , for example "offerCode" element under "sequence" node ( which is under "offer" complexType), the validator considers them no-namespace nodes, therefore complains when receiving a response containing these nodes with namespace(/prefix).

attachment 1: WSDL file
<?xml version="1.0" ?>
<definitions name="pt_pcapi" targetNamespace="http://www.mydomain.com/pt_pcapi" xmlns:tns="http://www.mydomain.com/pt_pcapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:pt_pcapi="http://www.mydomain.com/pt_pcapi">

	<types>
		<xsd:schema targetNamespace="http://www.mydomain.com/pt_pcapi"	>


			<xsd:annotation>
				<xsd:documentation>Product Catalog API</xsd:documentation>
				<xsd:appinfo>
					<xsd:metadata>mydomain data</xsd:metadata>
					<xsd:created>Sun Apr 22 23:02:40 BST 2007</xsd:created>
					<xsd:updated>Fri Nov 02 10:40:46 EDT 2007</xsd:updated>
				</xsd:appinfo>
			</xsd:annotation>

			<!-- Data types and elements -->

			<xsd:simpleType name="status">
				<xsd:annotation>
					<xsd:documentation>status</xsd:documentation>
				</xsd:annotation>
				<xsd:restriction base="xsd:string">
					<xsd:maxLength value="3"/>
				</xsd:restriction>
			</xsd:simpleType>


			<xsd:simpleType name="translation">
				<xsd:annotation>
					<xsd:documentation>translation</xsd:documentation>
				</xsd:annotation>
				<xsd:restriction base="xsd:string">
					<xsd:maxLength value="1024"/>
				</xsd:restriction>
			</xsd:simpleType>

			<!-- Structures -->

			<xsd:element name="criteria">
				<xsd:complexType >
				<xsd:annotation>
					<xsd:documentation>criteria</xsd:documentation>
				</xsd:annotation>
					<xsd:sequence>
						<xsd:element name="criterion" minOccurs="0" maxOccurs="unbounded" type="pt_pcapi:criterion"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>

			<xsd:complexType name="criterion">
				<xsd:annotation>
					<xsd:documentation>criterion</xsd:documentation>
				</xsd:annotation>
					<xsd:sequence>
						<xsd:element name="name" minOccurs="1" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="op" minOccurs="1" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="value" minOccurs="1" maxOccurs="1" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>


			<xsd:complexType name="offer">
				<xsd:annotation>
					<xsd:documentation>Offer</xsd:documentation>
				</xsd:annotation>
					<xsd:sequence>
						<xsd:element name="offerCode" minOccurs="1" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="label" minOccurs="1" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="description" minOccurs="0" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="startDate" minOccurs="1" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="endDate" minOccurs="0" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="status" minOccurs="0" maxOccurs="1" type="xsd:string"/>
						<xsd:element name="autoPrice" minOccurs="0" maxOccurs="1" type="xsd:boolean"/>
						<xsd:element name="lastUpdatedDate" minOccurs="0" maxOccurs="1" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>

			<xsd:element name="offers">
				<xsd:complexType >
				<xsd:annotation>
					<xsd:documentation>Offers</xsd:documentation>
				</xsd:annotation>
					<xsd:sequence>
						<xsd:element name="offer" minOccurs="0" maxOccurs="unbounded" type="pt_pcapi:offer"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>

		</xsd:schema>
	</types>

	<message name="criteria">
		<part name="criteria" element="pt_pcapi:criteria"/>
	</message>


	<message name="offers">
		<part name="offers" element="pt_pcapi:offers"/>
	</message>

	<portType name="pcServerInterface">
		<operation name="getOffers">
			<input message="tns:criteria"/>
			<output message="tns:offers"/>
		</operation>
	</portType>

	<binding name="pcSOAPBinding" type="tns:pcServerInterface">
		<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
		
		<operation name="getOffers">
			<soap:operation soapAction="getOffers"/>
			<input>
				<soap:body use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
	</binding>

	<service name="pt_pcapi">
		<port name="soapPort" binding="tns:pcSOAPBinding">
			<soap:address location="http://localhost:8080/cwf/services/pcServerInterface"/>
		</port>
	</service>

</definitions>
attachment 2: response xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <pt_pcapi:offers xmlns:pt_pcapi="http://www.mydomain.com/pt_pcapi">
         <pt_pcapi:offer>
            <pt_pcapi:offerCode>TriplePlay</pt_pcapi:offerCode>
            <pt_pcapi:label>Triple Play</pt_pcapi:label>
            <pt_pcapi:startDate>2007-07-20</pt_pcapi:startDate>
            <pt_pcapi:status>ACT</pt_pcapi:status>
            <pt_pcapi:autoPrice>0</pt_pcapi:autoPrice>
            <pt_pcapi:lastUpdatedDate>2007-09-12T19:51:19-04:00</pt_pcapi:lastUpdatedDate>
         </pt_pcapi:offer>
      </pt_pcapi:offers>
   </soapenv:Body>
</soapenv:Envelope>
Anybody can shed some light on this? Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 20 2007
Added on Nov 22 2007
3 comments
889 views