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

Problems generating Apex code from WSDL

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.
Below is the actual WSDL:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/MyClass.jws" xmlns:apachesoap="" xmlns:impl="http://localhost:8080/axis/MyClass.jws" xmlns:intf="http://localhost:8080/axis/MyClass.jws" xmlns:soapenc="" xmlns:wsdl="" xmlns:wsdlsoap="" xmlns:xsd="">
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

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

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

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

should be

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

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

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