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
SherryASherryA 

WSDL generated classes - namespace issues

Hello,

 

I am generating two  from a WSDL file, the code seems ok but when I create a message and send that message to the end point the "Lead" node does not have a namespace associated with it. If I get an instance of that WSDL using XML-spy I get a different xml instance, one that has the "Lead" node with the proper namespace and that one gets validated correctly.

Does anybody know why the message created from the APEX classes does not tag the "lead"node with a namespace? Do I need to alter a value from the class generated by APEX? Or Do I need to modify something in WSDL file before generating the classes?

 

Thanks,

Eduardo

 

Apex message send (fails):

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <env:Header/>
 <env:Body>
  <ScoreLeadBiztalk xmlns="http://tempuri.org/">
   <Lead>
    <Id xmlns="http://ApexService.Lead">00Q3000000Tat8f</Id>
   </Lead>
  </ScoreLeadBiztalk>
 </env:Body>
</env:Envelope>

XML-Spy instance (works):

 

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://ApexService.Lead">
 <SOAP-ENV:Body>
  <m:ScoreLeadBiztalk xmlns:m="http://tempuri.org/">
   <m0:Lead>
    <m0:Id>123</m0:Id>
   </m0:Lead>
  </m:ScoreLeadBiztalk>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WSDL file:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s1="http://ApexService.Lead" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
 <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly "ApexService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5962b974ab64847c" published web service.</wsdl:documentation>
 <wsdl:types>
  <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
   <s:import namespace="http://ApexService.Lead"/>
   <s:element name="ScoreLeadBiztalk">
    <s:complexType>
     <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" ref="s1:Lead"/>
     </s:sequence>
    </s:complexType>
   </s:element>
   <s:element name="ScoreLeadBiztalkResponse">
    <s:complexType>
     <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" ref="s1:Lead"/>
     </s:sequence>
    </s:complexType>
   </s:element>
  </s:schema>
  <s:schema elementFormDefault="qualified" targetNamespace="http://ApexService.Lead">
   <s:element name="Lead">
    <s:complexType>
     <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="Id" type="s:string"/>
     </s:sequence>
    </s:complexType>
   </s:element>
  </s:schema>
 </wsdl:types>
 <wsdl:message name="ScoreLeadBiztalkSoapIn">
  <wsdl:part name="parameters" element="tns:ScoreLeadBiztalk"/>
 </wsdl:message>
 <wsdl:message name="ScoreLeadBiztalkSoapOut">
  <wsdl:part name="parameters" element="tns:ScoreLeadBiztalkResponse"/>
 </wsdl:message>
 <wsdl:portType name="WebService_ApexServiceSoap">
  <wsdl:operation name="ScoreLeadBiztalk">
   <wsdl:input message="tns:ScoreLeadBiztalkSoapIn"/>
   <wsdl:output message="tns:ScoreLeadBiztalkSoapOut"/>
  </wsdl:operation>
 </wsdl:portType>
 <wsdl:binding name="WebService_ApexServiceSoap" type="tns:WebService_ApexServiceSoap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
  <wsdl:operation name="ScoreLeadBiztalk">
   <soap:operation soapAction="http://tempuri.org/WebService_ApexService/ScoreLeadBiztalk" style="document"/>
   <wsdl:input>
    <soap:body use="literal"/>
   </wsdl:input>
   <wsdl:output>
    <soap:body use="literal"/>
   </wsdl:output>
  </wsdl:operation>
 </wsdl:binding>
 <wsdl:service name="WebService_ApexService">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk assembly "ApexService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5962b974ab64847c" published web service.</wsdl:documentation>
  <wsdl:port name="WebService_ApexServiceSoap" binding="tns:WebService_ApexServiceSoap">
   <soap:address location="/ApexService/WebService_ApexService.asmx"/>
  </wsdl:port>
 </wsdl:service>
</wsdl:definitions>

 

Two APEX classes :

 

//Generated by wsdl2apex

public class apexWrapper {
    public class WebService_ApexServiceSoap {
        public String endpoint_x = '/ApexService/WebService_ApexService.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://ApexService.Lead', 'apexLead', 'http://tempuri.org/', 'apexWrapper'};
        public apexLead.Lead_element ScoreLeadBiztalk(apexLead.Lead_element Lead) {
            apexWrapper.ScoreLeadBiztalk_element request_x = new apexWrapper.ScoreLeadBiztalk_element();
            apexWrapper.ScoreLeadBiztalkResponse_element response_x;
            request_x.Lead = Lead;
            Map<String, apexWrapper.ScoreLeadBiztalkResponse_element> response_map_x = new Map<String, apexWrapper.ScoreLeadBiztalkResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/WebService_ApexService/ScoreLeadBiztalk',
              'http://tempuri.org/',
              'ScoreLeadBiztalk',
              'http://tempuri.org/',
              'ScoreLeadBiztalkResponse',
              'apexWrapper.ScoreLeadBiztalkResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Lead;
        }
    }
    public class ScoreLeadBiztalk_element {
        public apexLead.Lead_element Lead;
        private String[] Lead_type_info = new String[]{'Lead','http://ApexService.Lead','Lead_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'Lead'};
    }
    public class ScoreLeadBiztalkResponse_element {
        public apexLead.Lead_element Lead;
        private String[] Lead_type_info = new String[]{'Lead','http://ApexService.Lead','Lead_element','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
        private String[] field_order_type_info = new String[]{'Lead'};
    }
}

 

//Generated by wsdl2apex

public class apexLead {
    public class Lead_element {
        public String Id;
        private String[] Id_type_info = new String[]{'Id','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ApexService.Lead','true','false'};
        private String[] field_order_type_info = new String[]{'Id'};
    }
}

RohitMRohitM

Hi Sherry,

 

I know its quite a long time but I am facing the same issue now. Did anyone find a solution to this ?

 

There are a few posts with "multiple namesace" issues, but I don't even get a single namespace from SFDC.

 

 

Cheers,

Rohit M