Yes, it is legal to have a complex type and element with the same name in an XML Schema.
Since your question is tagged with [java] and [web-services] you may be using JAXB (via JAX-WS) to generate classes from the XML Schema. In that case since a complex type and element (with an anonymous complex type) have the same name you will need to use an external binding file to rename one of the generated classes.
UPDATE
good guess! the JAXB parser thrown a exception, mainly because the naming conflict, my question is if its legal why the JAXB not liking it?
JAXB (JSR-222) converts complex types to Java classes. For named complex types the resulting class name is derived from the complex type name, for anonymous complex types the resulting class name is derived from the enclosing element. In your case this would result in two classes with the same name that JAXB complains about.
Rename Class Corresponding to the XML Element (binding.xml)
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
version="2.1">
<jxb:bindings schemaLocation="your-schema.xsd">
<jxb:bindings node="//xs:element[@name='ProcessTaskActionResponse']/complexType">
<jxb:class name="ProcessTaskActionResponseElement"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
Rename Class Corresponding to the Complex Type (binding.xml)
<jxb:bindings
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
version="2.1">
<jxb:bindings schemaLocation="your-schema.xsd">
<jxb:bindings node="//xs:complexType[@name='ProcessTaskActionResponse']">
<jxb:class name="ProcessTaskActionResponseType"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>