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
SankarSankar 

Handling of the Heterogeneous Namespace Design with respect to APEX WSDL Limitations

Person.xsd

 

<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://www.person.org" xmlns="http://www.person.org"

elementFormDefault="qualified"> <xsd:complexType name="PersonType"> <xsd:sequence> <xsd:element name="Name" type="xsd:string"/> <xsd:element name="SSN" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

 

  Product.xsd

 

<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.product.org" xmlns="http://www.product.org" elementFormDefault="qualified"> <xsd:complexType name="ProductType"> <xsd:sequence> <xsd:element name="Type" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:schema>

 

  Company.xsd

 

<?xml version="1.0"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.company.org" xmlns="http://www.company.org" xmlns:per="http://www.person.org" xmlns:pro="http://www.product.org" elementFormDefault="qualified"> <xsd:import namespace="http://www.person.org" schemaLocation="Person.xsd"/> <xsd:import namespace="http://www.product.org" schemaLocation="Product.xsd"/> <xsd:element name="Company"> <xsd:complexType> <xsd:sequence> <xsd:element name="Person" type="per:PersonType" maxOccurs="unbounded"/>

<xsd:element name="Product" type="pro:ProductType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>

 

 

In Company.xsd it imports an external schema, which is not supported in APEX.
Please let me know how to replace the following two lines:

 

<xsd:import namespace="http://www.person.org" schemaLocation="Person.xsd"/> <xsd:import namespace="http://www.product.org" schemaLocation="Product.xsd"/>

 

Thanks in advance. 

 Sankar
SuperfellSuperfell
take the schema element tree from the imported schema and replace the import element in the wsdl with it.
SankarSankar

Hi Simon,

   Thanks for your reply. Followed your guide lines and tried to generate apex class using the below WSDL file. Apex class generation failed and the following error is thrown.

 

Error: Unsupported WSDL. Operation 'FetchCompanyDetails' has more than one output element
 
Do Salesforce support sequence elements in a WSDL's output?

 

 

<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/ " xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.company.org" targetNamespace="http://www.company.org"> <wsdl:types> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.company.org" xmlns="http://www.company.org" elementFormDefault="qualified"> <!-- <xs:import namespace="http://www.person.org" schemaLocation="Person.xsd"/> <xs:import namespace="http://www.product.org" schemaLocation="Product.xsd"/> --> <xs:complexType name="PersonType"> <xs:sequence> <xs:element name="Name" type="xs:string"/> <xs:element name="SSN" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="ProductType"> <xs:sequence> <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:complexType name="Request"> <xs:sequence> <xs:element name="UserName" type="xs:string"/> <xs:element name="Password" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:element name="Response"> <xs:complexType> <xs:sequence> <xs:element name="Person" type="PersonType" maxOccurs="unbounded"/> <xs:element name="Product" type="ProductType" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> </wsdl:types> <wsdl:message name="CompanyMessageRequest"> <wsdl:part name="parameters" element="tns:Request"/> </wsdl:message> <wsdl:message name="CompanyMessageResponse"> <wsdl:part name="parameters" element="tns:Response"/> </wsdl:message> <wsdl:portType name="CompanyPortType"> <wsdl:operation name="FetchCompanyDetails"> <wsdl:input message="tns:CompanyMessageRequest"/> <wsdl:output message="tns:CompanyMessageResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CompanyBinding" type="tns:CompanyPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="FetchCompanyDetails"> <soap:operation soapAction="http://www.company.org/FetchCompanyDetails"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CompanyService"> <wsdl:port name="CompanyPort" binding="tns:CompanyBinding"> <soap:address location="http://localhost:8080/axis2/services/CompanyRequestService"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

 

 

 

 

anu08anu08
I didn't get can u give an exp for inmporting xsd in to wsdl 
SankarSankar

Heterogeneous Namespace Design approach says to give each schema a different targetNamespace.

Observe that each schema has a different targetNamespace.

A company is comprised of people and products.

Here the company, person, and product schemas are using three individual design approaches.

 

google out to know more

WilmerWilmer

Hi Sankar and Simon,

 

I'm having the same issue, got an error message like the one Sankar says: Error: Unsupported WSDL. Operation 'FetchCompanyDetails' has more than one output element

 

This seems like Salesforce doesn't support secuence elements in the WSDL output.

 

Please, if someone has any workaround let me know.

 

Regards,

 

 

Wilmer