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
agabagab 

Problems generating Apex code from WSDL

Hello,
Does anyone have an idea why I cannot generate Apex code from this WSDL?  The WSDL parses successfully, but upon generation of the Apex code, I keep getting the following error:
 
"Error: Unable to find schema for element; getNameResponse"
 
pertaining to the green line in the WSDL below; it's a WSDL generated
by axis which I have had to modify to get it to work in Apex, but I cannot figure out what to do about this one error.
 
The underlying service is a simple java class with a method getName() that returns a String.
 
Thanks,
agab-
 
Below is the actual WSDL:
 
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/MyClass.jws" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/MyClass.jws" xmlns:intf="http://localhost:8080/axis/MyClass.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
  -->

  <xsd:element name="getNameResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="getNameReturn" type="xsd:string" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  </xsd:schema>
</wsdl:types>
 
  <wsdl:message name="getNameRequest" />
<wsdl:message name="getNameResponse">
  <wsdl:part name="myResponse" element="getNameResponse"/>
  </wsdl:message>
<wsdl:portType name="MyClass">
<wsdl:operation name="getName">
  <wsdl:input message="impl:getNameRequest" name="getNameRequest" />
  <wsdl:output message="impl:getNameResponse" name="getNameResponse" />
  </wsdl:operation>
  </wsdl:portType>
<wsdl:binding name="MyClassSoapBinding" type="impl:MyClass">
  <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getName">
  <wsdlsoap:operation soapAction="" />
<wsdl:input name="getNameRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="literal" />
  </wsdl:input>
<wsdl:output name="getNameResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/MyClass.jws" use="literal" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
<wsdl:service name="MyClassService">
<wsdl:port binding="impl:MyClassSoapBinding" name="MyClass">
  <wsdlsoap:address location="http://localhost:8080/axis/MyClass.jws" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
creativecreative
I"m getting the same error with a different wsdl file.
SuperfellSuperfell
I think the problem is that this

<wsdl:message name="getNameResponse">
<wsdl: part name="myResponse" element="getNameResponse"/>
</wsdl:message>

should be

<wsdl:message name="getNameResponse">
<wsdl: part name="myResponse" element="impl:getNameResponse"/>
</wsdl:message>

Its hard to see in the formatting, but there doesn't appear to be a default namespace declared, so the element="getNameResponse" reference, is refering to a getNameResponse element in the "" namespace, when it should be the http://localhost:8080/axis/MyClass.jws namespace.

Message Edited by SimonF on 04-09-2008 09:03 AM
agabagab

I made the change and it works like a charm.  Thank you very much!

agab-