Consuming Web Services without web reference in BizTalk
Last week I came across a scenario where I had to call the card verification service before updating the credit/debit card status. This was the first time I was consuming a web service in an orchestration so I had a little trouble in the beginning. Very innocently I made request and response messages of the schema types which I got from the wsdl, made a request-response port and deployed the project. Configured the port to use the SOAP adapter and gave the URI of the web service. I tested my orchestration and was expecting the results but got the exception in the system Event Log.
“Failed to load “” type.
Please verify the fully-qualified type name is valid.
Details: “”.
The type must derive from System.Web.Services.Protocols.SoapHttpClientProtocol.
The type must have the attribute System.Web.Services.WebServiceBindingAttribute. “.
After a little search on the internet I found out that I have to add the web reference of the web service and configure web ports and web messages and cannot call the web service in this manner. However I succeeded to consume the web service but I had to consume the web service without adding the web references. Because I figured out if the schemas change in the future of the web service (which was most likely too) then I had to update the web references, recompile and redeploy the project.
Adding the web reference in my project I got the following items which will be used by BizTalk to consume the web service.
-
Universal Resource locator (URI)
-
WSDL which contains the methods,ports and message type information of the web service.
-
Reference map (Which will contain xsd’s).

BizTalk will then use web port types and web messages from the web reference generated items. It will capture web ports from the WSDL and web messages from the reference.xsd’s generated.
The trick is if we can generate these items for BizTalk we can surely call the web service without using web reference. The work around for this is generating the proxy class from wsdl.exe. You can generate the proxy class from visual studio command prompt and giving the proper switches will create the proxy class.
You can see the MSDN help for more switches of wsdl.
wsdl /out:[dir]proxy.cs http://localhost/[webservice URI].asmx?wsdl
After generating the proxy class you can add the proxy class to a .NET Library project, give it a strong name key file, build the project. (Don’t forget to GAC the generated assembly before deploying the BizTalk Project).
Technically the SOAP.MethodName and SOAP.AssemblyName properties are promoted to the context of the message before being published to the message box and these values are supplied automatically when we use web port (which come from the web reference). We can supply the AsemblyName and MethodName from the proxy class we created. After its GAC’d we can configure the send port of the orchestration and supply the AssemblyName and MethodName properties for the message context. After the BizTalk Project is deployed we can configure the send port calling the web service. In the web service tab, select the assembly which was created before by building the .NET library project containing the proxy class. Select the Type name and method name and in the general tab specify the web service URI.

In this way you can have more control over the proxy and handle its versioning and a little change in the web service won’t make you build deploy the project again.
technorati tags : BizTalk



RSS - Posts
Hi Rafay,
We are trying with a proxy class but we are retrieving an error in the service response… The problem is the message that we send to the destination is sent empty… The proxy class may be sending this in a wrong way… but why???
Could you help us?
Thanks in advance.
Regards,
Mercedes
Hi Abdul,
At present we are using Biztalk server in our application. When i set the receive location and the send port as FILE (Transport Prop) then my application is working fine, and i am getting all the records in the database as an XML file format.
now i changed the receive port as a “request-response” port, again i deploied my biztalk project, and i publised my orchestration as a webservice in IIS, using “BizTalk Web Services Publishing Wizard”.
I added a new receive location as request-response port and set the transport porp as SOAP, and configured the biztalk application.
i added the published biztalk_Proxy in my IIS as web reference to my .net application. i’m getting the result but it is showing only one record (the top most record) of the database. not showing all the records as it showed in the XML file..
So please help me to get the total records from the database to my application…..
thanks in advance…….
You have to set the MaxOccurs property of the repeating record node to “unbounded” in the response schema. Update the schema and redeploy the project. Publish the web service again through the wizard. Then update the web reference in your calling application. This will create an array of the record that is repeating (has multiple records) in the .NET code. You can then enumerate this record to get the results.
Thank you Abdul,
Your solution helped me a lot.
i exactly got the result, that what i expected.
Thank you very much ….
Hi abdul…
here i have one more problem with xml prepareation…
My Output xml should be like this…
-
Abdominal Pain
1
XYZ
1234
2345
-
Abdominal Pain
2
XYZ
1234
2345
-
Abdominal Pain
3
XYZ
1234
2345
I got the exact result in my plain xml format..
But when i published my biztalk application as a web service ..then the resultant xml is as follows….
-
Abdominal Pain
1
XYZ
-
Abdominal Pain
2
XYZ
-
Abdominal Pain
3
XYZ
Here i`m loosing the hierarchy… at the node …
i tried with so many properities as you said in my previous problem… But i did not get the result… Please help me on this issue…
Thanks in advance….
Sorry Abdul Tags were missed…
So i`m sending my format again… Please don’t mind…
“(” as “”
here i have one more problem with xml prepareation…
My Output xml should be like this…
(AAAAA xmlns:xsi=”********” xmlns:xsd=”http://*********”)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)1(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF)
———-(GGGG)1234(/GGGG)
———-(GGGG)2345(/GGGG)
—–(/FFFF)
(/BBBBBBB)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)2(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF)
———-(GGGG)1234(/GGGG)
———-(GGGG)2345(/GGGG)
—–(/FFFF)
(/BBBBBBB)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)3(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF)
———-(GGGG)1234(/GGGG)
———-(GGGG)2345(/GGGG)
—–(/FFFF)
(/BBBBBBB)
(/AAAAA)
I got the exact result in my plain xml format..
But when i published my biztalk application as a web service ..then the resultant xml is as follows….
(AAAAA xmlns:xsi=”********” xmlns:xsd=”http://*********”)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)1(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF /)
(/BBBBBBB)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)2(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF /)
(/BBBBBBB)
- (BBBBBBB)
—–(cccc)Abdominal Pain(/cccc)
—–(dddd)3(/dddd)
—–(EEEE)XYZ(/EEEE)
—–(FFFF /)
(/BBBBBBB)
(/AAAAA)
Here i`m loosing the hierarchy… at the node (FFFF)…
i tried with so many properities as you said in my previous problem… But i did not get the result… Please help me on this issue…
Thanks in advance….
got the solution Abdul…
due to in valid data type it is not showing the result..
I changed the data type .. and then i got the out put…
Sorry to disturb you…
Any how thanks once again….
Mani…
No Problem….
hi abdul…
I need one more help form you…
actually i`m getting data from database, and and the data is binding like the followin way…. When i set to the max occurence prop to unbound.
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
” (BBB=“123123123” NNN=““ /) ”
” (BBB=“123123123” NNN=““ /) ”
” (BBB=“123123123” NNN=““ /) ”
” (BBB=“123123123” NNN=““ /) ”
” (BBB=“123123123” NNN=““ /) ”
” (CCC=“234234” DDD=“lkjlkj” /) ”
” (CCC=“123123” DDD=“sdfsdf” /) ”
” (CCC=“345345” DDD=“werwer” /) ”
” (CCC=“456456” DDD=“sdffgh” /) ”
” (CCC=“135135” DDD=“poiwer /) ”
” (EEE /) ”
” (EEE /) ”
” (EEE /) ”
” (EEE /) ”
” (EEE /) ”
” (FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
” (FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
” (FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
” (FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
” (FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
” (GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (/AAAA)“
if i do not set the max occurence prop to unbound my xml document is like the following..
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“234234” DDD=“lkjlkj” /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (/AAAA)“
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“123123” DDD=“sdfsdf” /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ” ”
(/AAAA)“
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“345345” DDD=“werwer” /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ” ”
(/AAAA)“
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“456456” DDD=“sdffgh” /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ” ”
(/AAAA)“
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“135135” DDD=“poiwer /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ” ”
(/AAAA)“
and i need the actual output like this…
“(AAAA ABC=“XYZ” SDF=“FGHFGHFGH” FGHH=“SDFSDF”)”
(BBB=“123123123” NNN=““ /) ”
(CCC=“234234” DDD=“lkjlkj” /) ”
(CCC=“123123” DDD=“sdfsdf” /) ”
(CCC=“345345” DDD=“werwer” /) ”
(CCC=“456456” DDD=“sdffgh” /) ”
(CCC=“135135” DDD=“poiwer /) ”
(EEE /) ”
(FFF)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(/FFF) ”
(GGG)BBBBBBBBBBBBBBBBBB(/GGG) ”
” (/AAAA)“
is there any possibility to get such output in biztalk…????
thanks in advance…
MANI…