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.
  2. C:\>svcutil /target:metadata <WCF Service Address>

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

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

BizTalk360
BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More
Serverless360
Azure

Manage and monitor serverless
components effortlessly

Learn More
Atomicscope
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top