linker85
linker85

Reputation: 1651

why am I getting Invalid attribute value for 'type' in element 'element' in my webservice?

I'm making a contract first webservice so my first xds(MensajeDetails.xds) is:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://webservices.samples.blog.com" targetNamespace="http://webservices.samples.blog.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Mensaje" type="Mensaje"/>
    <xs:complexType name="Mensaje">
        <xs:sequence>
            <xs:element name="IdMensajesEnviados" type="xs:long"/>
            <xs:element name="CodigoEstatus" type="xs:int"/>
            <xs:element name="DescripcionEstatus" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

and in my 2nd xds (MensajeDetailsServiceOperation.xds) I´ve:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://com/blog/samples/webservices/mensajeservice" xmlns:account="http://webservices.samples.blog.com" targetNamespace="http://com/blog/samples/webservices/mensajeservice" elementFormDefault="qualified">
    <xsd:import namespace="http://webservices.samples.blog.com" schemaLocation="MensajeDetails.xsd"/>
    <xsd:element name="MensajeDetailsRequest">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="IdUsuario" type="xsd:long"/>
                <xsd:element name="Token" type="xsd:string"/>
                <xsd:element name="IdServicio" type="xsd:int"/>
                <xsd:element name="Archivo" type="xsd:byte"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="MensajeDetailsResponse">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="MensajeDetails" type="mensaje:Mensaje"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

So eclipse is telling me that in my 2nd xds

s4s-att-invalid-value: Invalid attribute value for 'type' in element 'element'.
    Recorded reason: UndeclaredPrefix: Cannot resolve 'mensaje:Mensaje' as a QName: the prefix 'mensaje' is not declared." in the line:
    <xsd:element name="MensajeDetails" type="mensaje:Mensaje"/>

What am I doing wrong?

Upvotes: 2

Views: 11776

Answers (1)

Boris the Spider
Boris the Spider

Reputation: 61138

You have imported the namespace into your schema and have declared a namespace prefix for it, in your schema declaration your have xmlns:account="http://webservices.samples.blog.com", this binds the prefix "account" to your imported namespace.

So, either change your element to account:Mensaje or change the prefix to mensaje

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns="http://com/blog/samples/webservices/mensajeservice"
  xmlns:mensaje="http://webservices.samples.blog.com"
  targetNamespace="http://com/blog/samples/webservices/mensajeservice"
  elementFormDefault="qualified">

Upvotes: 2

Related Questions