Asked by:
BizTalk 2010 Error consuming WCF service metadata. Object reference not set to an instance of an object.

Question
-
"Error consuming WCF service metadata.
Object reference not set to an instance of an object."I have no clue what happen to my BizTalk. I checked all the below forum but m clueless why BTS not consuming WCF through Generated Items. I tried both metadata exhange endpoint and metadata file through svcutil. but all my wcf services are working fine with .net C# client.
http://msdn.microsoft.com/en-us/library/bb226552.aspx
http://msdn.microsoft.com/en-us/library/bb798122.aspx
http://masteringbiztalkserver.wordpress.com/tag/wcf-service-consuming-wizard/
I reinstall the WCF lob Adapter SDK to my BizTalk VM but still no clue. no erros in event viewer nothing.
http://www.abdulazizfarooqi.wordpress.com Abdul Aziz Farooqi [BizTalk & SharePoint Consultant] MCPD Web & MCPD SharePoint 2010
Saturday, October 27, 2012 5:18 PM
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.
Thanks
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
<types>
<xsd:schema targetNamespace="xxxxx">
<xsd:import schemaLocation="some.xsd" namespace="xxxxxx" />
</xsd:schema>
</types>I just set it to be same as namespace.
Neal
- 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
- Edited by Leonid GanelineModerator Thursday, January 17, 2013 10:11 PM
Thursday, January 17, 2013 10:11 PMModerator -
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?
Thanks
Claudiu
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:
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://schemas.microsoft.com/exchange/services/2006/messages" schemaLocation="messages.xsd"/>
</xs:schema>by giving the same targetNamespace as assigned in the <wsdl:definitions element, so I ended up with
<wsdl:types>
<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"/>
</xs:schema>
Thursday, November 20, 2014 5:40 PM