catching 404 errors with the WCF-WebHttp adapter

Hi

I am consume a Rest Service (GET verb). This service can return a 404 if what I am searching for is not found (standard pattern in REST). This raises a System.Web.Services.Protocols.SoapException in BizTalk which I can catch in my Orchestration, problem is its not exactly obvious that is a 404 

This the error I get back is "There was no endpoint listening at xxx that could accept the message."

Is there a way to capture the code coming back, do I need to implement a custom behavior to inspect HTTP header status property or do I have to deal with string searches etc in the exception text looking for no endpoint listening or similar?

thanks

August 28th, 2015 12:33am

Hi Jody,

For catching protocol exception consider the below links. You have to create a custom binding element which in turn will create the corresponding WCF channel to handle the interaction with the service, so once the ProtocolException comes you can handle it.

http://social.technet.microsoft.com/wiki/contents/articles/16625.biztalk-server-rest-services-error-handling.aspx

http://blogs.msdn.com/b/endpoint/archive/2010/01/21/error-handling-in-wcf-webhttp-services-with-webfaultexception.aspx

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 1:15am

I am using 2013R2 I have seen these posts but was hoping its easier with 213R2
August 28th, 2015 1:18am

I am using 2013R2 I have seen these posts but was hoping its easier
Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 1:25am

Hi,

404 is a protocol exception and to capture protocol exception in web http adapter you can follow the same link

https://social.technet.microsoft.com/Forums/en-US/9ba38212-0837-4f54-9bac-6670ef2e13a0/wcfwebhttp-biztalk-2013-how-to-catch-http-400-response?forum=biztalkr2adapters

We have discussed this on the forum and you can take referece from there as well

https://social.technet.microsoft.com/Forums/en-US/9ba38212-0837-4f54-9bac-6670ef2e13a0/wcfwebhttp-biztalk-2013-how-to-catch-http-400-response?forum=biztalkr2adapters

Thanks

Abhishek

August 28th, 2015 1:53am

ok sounds like to implement this I would need to use the blogicalREST starter kit instead of the new adapter in BT2013??
Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 2:25am

ok sounds like to implement this I would need to use the blogicalREST starter kit instead of the new adapter i
August 28th, 2015 2:32am

forgive my ignorance, but if I use a custombinding how do I set the query string to set up my GET operation. Will I need to also implement that somehow?

Thats why I asked if I needed the start kit. I want to stiil use ws-webhttp

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 11:08am

Hi Jody ,

You need to configure HTTP Method and URL Mapping in web http adapter configuration .you need to add  GET method and the URL.

Something like below

Please refer:https://shadabanwer.wordpress.com/2013/07/24/using-wcf-webhttp-receive-adapter-for-http-getpost-url-rewrite/

https://seroter.wordpress.com/2013/03/19/yes-richard-you-can-use-ampersands-on-the-biztalk-rest-adapter-and-some-asp-net-web-api-tips/

Thanks

Abhishek


August 28th, 2015 11:15am

Hi Jody ,

You need to configure HTTP Method and URL Mapping in web http adapter configuration .you need to add  GET method and the URL.

Something like below

Please refer:https://shadabanwer.wordpress.com/2013/07/24/using-wcf-webhttp-receive-adapter-for-http-getpost-url-rewrite/

https://seroter.wordpress.com/2013/03/19/yes-richard-you-can-use-ampersands-on-the-biztalk-rest-adapter-and-some-asp-net-web-api-tips/

Thanks

Abhishek


Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 3:11pm

Hi Jody ,

You need to configure HTTP Method and URL Mapping in web http adapter configuration .you need to add  GET method and the URL.

Something like below

Please refer:https://shadabanwer.wordpress.com/2013/07/24/using-wcf-webhttp-receive-adapter-for-http-getpost-url-rewrite/

https://seroter.wordpress.com/2013/03/19/yes-richard-you-can-use-ampersands-on-the-biztalk-rest-adapter-and-some-asp-net-web-api-tips/

Thanks

Abhishek


August 28th, 2015 3:11pm

Hi Jody ,

You need to configure HTTP Method and URL Mapping in web http adapter configuration .you need to add  GET method and the URL.

Something like below

Please refer:https://shadabanwer.wordpress.com/2013/07/24/using-wcf-webhttp-receive-adapter-for-http-getpost-url-rewrite/

https://seroter.wordpress.com/2013/03/19/yes-richard-you-can-use-ampersands-on-the-biztalk-rest-adapter-and-some-asp-net-web-api-tips/

Thanks

Abhishek


Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 3:11pm

Again, with a custom binding and webhttp binding you do not have this screen.

J

August 29th, 2015 2:46am

HI,

I know how to use the wcf-webhttp adapter. My question is though, using a custom binding HOW do I get to do the variable mapping because if I use a custom binding I DONT have the ability to do the variable mapping via the UI...

The custom Binding Element you describe in your post doesn't cater for this. SO my question still remains how do I do the varialbe mapping using the custom binding and the code in the sample

thanks

August 30th, 2015 6:58pm

Hi ,

You can refer MSDN gallery below for source code

https://code.msdn.microsoft.com/BizTalk-Server-2013-WCF-e3e4a4f9

If you still have issue let us know so that we can help you out with more clarification

Thanks

Abhishek


Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 7:46am

Hi ,

You can refer MSDN gallery below for source code

https://code.msdn.microsoft.com/BizTalk-Server-2013-WCF-e3e4a4f9

If you still have issue let us know so that we can help you out with more clarification

Thanks

Abhishek


August 31st, 2015 11:41am

Hi ,

You can refer MSDN gallery below for source code

https://code.msdn.microsoft.com/BizTalk-Server-2013-WCF-e3e4a4f9

If you still have issue let us know so that we can help you out with more clarification

Thanks

Abhishek


Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 11:41am

Hi ,

You can refer MSDN gallery below for source code

https://code.msdn.microsoft.com/BizTalk-Server-2013-WCF-e3e4a4f9

If you still have issue let us know so that we can help you out with more clarification

Thanks

Abhishek


August 31st, 2015 11:41am

Hi ,

You can refer MSDN gallery below for source code

https://code.msdn.microsoft.com/BizTalk-Server-2013-WCF-e3e4a4f9

If you still have issue let us know so that we can help you out with more clarification

Thanks

Abhishek


Free Windows Admin Tool Kit Click here and download it now
August 31st, 2015 11:41am

Hi Once I downloaded your code and saw exactly what was happening works perfectly FYI because I was wanting to catch 404 errors I just had to change the endrequest of the binding element to also catch system.exception as this type of status (404) does not throw a protocol exception... Thanks
September 1st, 2015 4:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics