1

I'm receiving the following error when parsing a wsdl we've used for java and .net c# applications. I understand the parsing is different for both the Salesforce apex generator and the FUSEIT wsdl2apex generator, but hoping I can get some help.

I'm receiving the following error: Value cannot be null. Parameter name:objectToConvert.

The wsdl used is below.

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://custkeyservice.webservices.itsos.americancentury.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns2="http://schemas.xmlsoap.org/soap/http" xmlns:ns1="http://acdt1403:8080/CustKeyService" name="CustKeyServiceImplService" targetNamespace="http://custkeyservice.webservices.itsos.americancentury.com/"> <wsdl:import location="http://aserver:8081/SpiService/services/CustKeyService?wsdl=CustKeyServicePortType.wsdl" namespace="http://aserver:8081/CustKeyService"> </wsdl:import> <wsdl:binding name="CustKeyServiceImplServiceSoapBinding" type="ns1:CustKeyServicePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getCrmById2"> <soap:operation soapAction="" style="document"/> <wsdl:input name="getCrmById2"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="getCrmById2Response"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getCrmByCustId"> <soap:operation soapAction="" style="document"/> <wsdl:input name="getCrmByCustId"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="getCrmByCustIdResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getCrmById"> <soap:operation soapAction="" style="document"/> <wsdl:input name="getCrmById"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="getCrmByIdResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getCustKey"> <soap:operation soapAction="" style="document"/> <wsdl:input name="getCustKey"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="getCustKeyResponse"> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CustKeyServiceImplService"> <wsdl:port binding="tns:CustKeyServiceImplServiceSoapBinding" name="CustKeyServiceImplPort"> <soap:address location="http://aserver:8081/SpiService/services/CustKeyService"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

The wsdl import is specified below

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://acdt1403:8080/CustKeyService" name="CustKeyServicePortType" targetNamespace="http://acdt1403:8080/CustKeyService">
      <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://acdt1403:8080/CustKeyService" version="1.0">

<xs:element name="getCrm">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="id" nillable="true" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>    
      <xs:element name="getCrmByCustId">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="id" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmByCustIdResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="out" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmById">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="id" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmByIdResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="out" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmById2">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="id" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmById2Response">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="out" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCrmResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="out" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCustKey">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="id" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="getCustKeyResponse">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="out" nillable="true" type="xs:string"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

    </xs:schema>
      </wsdl:types>
      <wsdl:message name="getCrmResponse">
        <wsdl:part element="ns1:getCrmResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmByCustIdResponse">
        <wsdl:part element="ns1:getCrmByCustIdResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmByCustId">
        <wsdl:part element="ns1:getCrmByCustId" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmById2Response">
        <wsdl:part element="ns1:getCrmById2Response" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCustKey">
        <wsdl:part element="ns1:getCustKey" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmById2">
        <wsdl:part element="ns1:getCrmById2" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmById">
        <wsdl:part element="ns1:getCrmById" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCustKeyResponse">
        <wsdl:part element="ns1:getCustKeyResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="getCrmByIdResponse">
        <wsdl:part element="ns1:getCrmByIdResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="CustKeyServicePortType">
        <wsdl:operation name="getCrmById">
          <wsdl:input message="ns1:getCrmById" name="getCrmById">
        </wsdl:input>
          <wsdl:output message="ns1:getCrmByIdResponse" name="getCrmByIdResponse">
        </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getCrmByCustId">
          <wsdl:input message="ns1:getCrmByCustId" name="getCrmByCustId">
        </wsdl:input>
          <wsdl:output message="ns1:getCrmByCustIdResponse" name="getCrmByCustIdResponse">
        </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getCrm">
          <wsdl:input message="ns1:getCrm" name="getCrm">
        </wsdl:input>
          <wsdl:output message="ns1:getCrmResponse" name="getCrmResponse">
        </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getCrmById2">
          <wsdl:input message="ns1:getCrmById2" name="getCrmById2">
        </wsdl:input>
          <wsdl:output message="ns1:getCrmById2Response" name="getCrmById2Response">
        </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getCustKey">
          <wsdl:input message="ns1:getCustKey" name="getCustKey">
        </wsdl:input>
          <wsdl:output message="ns1:getCustKeyResponse" name="getCustKeyResponse">
        </wsdl:output>
        </wsdl:operation>
      </wsdl:portType>
    </wsdl:definitions>
  • 1
    That doesn't appear to be the complete WSDL. It is missing the binding and service elements. The service element should also define a port element. – Daniel Ballinger Apr 18 '15 at 8:15
  • 1
    Can you please provide the complete WSDL? Feel free to change the port URL. – Daniel Ballinger Apr 19 '15 at 21:27
  • I've updated the wsdl provided. – KcBrewRon Apr 20 '15 at 13:51
  • Can you also provide the import form aserver:8081/SpiService/services/… please. – Daniel Ballinger Apr 20 '15 at 19:22
  • @DanielBallinger - This is included now. – KcBrewRon Apr 20 '15 at 21:31
1

Updated WSDL:

I needed to add, what I assume is the definition of, the getCrm message which was still missing.

<wsdl:message name="getCrm">
    <wsdl:part element="ns1:getCrm" name="parameters">
    </wsdl:part>
</wsdl:message>

After that I was able to generate the following Apex classes that can deploy successfully to Salesforce.

NOTE: If the namespaces etc... don't match the actual WSDL you will likely get errors when trying to use it against the real web service.

acdt14038080Custkeyservice:

//Generated by FuseIT WSDL2Apex (http://www.fuseit.com/Solutions/SFDC-Explorer/Help-WSDL-Parser.aspx)

public class acdt14038080Custkeyservice {
    public class getCrm_element {
        public String id;
        private String[] id_type_info = new String[]{'id','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'id'};
    }
    public class getCrmByCustId_element {
        public String id;
        private String[] id_type_info = new String[]{'id','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'id'};
    }
    public class getCrmByCustIdResponse_element {
        public String out;
        private String[] out_type_info = new String[]{'out','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'out'};
    }
    public class getCrmById_element {
        public String id;
        private String[] id_type_info = new String[]{'id','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'id'};
    }
    public class getCrmById2_element {
        public String id;
        private String[] id_type_info = new String[]{'id','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'id'};
    }
    public class getCrmById2Response_element {
        public String out;
        private String[] out_type_info = new String[]{'out','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'out'};
    }
    public class getCrmByIdResponse_element {
        public String out;
        private String[] out_type_info = new String[]{'out','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'out'};
    }
    public class getCrmResponse_element {
        public String out;
        private String[] out_type_info = new String[]{'out','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'out'};
    }
    public class getCustKey_element {
        public String id;
        private String[] id_type_info = new String[]{'id','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'id'};
    }
    public class getCustKeyResponse_element {
        public String out;
        private String[] out_type_info = new String[]{'out','http://acdt1403:8080/CustKeyService','string','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://acdt1403:8080/CustKeyService','true','false'};
        private String[] field_order_type_info = new String[]{'out'};
    }
}

custkeyserviceWebservicesItsosAmeri:

//Generated by FuseIT WSDL2Apex (http://www.fuseit.com/Solutions/SFDC-Explorer/Help-WSDL-Parser.aspx)
//Methods Included: getCrmById, getCrmByCustId, getCrm, getCrmById2, getCustKey
// Primary Port Class Name: CustKeyServiceImplPort  
public class custkeyserviceWebservicesItsosAmeri {
    public class CustKeyServiceImplPort {
        public String endpoint_x = 'http://acdt1403:8081/SpiService/services/CustKeyService';
        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://acdt1403:8080/CustKeyService','acdt14038080Custkeyservice'};

        public String getCrm(String id) {
            acdt14038080Custkeyservice.getCrm_element request_x = new acdt14038080Custkeyservice.getCrm_element();
            acdt14038080Custkeyservice.getCrmResponse_element response_x;
            request_x.id = id;
            Map<String, acdt14038080Custkeyservice.getCrmResponse_element> response_map_x = new Map<String, acdt14038080Custkeyservice.getCrmResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'http://acdt1403:8080/CustKeyService',
                'getCrm',
                'http://acdt1403:8080/CustKeyService',
                'getCrmResponse',
                'acdt14038080Custkeyservice.getCrmResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.out;
        }

        public String getCrmByCustId(String id) {
            acdt14038080Custkeyservice.getCrmByCustId_element request_x = new acdt14038080Custkeyservice.getCrmByCustId_element();
            acdt14038080Custkeyservice.getCrmByCustIdResponse_element response_x;
            request_x.id = id;
            Map<String, acdt14038080Custkeyservice.getCrmByCustIdResponse_element> response_map_x = new Map<String, acdt14038080Custkeyservice.getCrmByCustIdResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'http://acdt1403:8080/CustKeyService',
                'getCrmByCustId',
                'http://acdt1403:8080/CustKeyService',
                'getCrmByCustIdResponse',
                'acdt14038080Custkeyservice.getCrmByCustIdResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.out;
        }

        public String getCrmById(String id) {
            acdt14038080Custkeyservice.getCrmById_element request_x = new acdt14038080Custkeyservice.getCrmById_element();
            acdt14038080Custkeyservice.getCrmByIdResponse_element response_x;
            request_x.id = id;
            Map<String, acdt14038080Custkeyservice.getCrmByIdResponse_element> response_map_x = new Map<String, acdt14038080Custkeyservice.getCrmByIdResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'http://acdt1403:8080/CustKeyService',
                'getCrmById',
                'http://acdt1403:8080/CustKeyService',
                'getCrmByIdResponse',
                'acdt14038080Custkeyservice.getCrmByIdResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.out;
        }

        public String getCrmById2(String id) {
            acdt14038080Custkeyservice.getCrmById2_element request_x = new acdt14038080Custkeyservice.getCrmById2_element();
            acdt14038080Custkeyservice.getCrmById2Response_element response_x;
            request_x.id = id;
            Map<String, acdt14038080Custkeyservice.getCrmById2Response_element> response_map_x = new Map<String, acdt14038080Custkeyservice.getCrmById2Response_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'http://acdt1403:8080/CustKeyService',
                'getCrmById2',
                'http://acdt1403:8080/CustKeyService',
                'getCrmById2Response',
                'acdt14038080Custkeyservice.getCrmById2Response_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.out;
        }

        public String getCustKey(String id) {
            acdt14038080Custkeyservice.getCustKey_element request_x = new acdt14038080Custkeyservice.getCustKey_element();
            acdt14038080Custkeyservice.getCustKeyResponse_element response_x;
            request_x.id = id;
            Map<String, acdt14038080Custkeyservice.getCustKeyResponse_element> response_map_x = new Map<String, acdt14038080Custkeyservice.getCustKeyResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
                this,
                request_x,
                response_map_x,
                new String[]{endpoint_x,
                '',
                'http://acdt1403:8080/CustKeyService',
                'getCustKey',
                'http://acdt1403:8080/CustKeyService',
                'getCustKeyResponse',
                'acdt14038080Custkeyservice.getCustKeyResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.out;
        }
    }
}

Original Issue:

The operation getCrm takes an input message of the same name.

<wsdl:operation name="getCrm">
  <wsdl:input message="ns1:getCrm" name="getCrm">
  </wsdl:input>
  <wsdl:output message="ns1:getCrmResponse" name="getCrmResponse">
  </wsdl:output>
</wsdl:operation>

There is no corresponding wsdl:message with the name "getCrm".

Compare this to getCrmResponse, which has:

<wsdl:message name="getCrmResponse">
  <wsdl:part element="ns1:getCrmResponse" name="parameters">
  </wsdl:part>
</wsdl:message>

<xs:element name="getCrmResponse">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="out" nillable="true" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

So, as presented in the question there are sections of the WSDL missing.

  • you're correct, I left that portion off. I added the xs:element section back to my original post. That's what happens when I try to edit the originally generated wsdl. Thanks for pointing that out, hopefully we can keep working towards a solution. – KcBrewRon Apr 21 '15 at 16:42
  • When I try to include these in the tool, the input parameters name is null, which I think is the issue. Every other tool I've used always makes the input parameter java.lang.String with a name of id. – KcBrewRon Apr 21 '15 at 16:43
0

I successfully completed this code effort myself. I took a look at their example and their explanation from the apex guide and recreated what was needed for my own WSDL.

I then was able to wire this together with my controller and use the mock web service also documented from the guide to implement my test classes. Lastly, I had the http auth headers included for when I call the webservice to ensure it's secure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.