Object reference not set to an instance of an object – BizTalk WCF Service Consuming Wizard

While consuming a WCF Service using BizTalk WCF Service Consuming Wizard you may end up with an error..

“Error consuming WCF service metadata.

Object reference not set to an instance of an object”

One possible reason for this issue is that the WSDL Generated after consuming the Service might not have any namespace for the schema to be imported.

This can be resolved in simple steps as below.

    1. Generate the metadata for the Service using Svcutil.exe as given below.

C:\>svcutil /target:metadata <WCF Service Address>

  1. The above command will generate the Wsdl file and XML Schema file.
  2. Copy the Target namespace from the XML Schema file (.xsd file) and paste it in the <xsd:schema> node of the wsdl file.
  3. The Resultant <xsd:schema> node of the wsdl file should look some thing like this. <xsd:schema targetNamespace=”http://Something.com”>
  4. Now run the BizTalk WCF Service Consuming Wizard and select the second option.
  5. Add both the wsdl and schema file to the Wizard.
  6. Import should now be successful.

Post your comments if any has an alternate solution.
– Shiv


Web Counters
#1 all-in-one platform for Microsoft BizTalk Server management and monitoring
turbo360

Back to Top