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.
- Generate the metadata for the Service using Svcutil.exe as given below.
- The above command will generate the Wsdl file and XML Schema file.
- Copy the Target namespace from the XML Schema file (.xsd file) and paste it in the <xsd:schema> node of the wsdl file.
- The Resultant <xsd:schema> node of the wsdl file should look some thing like this. <xsd:schema targetNamespace=”http://Something.com”>
- Now run the BizTalk WCF Service Consuming Wizard and select the second option.
- Add both the wsdl and schema file to the Wizard.
- Import should now be successful.
C:\>svcutil /target:metadata <WCF Service Address>
Post your comments if any has an alternate solution.
No comments yet.