function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

Error: Failed to parse wsdl: attribute name can not be null



   I am getting "Error: Failed to parse wsdl: attribute name can not be null at 484:53"  when i am trying to parse wsdl using Wsdl2Apex.The line where it seems to complain is in bold in the snippit below.


<s:complexType name="AssessmentResult">
          <s:element minOccurs="0" maxOccurs="1" name="ClientId" type="s1:EntityId"/>
          <s:element minOccurs="0" maxOccurs="1" name="ProviderId" type="s1:EntityId"/>
          <s:element minOccurs="0" maxOccurs="1" name="ClientOrderId" type="s1:EntityId"/>
          <s:element minOccurs="0" maxOccurs="1" name="ReceiptId" type="s1:EntityId"/>
          <s:element minOccurs="0" maxOccurs="unbounded" name="Results" type="s1:Results"/>
          <s:element minOccurs="0" maxOccurs="1" name="AssessmentStatus" type="s1:AssessmentStatus"/>
          <s:element minOccurs="0" maxOccurs="1" name="UserArea" type="s1:UserArea"/>
        <s:attribute ref="xml:lang" use="optional"/>
        <s:attribute name="validFrom" type="s:string"/>
        <s:attribute name="validTo" type="s:string"/>



Any Idea?




As this seems parse error mean you are missing some tag or attribute properties


Clearly the error says


: attribute name can not be null at 484:53"

 so here you have to add attribute 'name'


Henceforth, something like this should work 


<s:attribute ref="xml:lang" name="salesforce"  use="optional"/>    (add name Attribute) 


<s:attribute ref="xml:lang" name="salesforce"  use="optional"/>

Thanks ForceLabs, I fixed the error by giving name and type of the attribute.But now i am getting another Error   "Error: Failed to parse wsdl: Found more than one wsdl:portType. WSDL with multiple portType not supported ". Any Idea?




It would be great help, if you can paste here the exact xml you are trying to implement


But before you jump, I recommend you to read this to find the exact idea behind the xml and its attributes. This will be good refrence to keep on your right page.



Please tag, reply as 'solution' if anyone of solution worked for you - this will help other to find.  Your action would highly be appreciated.




I had similar problem few months back when I was trying to import wsdl from a .net application and ended up doing the following - 


1. Wrote a java webservice wrapper on top of our .net webservice using Axis 1.0. This will eliminate the hassles around importing multiple port wsdls. Also, the other workaround to avoid this error is remove the additional port from xml editor tools like Altova (if you are xml expert you can use regular text pad to remove ports)


2. Though I could pretty much use the above workaround for all my other webservices, we thought its too cumbersome and took the following approach for the rest of the webservices.


Used http class and posted outbound messages to the endpoint. here is the quick example. You can find tons of information on wiki.

public HttpRequest req= new HttpRequest(); 
req.setHeader('content-type', 'text/xml; charset=utf-8');  
req.setHeader('SOAPAction', endPoint); 
req.setBody(request.replace('&', '&amp;') );
HttpResponse resObj = new HttpResponse();
resObj = http.send(req);

Thanks Raghu.




         Here is the link to wsdl .