BizTalk 2010 Error consuming WCF service metadata. Object reference not set to an instance of an object. RRS feed

All replies

  • hi,

    are you able to generate schema using Svcutil.exe? does it have http endpoint exposed or net.tcp? can you paste wsdl

    Saturday, October 27, 2012 11:06 PM
  • Hi Abdul,

    We have also faced similar problem . I am only suggesting that you once try this :

    1. Run in VS command prompt and type :

    svcutil /t:metadata <service url>

    2. This will generate *.wsdl and *.xsd

    3. While using BizTalk Generated Items service select the 2nd option and then browse and select all the *.wsdl and *.xsd.

    4. Hope this will work.

    If the above procedure doesnt work then do as mentioned upto step 2.

    Then open the wsdl using notepad++ and delete if similar namespace present in the wsdl.

    Then do as mentioned in step 3.


    Monday, October 29, 2012 10:55 AM
  • Per this blog, http://blogs.msdn.com/b/kerreybpi/archive/2009/02/05/biztalk-error-wcf-service-consuming-wizard.aspx,

    Export as described above with svcutil, then use your editor to add a targetNamespace attribute

        <xsd:schema targetNamespace="xxxxx">
          <xsd:import schemaLocation="some.xsd" namespace="xxxxxx" />

    I just set it to be same as namespace.


    • Edited by Neal Walters Thursday, January 17, 2013 4:46 PM
    • Proposed as answer by Riaan.Gouws74 Wednesday, September 18, 2013 5:50 PM
    Thursday, January 17, 2013 4:46 PM
  • Try to get the metadata with SoapUi. Maybe there is an error in the metadata.

    Are you able to get metadata from another web-service or this error is local to one service?

    Leonid Ganeline [BizTalk MVP] BizTalk: Internals: Namespaces

    Thursday, January 17, 2013 10:11 PM
  • Thanks Neal!

    Your answer was spot on; helped me out when I ran into this issue.

    Thanks, Riaan Gouws

    Wednesday, September 18, 2013 5:50 PM
  • Leonid, I am not sure if this thread is still active, but I am having the same issue when trying to consume the WCF service metadata. I can get the metadata in SoapUI, no problems, using my WSDL, which I changed to have a namespace by the way. When I try to add generated items and consume WCF service through Visual Studio, using the same WSDL, I get the "object reference not set... " error. Any idea what's going on, I've been battling this for a few days now?



    Friday, August 29, 2014 10:43 PM
  • Thanks from me too Neal - this worked from me. I wan't able to consume directly from exchange because the certificate is broken. However, I was able to convince Google Chrome to let me view the /Services.wsdl and from there I could save the .wsdl and two .xsd files. In my case the problem lay at the top of the .wsdl file. I changed the following:

            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
                <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="messages.xsd"/>

    by giving the same targetNamespace as assigned in the <wsdl:definitions element, so I ended up with

            <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/exchange/services/2006/messages">
                <xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="messages.xsd"/>

    Thursday, November 20, 2014 5:40 PM