Topic
  • 5 replies
  • Latest Post - ‏2010-03-10T01:21:58Z by LGD
LGD
LGD
34 Posts

Pinned topic Setting http resonse code in MPGW back to an AS2 handler.

‏2010-03-08T23:54:22Z |
Hi,

I have a B2B service running which has a front side as2 handler. The AS2 part works fine from parter to parter etc. Once the B2B service hands off to my MPGW I call an external URL via the open-url extension function from an XSL stylesheet. The response code of this call I wish to pass back to the AS2 handler on the return of the backend call. I have been playing around setting various variables regarding settings repsonse codes but im sure this code is not being set in the response back to the AS2 handler and the AS2 handler propagating it to the test tool i am using.

In essence the real world scenario is -

1. A partner sends in AS2 message(post a message to AS2 handler via http test tool).
2. AS2 handler handsoff to backend url.
3. Backend MPGW url receives XML message.
4. MPGW handsoff to a java webservice via open-url extension function via a transform action in a policy.
5. Java webservice returns and the asscociated response code returned is set in the stylesheet to <dp:set-response-header name="'x-dp-response-code'" value="$cache-response/url-open/responsecode"/>.
6. MPGW returns to AS2 handler...
7. AS2 handler returns to http testing tool.

Any help much appreciated...
Updated on 2010-03-10T01:21:58Z at 2010-03-10T01:21:58Z by LGD
  • swlinn
    swlinn
    1348 Posts

    Re: Setting http resonse code in MPGW back to an AS2 handler.

    ‏2010-03-09T13:23:33Z  
    I posted this about setting the http response code, so perhaps this will work in your case.

    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14432385&#14432385

    Regards,
    Steve
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Setting http resonse code in MPGW back to an AS2 handler.

    ‏2010-03-09T15:27:02Z  
    Is your MPGW a loopback (i.e. var://service/mpgw/skip-backside variable set to 1)? Are you doing this, <dp:set-http-response-header name="'x-dp-response-code'" value="$cache-response/url-open/responsecode"/>, in a Request Rule instead of a Response Rule?

    If your Java WebService is the actual Provider, I would recommend letting the MPGW make a "backside call" to the WebService by setting the backend URL rather than using the url-open to make a "side call", MPGW Response Type can be set to Pass-Thru.

    Regards,
    --Arife
  • LGD
    LGD
    34 Posts

    Re: Setting http resonse code in MPGW back to an AS2 handler.

    ‏2010-03-09T19:41:57Z  
    Is your MPGW a loopback (i.e. var://service/mpgw/skip-backside variable set to 1)? Are you doing this, <dp:set-http-response-header name="'x-dp-response-code'" value="$cache-response/url-open/responsecode"/>, in a Request Rule instead of a Response Rule?

    If your Java WebService is the actual Provider, I would recommend letting the MPGW make a "backside call" to the WebService by setting the backend URL rather than using the url-open to make a "side call", MPGW Response Type can be set to Pass-Thru.

    Regards,
    --Arife
    Actually in a request rule but after the call to url-open.
    I have added an error rule which now does collect the responses. If you do a probe you can see the service variables set with the return of that call for the extension function. Just seems to not get back to the caller...
  • LGD
    LGD
    34 Posts

    Re: Setting http resonse code in MPGW back to an AS2 handler.

    ‏2010-03-09T20:05:53Z  
    Is your MPGW a loopback (i.e. var://service/mpgw/skip-backside variable set to 1)? Are you doing this, <dp:set-http-response-header name="'x-dp-response-code'" value="$cache-response/url-open/responsecode"/>, in a Request Rule instead of a Response Rule?

    If your Java WebService is the actual Provider, I would recommend letting the MPGW make a "backside call" to the WebService by setting the backend URL rather than using the url-open to make a "side call", MPGW Response Type can be set to Pass-Thru.

    Regards,
    --Arife
    I have an on error action in the request rule. This is called when an error occurs and it does work when the call the the side service results in an error. By doing a probe I can see the following results in the service variables section on the error rule called -

    var://service/error-code string 0x01130006
    var://service/error-headers string 'HTTP/1.1 500 Error Content-Type: text/xml X-Backside-Transport: FAIL FAIL Connection: close '
    var://service/error-ignore string '0'
    var://service/error-message string 'Failed to establish a backside connection'
    var://service/error-subcode string '0x00000000'
    var://service/formatted-error-message string '<?xml version='1.0' ?> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Body> <env:Fault> <faultcode>env:Client</faultcode> <faultstring>Internal Error</faultstring> </env:Fault> </env:Body> </env:Envelope> '

    However this information seems to not get back to the original as2 caller.
  • LGD
    LGD
    34 Posts

    Re: Setting http resonse code in MPGW back to an AS2 handler.

    ‏2010-03-10T01:21:58Z  
    Is your MPGW a loopback (i.e. var://service/mpgw/skip-backside variable set to 1)? Are you doing this, <dp:set-http-response-header name="'x-dp-response-code'" value="$cache-response/url-open/responsecode"/>, in a Request Rule instead of a Response Rule?

    If your Java WebService is the actual Provider, I would recommend letting the MPGW make a "backside call" to the WebService by setting the backend URL rather than using the url-open to make a "side call", MPGW Response Type can be set to Pass-Thru.

    Regards,
    --Arife
    Working now.

    Seems the test tool was receiving status back from the as2 handler on the partner side which of course was a successful http post all the time.

    I had set up a partner local to the xb60 that had an http fsh which then created an as2 message and posted to "my" inbound b2b partner...

    Cheers for your help guys.